* lib/ubsan-dg.exp (check_effective_target_fsanitize_undefined):
[official-gcc.git] / gcc / testsuite / lib / go-dg.exp
blobf222220f7ef1dbd21a42772fb813974789ce9062
1 # Copyright (C) 2009-2014 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.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 load_lib gcc-dg.exp
19 # Define go callbacks for dg.exp.
21 proc go-dg-test { prog do_what extra_tool_flags } {
22 set result \
23 [gcc-dg-test-1 go_target_compile $prog $do_what $extra_tool_flags]
25 set comp_output [lindex $result 0]
26 set output_file [lindex $result 1]
28 return [list $comp_output $output_file]
31 proc go-dg-prune { system text } {
32 return [gcc-dg-prune $system $text]
35 # Utility routines.
37 # Modified dg-runtest that can cycle through a list of optimization options
38 # as c-torture does.
39 proc go-dg-runtest { testcases flags default-extra-flags } {
40 global runtests
41 global TORTURE_OPTIONS
43 foreach test $testcases {
44 # If we're only testing specific files and this isn't one of
45 # them, skip it.
46 if ![runtest_file_p $runtests $test] {
47 continue
50 # look if this is dg-do-run test, in which case
51 # we cycle through the option list, otherwise we don't
52 if [expr [search_for $test "dg-do run"]] {
53 set option_list $TORTURE_OPTIONS
54 } else {
55 set option_list [list { -O } ]
58 set nshort [file tail [file dirname $test]]/[file tail $test]
60 foreach flags_t $option_list {
61 verbose "Testing $nshort, $flags $flags_t" 1
62 dg-test $test "$flags $flags_t" ${default-extra-flags}