go-dg.exp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright (C) 2009-2015 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with GCC; see the file COPYING3. If not see
  14. # <http://www.gnu.org/licenses/>.
  15. load_lib gcc-dg.exp
  16. # Define go callbacks for dg.exp.
  17. proc go-dg-test { prog do_what extra_tool_flags } {
  18. set result \
  19. [gcc-dg-test-1 go_target_compile $prog $do_what $extra_tool_flags]
  20. set comp_output [lindex $result 0]
  21. set output_file [lindex $result 1]
  22. return [list $comp_output $output_file]
  23. }
  24. proc go-dg-prune { system text } {
  25. return [gcc-dg-prune $system $text]
  26. }
  27. # Utility routines.
  28. # Modified dg-runtest that can cycle through a list of optimization options
  29. # as c-torture does.
  30. proc go-dg-runtest { testcases flags default-extra-flags } {
  31. global runtests
  32. global TORTURE_OPTIONS
  33. foreach test $testcases {
  34. # If we're only testing specific files and this isn't one of
  35. # them, skip it.
  36. if ![runtest_file_p $runtests $test] {
  37. continue
  38. }
  39. # look if this is dg-do-run test, in which case
  40. # we cycle through the option list, otherwise we don't
  41. if [expr [search_for $test "dg-do run"]] {
  42. set option_list $TORTURE_OPTIONS
  43. } else {
  44. set option_list [list { -O } ]
  45. }
  46. set nshort [file tail [file dirname $test]]/[file tail $test]
  47. foreach flags_t $option_list {
  48. verbose "Testing $nshort, $flags $flags_t" 1
  49. dg-test $test "$flags $flags_t" ${default-extra-flags}
  50. }
  51. }
  52. }