Include target-supports.exp
[official-gcc.git] / gcc / testsuite / lib / gcc-dg.exp
blob6dd930f864544e1b66d0e6f6539df06806450031
1 # Copyright (C) 1997, 1999 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 2 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 this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gcc@prep.ai.mit.edu
20 # Define gcc callbacks for dg.exp.
22 load_lib dg.exp
23 load_lib file-format.exp
24 load_lib target-supports.exp
26 proc gcc-dg-test { prog do_what extra_tool_flags } {
27 # Set up the compiler flags, based on what we're going to do.
29 switch $do_what {
30 "preprocess" {
31 set compile_type "preprocess"
32 set output_file "[file rootname [file tail $prog]].i"
34 "compile" {
35 set compile_type "assembly"
36 set output_file "[file rootname [file tail $prog]].s"
38 "assemble" {
39 set compile_type "object"
40 set output_file "[file rootname [file tail $prog]].o"
42 "link" {
43 set compile_type "executable"
44 set output_file "a.out"
45 # The following line is needed for targets like the i960 where
46 # the default output file is b.out. Sigh.
48 "run" {
49 set compile_type "executable"
50 # FIXME: "./" is to cope with "." not being in $PATH.
51 # Should this be handled elsewhere?
52 # YES.
53 set output_file "./a.out"
54 # This is the only place where we care if an executable was
55 # created or not. If it was, dg.exp will try to run it.
56 remote_file build delete $output_file;
58 default {
59 perror "$do_what: not a valid dg-do keyword"
60 return ""
63 set options ""
64 if { $extra_tool_flags != "" } {
65 lappend options "additional_flags=$extra_tool_flags"
68 set comp_output [gcc_target_compile "$prog" "$output_file" "$compile_type" $options];
70 return [list $comp_output $output_file]
74 proc gcc-dg-prune { system text } {
75 set text [prune_gcc_output $text]
77 # If we see "region xxx is full" then the testcase is too big for ram.
78 # This is tricky to deal with in a large testsuite like c-torture so
79 # deal with it here. Just mark the testcase as unsupported.
80 if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] {
81 # The format here is important. See dg.exp.
82 return "::unsupported::memory full"
85 return $text