* arm.md (stack_tie): New insn. Use an idiom that the alias code
[official-gcc.git] / gcc / testsuite / lib / objc-dg.exp
blob397bb2b9c809deef817dc7ce476792e0cc7f5373
1 # Copyright (C) 1997, 1999, 2000, 2001 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 load_lib dg.exp
18 load_lib file-format.exp
19 load_lib target-supports.exp
20 load_lib scanasm.exp
22 # For prune_gcc_output.
23 load_lib gcc.exp
25 if ![info exists TORTURE_OPTIONS] {
26 # It is theoretically beneficial to group all of the O2/O3 options together,
27 # as in many cases the compiler will generate identical executables for
28 # all of them--and the c-torture testsuite will skip testing identical
29 # executables multiple times.
30 # Also note that -finline-functions is explicitly included in one of the
31 # items below, even though -O3 is also specified, because some ports may
32 # choose to disable inlining functions by default, even when optimizing.
33 set TORTURE_OPTIONS [list \
34 { -O0 } \
35 { -O1 } \
36 { -O2 } \
37 { -O3 -fomit-frame-pointer } \
38 { -O3 -fomit-frame-pointer -funroll-loops } \
39 { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
40 { -O3 -g } \
41 { -Os } ]
45 # Split TORTURE_OPTIONS into two choices: one for testcases with loops and
46 # one for testcases without loops.
48 set torture_with_loops $TORTURE_OPTIONS
49 set torture_without_loops ""
50 foreach option $TORTURE_OPTIONS {
51 if ![string match "*loop*" $option] {
52 lappend torture_without_loops $option
56 # Define gcc callbacks for dg.exp.
58 proc objc-dg-test { prog do_what extra_tool_flags } {
59 # Set up the compiler flags, based on what we're going to do.
61 switch $do_what {
62 "preprocess" {
63 set compile_type "preprocess"
64 set output_file "[file rootname [file tail $prog]].i"
66 "compile" {
67 set compile_type "assembly"
68 set output_file "[file rootname [file tail $prog]].s"
70 "assemble" {
71 set compile_type "object"
72 set output_file "[file rootname [file tail $prog]].o"
74 "link" {
75 set compile_type "executable"
76 set output_file "[file rootname [file tail $prog]].exe"
77 # The following line is needed for targets like the i960 where
78 # the default output file is b.out. Sigh.
80 "run" {
81 set compile_type "executable"
82 # FIXME: "./" is to cope with "." not being in $PATH.
83 # Should this be handled elsewhere?
84 # YES.
85 set output_file "./[file rootname [file tail $prog]].exe"
86 # This is the only place where we care if an executable was
87 # created or not. If it was, dg.exp will try to run it.
88 remote_file build delete $output_file;
90 default {
91 perror "$do_what: not a valid dg-do keyword"
92 return ""
95 set options ""
96 if { $extra_tool_flags != "" } {
97 lappend options "additional_flags=$extra_tool_flags"
100 set comp_output [objc_target_compile "$prog" "$output_file" "$compile_type" $options];
102 return [list $comp_output $output_file]
105 proc objc-dg-prune { system text } {
106 set text [prune_gcc_output $text]
108 # If we see "region xxx is full" then the testcase is too big for ram.
109 # This is tricky to deal with in a large testsuite like c-torture so
110 # deal with it here. Just mark the testcase as unsupported.
111 if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] {
112 # The format here is important. See dg.exp.
113 return "::unsupported::memory full"
116 return $text
119 # Utility routines.
122 # search_for -- looks for a string match in a file
124 proc search_for { file pattern } {
125 set fd [open $file r]
126 while { [gets $fd cur_line]>=0 } {
127 if [string match "*$pattern*" $cur_line] then {
128 close $fd
129 return 1
132 close $fd
133 return 0
136 # Modified dg-runtest that can cycle through a list of optimization options
137 # as c-torture does.
138 proc objc-dg-runtest { testcases default-extra-flags } {
139 global runtests
141 foreach test $testcases {
142 # If we're only testing specific files and this isn't one of
143 # them, skip it.
144 if ![runtest_file_p $runtests $test] {
145 continue
148 # Look for a loop within the source code - if we don't find one,
149 # don't pass -funroll[-all]-loops.
150 global torture_with_loops torture_without_loops
151 if [expr [search_for $test "for*("]+[search_for $test "while*("]] {
152 set option_list $torture_with_loops
153 } else {
154 set option_list $torture_without_loops
157 set nshort [file tail [file dirname $test]]/[file tail $test]
159 foreach flags $option_list {
160 verbose "Testing $nshort, $flags" 1
161 dg-test $test $flags ${default-extra-flags}