1 # Copyright
(C
) 1988-2018 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.
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 # This file was written by Mike Stump
<mrs@cygnus.com
>
19 load_lib target
-utils.exp
22 # mike_cleanup
-- remove
any files that are created by the testcase
24 proc mike_cleanup
{ src_code output_file assembly_file
} {
25 remote_file build
delete $output_file $assembly_file
29 # prebase
-- sets up a Mike Stump
(mrs@cygnus.com
) style G
++ test
32 global compiler_output
33 global not_compiler_output
34 global compiler_result
35 global not_compiler_result
42 set compiler_output
"^$"
43 set not_compiler_output
".*Internal compiler error.*"
44 set compiler_result
""
45 set not_compiler_result
""
46 set program_output
".*PASS.*"
50 set target_regexp
".*"
56 proc postbase
{ src_code run groups
args } {
60 global not_compiler_output
61 global compiler_output
62 global compiler_result
63 global not_compiler_result
74 if ![regexp $target_regexp $target_triplet
] {
75 unsupported $subdir
/$src_code
79 if { [llength $
args] > 0 } {
80 set comp_options
[lindex $
args 0]
85 set fail_message $subdir
/$src_code
86 set pass_message $subdir
/$src_code
88 if [info exists GROUP
] {
89 if {[lsearch $groups $GROUP
] == -1} {
94 if [string match $run yes
] {
98 set output_file
"$tmpdir/[file tail [file rootname $src_code]]"
99 set assembly_file
"$output_file"
100 append assembly_file
".S"
102 set compile_type
"none"
107 set compile_type
"assembly"
108 set output_file $assembly_file
112 set compile_type
"object"
113 append output_file
".o"
117 set compile_type
"executable"
118 append output_file
".exe"
122 set compile_type
"executable"
123 append output_file
".exe"
129 set compile_type
"none"
133 set src_file
"$srcdir/$subdir/$src_code"
136 if { $comp_options
!= "" } {
137 lappend options
"additional_flags=$comp_options"
140 if ![ishost
"*-dos-*"] {
141 lappend options
"libs=-lstdc++ -lg++"
143 lappend options
"libs=-lstdcxx -lgxx"
146 set comp_output
[g
++_target_compile $src_file $output_file $compile_type $options
]
150 #
Delete things like
"ld.so warning" messages.
151 set comp_output
[prune_warnings $comp_output
]
153 if [regexp
-- $not_compiler_output $comp_output
] {
154 if { $verbose
> 1 } {
155 send_user
"\nChecking:\n$not_compiler_output\nto make sure it does not match:\n$comp_output\nbut it does.\n\n"
157 send_log
"\nCompiler output:\n$comp_output\n\n"
160 # The framework doesn
't like to see any error remnants,
163 if [info exists errorInfo] {
167 mike_cleanup $src_code $output_file $assembly_file
171 # remove any leftover CRs.
172 regsub -all -- "\r" $comp_output "" comp_output
174 regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
175 regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
177 set unsupported_message [${tool}_check_unsupported_p $comp_output]
178 if { $unsupported_message != "" } {
179 unsupported "$subdir/$src_code: $unsupported_message"
180 mike_cleanup $src_code $output_file $assembly_file
184 if { $verbose > 1 } {
185 send_user "\nChecking:\n$compiler_output\nto see if it matches:\n$comp_output\n"
187 send_log "\nCompiler output:\n$comp_output\n\n"
189 if [regexp -- $compiler_output $comp_output] {
190 if { $verbose > 1 } {
191 send_user "Yes, it matches.\n\n"
194 if [file exists [file rootname [file tail $src_code]].s] {
195 set fd [open [file rootname [file tail $src_code]].s r]
198 if { $compiler_result != "" } {
199 verbose "Checking .s file for $compiler_result" 2
200 if [regexp -- $compiler_result $dot_s] {
201 verbose "Yes, it matches." 2
203 verbose "Nope, doesn't match.
" 2
208 if { $not_compiler_result
!= "" } {
209 verbose
"Checking .s file for not $not_compiler_result" 2
210 if ![regexp
-- $not_compiler_result $dot_s
] {
211 verbose
"Nope, not found (that's good)." 2
213 verbose
"Uh oh, it was found." 2
219 if [string match $run yes
] {
220 set result
[g
++_load $output_file
]
221 set status [lindex $result
0]
222 set output
[lindex $result
1]
224 if { $
status == -1 } {
225 mike_cleanup $src_code $output_file $assembly_file
228 if { $verbose
> 1 } {
229 send_user
"Checking:\n$program_output\nto see if it matches:\n$output\n\n"
231 if ![regexp
-- $program_output $output
] {
233 if { $verbose
> 1 } {
234 send_user
"Nope, does not match.\n\n"
237 if { $verbose
> 1 } {
238 send_user
"Yes, it matches.\n\n"
243 if { $verbose
> 1 } {
244 send_user
"Nope, does not match.\n\n"
248 if [string match $pass
"yes"] {
254 # The framework doesn
't like to see any error remnants,
257 if [info exists errorInfo] {
262 mike_cleanup $src_code $output_file $assembly_file