1 # Copyright
(C
) 1988, 90, 91, 92, 95, 96, 1997 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.
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
, 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA.
17 # This file was derived from mike
-g
++.exp written by Mike Stump
<mrs@cygnus.com
>
20 # mike_cleanup
-- remove
any files that are created by the testcase
22 proc mike_cleanup
{ src_code output_file assembly_file
} {
23 remote_file build
delete $output_file $assembly_file
27 # prebase
-- sets up a Mike Stump
(mrs@cygnus.com
) style gcc test
30 global compiler_output
31 global not_compiler_output
32 global compiler_result
33 global not_compiler_result
40 set compiler_output
"^$"
41 set not_compiler_output
".*Internal compiler error.*"
42 set compiler_result
""
43 set not_compiler_result
""
44 set program_output
".*PASS.*"
48 set target_regexp
".*"
54 proc postbase
{ src_code run groups
args } {
58 global not_compiler_output
59 global compiler_output
60 global compiler_result
61 global not_compiler_result
72 if ![info exists GCC_UNDER_TEST
] {
73 error
"No compiler specified for testing."
76 if ![regexp $target_regexp $target_triplet
] {
77 unsupported $subdir
/$src_code
81 if { [llength $
args] > 0 } {
82 set comp_options
[lindex $
args 0]
87 set fail_message $subdir
/$src_code
88 set pass_message $subdir
/$src_code
90 if [info exists GROUP
] {
91 if {[lsearch $groups $GROUP
] == -1} {
96 if [string match $run yes
] {
100 set output_file
"$tmpdir/[file tail [file rootname $src_code]]"
101 set assembly_file
"$output_file"
102 append assembly_file
".S"
104 set compile_type
"none"
109 set compile_type
"assembly"
110 set output_file $assembly_file
114 set compile_type
"object"
115 append output_file
".o"
119 set compile_type
"executable"
120 append output_file
".exe"
124 set compile_type
"executable"
125 append output_file
".exe"
131 set compile_type
"none"
135 set src_file
"$srcdir/$subdir/$src_code"
137 lappend options
"compiler=$GCC_UNDER_TEST"
139 if { $comp_options
!= "" } {
140 lappend options
"additional_flags=$comp_options"
143 set comp_output
[gcc_target_compile $src_file $output_file $compile_type $options
]
147 #
Delete things like
"ld.so warning" messages.
148 set comp_output
[prune_warnings $comp_output
]
150 if [regexp
-- $not_compiler_output $comp_output
] {
151 if { $verbose
> 1 } {
152 send_user
"\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"
154 send_log
"\nCompiler output:\n$comp_output\n\n"
157 # The framework doesn
't like to see any error remnants,
160 if [info exists errorInfo] {
164 mike_cleanup $src_code $output_file $assembly_file
168 # remove any leftover CRs.
169 regsub -all -- "\r" $comp_output "" comp_output
171 regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
172 regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
174 set unsupported_message [${tool}_check_unsupported_p $comp_output]
175 if { $unsupported_message != "" } {
176 unsupported "$subdir/$src_code: $unsupported_message"
177 mike_cleanup $src_code $output_file $assembly_file
181 if { $verbose > 1 } {
182 send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"
184 send_log "\nCompiler output:\n$comp_output\n\n"
186 if [regexp -- $compiler_output $comp_output] {
187 if { $verbose > 1 } {
188 send_user "Yes, it matches.\n\n"
191 if [file exists [file rootname [file tail $src_code]].s] {
192 set fd [open [file rootname [file tail $src_code]].s r]
195 if { $compiler_result != "" } {
196 verbose "Checking .s file for $compiler_result" 2
197 if [regexp -- $compiler_result $dot_s] {
198 verbose "Yes, it matches." 2
200 verbose "Nope, doesn't match.
" 2
205 if { $not_compiler_result
!= "" } {
206 verbose
"Checking .s file for not $not_compiler_result" 2
207 if ![regexp
-- $not_compiler_result $dot_s
] {
208 verbose
"Nope, not found (that's good)." 2
210 verbose
"Uh oh, it was found." 2
216 if [string match $run yes
] {
217 set result
[gcc_load $output_file
]
218 set status [lindex $result
0]
219 set output
[lindex $result
1]
220 if { $
status == -1 } {
221 mike_cleanup $src_code $output_file $assembly_file
224 if { $verbose
> 1 } {
225 send_user
"Checking:\n$program_output\nto see if it matches:\n$output\n\n"
227 if ![regexp
-- $program_output $output
] {
229 if { $verbose
> 1 } {
230 send_user
"Nope, does not match.\n\n"
233 if { $verbose
> 1 } {
234 send_user
"Yes, it matches.\n\n"
239 if { $verbose
> 1 } {
240 send_user
"Nope, does not match.\n\n"
244 if [string match $pass
"yes"] {
250 # The framework doesn
't like to see any error remnants,
253 if [info exists errorInfo] {
258 mike_cleanup $src_code $output_file $assembly_file