gas-dg.exp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Define gas callbacks for dg.exp.
  2. # Copyright (C) 2012-2022 Free Software Foundation, Inc.
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
  16. load_lib dg.exp
  17. # The use of this function is still in a bit of flux.
  18. # It should be theoretically possible to assemble, link, and run a file
  19. # but we currently don't support that. Assembler testcases aren't usually
  20. # that elaborate anyway. :-)
  21. proc gas-dg-test { prog do_what tool_flags } {
  22. # FIXME: the gas testsuite doesn't define tmpdir. Use outdir?
  23. set output_file "./a.out"
  24. switch $do_what {
  25. "preprocess" {
  26. }
  27. "assemble" {
  28. }
  29. "link" {
  30. }
  31. "run" {
  32. # This is the only place where we care if an executable was
  33. # created or not. If it was, dg.exp will try to run it.
  34. remote_file host delete "$output_file"
  35. }
  36. default {
  37. perror "$do_what: not a valid dg-do keyword"
  38. return ""
  39. }
  40. }
  41. # gas_start prepends $srcdir/$subdir so we must remove it from PROG
  42. # if present. First remove extraneous //'s.
  43. global srcdir subdir
  44. set dir "$srcdir/$subdir"
  45. regsub -all "//" $dir "/" dir
  46. regsub -all "//" $prog "/" prog
  47. if [string match "$dir/*" $prog] {
  48. # We use (?q) to treat $dir as a literal.
  49. regsub "(?q)$dir" $prog "" prog
  50. }
  51. # FIXME: This should be gas_start but it doesn't set comp_output.
  52. return [gas_run $prog $tool_flags ""]
  53. }
  54. proc gas-dg-prune { system text } {
  55. #send_user "Before:$text\n"
  56. regsub -all "(^|\n)\[^\n\]*: Assembler messages:\[^\n\]*" $text "" text
  57. regsub -all "(^|\n)\[^\n\]*: End of file not at end\[^\n\]*Newline inserted." $text "" text
  58. #send_user "After:$text\n"
  59. return $text
  60. }