1 # Copyright
(C
) 2009, 2010 Free Software Foundation
, Inc.
2 # Written by Ian Lance Taylor
<iant@google.com
>.
4 # This
program is free software
; you can redistribute it and
/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation
; either version
3 of the License
, or
7 #
(at your option
) any later version.
9 # This
program is distributed in the hope that it will be useful
,
10 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License
for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC
; see the file COPYING3.
If not see
16 #
<http
://www.gnu.org
/licenses
/>.
19 # Test using the testsuite
for the gc Go compiler. In these tests the
20 # first line is a
shell script to run. That line expects the
21 # following environment variables to be
set:
22 # A The file extension of the object file and the
name of the executable
23 # G The
name of the compiler
24 # L The
name of the linker
25 # F The basename of the test
26 # D The directory of the test.
28 # Typical command lines
:
29 #
// $G $D
/$F.go
&& $L $F.$A
&& .
/$A.out
30 #
// $G $D
/$F.go
&& $L $F.$A || echo BUG
: known to fail incorrectly
31 #
// $G $D
/$F.go
&& echo BUG
: compilation succeeds incorrectly
32 #
// $G $D
/$F.go || echo BUG
: compilation should succeed
35 load_lib go
-torture.exp
38 proc errchk
{ test
} {
39 global dg
-do-what
-default
40 global DEFAULT_GOCFLAGS
43 set saved
-dg
-do-what
-default $
{dg
-do-what
-default
}
44 set dg
-do-what
-default
compile
45 set filename
[file tail $test
]
46 if { "$filename" == "$test" } {
47 set filename
"errchk-$filename"
49 set fdin
[open $test r
]
50 fconfigure $fdin
-encoding binary
51 set fdout
[open $filename w
]
52 fconfigure $fdout
-encoding binary
53 while { [gets $fdin copy_line
] >= 0 } {
54 regsub
"// \(GCCGO_\)?ERROR \"\(\[^\"\]*\)\".*$" $copy_line "// \{ dg-error \"\\2\" \}" out_line
55 if [string match
"*dg-error*.\**" $out_line] {
56 # I worked out the right number of backslashes by
57 # experimentation
, not analysis.
58 regsub
-all
"\\.\\*" $out_line "\\\\\[ -~\\\\\]*" out_line
60 if [string match
"*dg-error*\{*" $out_line] {
61 set index
[string first
"dg-error" $out_line]
62 regsub
-start $index
-all
"\{" $out_line "\\\\\[\\\{\\\\\]" out_line
64 if [string match
"*dg-error*\}*\}" $out_line] {
65 set index
[string first
"dg-error" $out_line]
66 regsub
-start $index
-all
"\}\(.\)" $out_line "\\\\\[\\\}\\\\\]\\1" out_line
68 if [string match
"*dg-error*\[.\]*" $out_line] {
69 set index
[string first
"dg-error" $out_line]
70 regsub
-all
"\\\[\\.\\\]" $out_line "\\\\\[.\\\\\]" out_line
77 set hold_runtests $runtests
78 set runtests
"go-test.exp"
79 go
-dg
-runtest $filename
"-fno-show-column $DEFAULT_GOCFLAGS"
80 set runtests $hold_runtests
83 set dg
-do-what
-default $
{saved
-dg
-do-what
-default
}
86 # This is an execution test which should fail.
87 proc go
-execute-xfail
{ test
} {
88 global DEFAULT_GOCFLAGS
91 set filename
[file tail $test
]
92 set fdin
[open $test r
]
93 set fdout
[open $filename w
]
94 puts $fdout
"// { dg-do run { xfail *-*-* } }"
95 while { [gets $fdin copy_line
] >= 0 } {
96 puts $fdout $copy_line
101 set hold_runtests $runtests
102 set runtests
"go-test.exp"
103 go
-dg
-runtest $filename
"-w $DEFAULT_GOCFLAGS"
104 set runtests $hold_runtests
106 file
delete $filename
109 proc go
-gc
-tests
{ } {
112 global GCC_UNDER_TEST
114 global TORTURE_OPTIONS
115 global dg
-do-what
-default
116 global go_execute_args
117 global target_triplet
119 #
If a testcase doesn
't have special options, use these.
120 global DEFAULT_GOCFLAGS
121 if ![info exists DEFAULT_GOCFLAGS] {
122 set DEFAULT_GOCFLAGS " -pedantic-errors"
125 # Running all the torture options takes too long and, since the
126 # frontend ignores the standard options, it doesn't significantly
128 set saved_torture_options $TORTURE_OPTIONS
129 set TORTURE_OPTIONS
[ list
{ -O2
-g
}]
131 set saved
-dg
-do-what
-default $
{dg
-do-what
-default
}
135 set tests
[lsort
[find $srcdir
/$subdir
*.go
]]
136 foreach test $tests
{
137 if ![runtest_file_p $runtests $test
] {
141 # Skip the files in bench and garbage
; they are not tests.
142 if [string match
"*go.test/test/bench/*" $test] {
145 if [string match
"*go.test/test/garbage/*" $test] {
149 # Skip files in sub
-subdirectories
: they are components of
151 if [string match
"*go.test/test/*/*/*" $test] {
155 set name [dg
-trim
-dirname $srcdir $test
]
157 # Skip certain tests
if target is RTEMS OS.
158 if [istarget
"*-*-rtems*"] {
159 if { [string match
"*go.test/test/args.go" \
161 ||
[string match
"*go.test/test/env.go" \
163 untested
"$name: uses the command-line or environment variables"
167 if { [string match
"*go.test/test/stack.go" \
169 ||
[string match
"*go.test/test/peano.go" \
171 ||
[string match
"*go.test/test/chan/goroutines.go" \
173 untested
"$name: has very high memory requirement"
178 set fd
[open $test r
]
183 if { [gets $fd test_line
] < 0 } {
185 clone_output
"$test: could not read first line"
191 if { [ string match
"*nacl*exit 0*" $test_line ] \
192 ||
[ string match
"*exit 0*nacl*" $test_line ] \
193 ||
[ string match
"*Android*exit 0*" $test_line ] \
194 ||
[ string match
"*exit 0*Android*" $test_line ] } {
201 if { $lines_ok
== 0 } {
206 set test_line1 $test_line
208 while { [eval
"string match \"//*&&\" \${test_line$lineno}"] } {
209 set lineno
[expr $lineno
+ 1]
210 if { [eval
"gets \$fd test_line$lineno"] < 0 } {
212 clone_output
"$test: could not read line $lineno"
218 if { $lines_ok
== 0 } {
224 set go_execute_args
""
225 if { [regexp
".*\\\$A.out (\[^|&>\].*)\$" $test_line match progargs] } {
226 set go_execute_args $progargs
227 verbose
-log "$test: go_execute_args is $go_execute_args"
228 set index
[string last
" $progargs" $test_line]
229 set test_line
[string replace $test_line $index end
]
232 if { $test_line
== "// \$G \$D/\$F\.go && \$L \$F\.\$A && \./\$A\.out >tmp.go &&" \
233 && $test_line2
== "// \$G tmp\.go && \$L tmp\.\$A && \./\$A\.out || echo BUG: 64bit" } {
234 #
64bit.go is a special case.
235 set go_execute_args
""
236 set hold_runtests $runtests
237 set runtests
"go-test.exp"
238 set dg
-do-what
-default
"link"
239 dg
-test
-keep
-output $test
"-O" "-w $DEFAULT_GOCFLAGS"
240 set output_file
"./[file rootname [file tail $test]].exe"
241 set base
"[file rootname [file tail $test]]"
243 if { [catch
"exec $output_file >$base-out.go"] != 0 } {
244 fail
"$name execution"
246 pass
"$name execution"
247 file
delete $base
-out.x
248 go
-torture
-execute "./$base-out.go"
250 file
delete $base
-out.go
252 file
delete $output_file
253 set runtests $hold_runtests
254 } elseif
{ $test_line
== "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" \
255 || $test_line
== "// \$G \$F.go && \$L \$F.\$A && ./\$A.out" \
256 || $test_line
== "// \$G \$F.go && \$L \$F.\$A &&./\$A.out" \
257 || $test_line
== "// \$G \$D/\$F.go && \$L \$F.\$A && \$A.out" \
259 "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out || echo BUG*" \
262 "// \$G \$F.go && \$L \$F.\$A && (./\$A.out || echo BUG*" \
265 "// \$G \$D/\$F.go && \$L \$F.\$A && (./\$A.out || echo BUG*" \
268 "// \$G \$F.go && \$L \$F.\$A && GOMAXPROCS=* ./\$A.out" \
271 "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >* || echo BUG*" \
273 # This is a vanilla execution test.
274 go
-torture
-execute $test
275 file
delete core
[glob
-nocomplain core.
*]
276 } elseif
{ [string match \
277 "// \$G \$D/\$F.go && \$L \$F.\$A || echo BUG*" \
279 ||
[string match
"// \$G \$F.go && \$L \$F.\$A #*" \
281 # This is a vanilla
compile and link test.
282 set dg
-do-what
-default
"link"
283 go
-dg
-runtest $test
"-w $DEFAULT_GOCFLAGS"
284 } elseif
{ [string match
"// \$G \$D/\$F.go" $test_line] \
285 ||
[string match
"// \$G \$D/\$F.go || echo BUG*" \
287 ||
[string match
"// \$G \$F.go || echo BUG*" \
289 ||
[string match
"// ! \$G \$D/\$F.go && echo BUG*" \
291 # This is a vanilla
compile test.
292 set dg
-do-what
-default
"assemble"
293 go
-dg
-runtest $test
"-w $DEFAULT_GOCFLAGS"
294 } elseif
{ [string match
"// \$G \$D/\$F.go && echo BUG*" \
296 || $test_line
== "// ! \$G \$D/\$F.go >/dev/null" \
297 || $test_line
== "// ! \$G \$D/\$F.go" \
298 || $test_line
== "// ! \$G \$F.go" \
299 ||
[string match
"// ! \$G \$D/\$F.go || echo BUG*" \
301 # This is a
compile test which should fail.
302 set dg
-do-what
-default
"assemble"
304 go
-dg
-runtest $test
"-w $DEFAULT_GOCFLAGS"
305 } elseif
{ [string match
"// \$G \$D/\$F.go && \$L \$F.\$A && ! ./\$A.out" \
307 ||
[string match
"// \$G \$D/\$F.go && \$L \$F.\$A && ! ./\$A.out || echo BUG: *" \
309 ||
[string match
"// \$G \$D/\$F.go && \$L \$F.\$A && (! ./\$A.out || echo BUG: *" \
311 ||
($test_line
== "// \$G \$D/\$F.go && \$L \$F.\$A &&"
312 && $test_line2
== "// ((! sh -c ./\$A.out) >/dev/null 2>&1 || echo BUG: should fail)") } {
313 go
-execute-xfail $test
314 } elseif
{ [string match
"// errchk \$G \$F.go" $test_line] \
315 ||
[string match
"// errchk \$G -e \$F.go" $test_line] \
316 ||
[string match
"// errchk \$G \$D/\$F.go" $test_line] \
317 ||
[string match
"//errchk \$G \$D/\$F.go" $test_line] \
318 ||
[string match
"// errchk \$G -e \$D/\$F.go" \
320 ||
[string match
"// ! errchk \$G \$D/\$F.go" $test_line] \
321 ||
[string match
"// ! errchk \$G -e \$D/\$F.go" \
323 ||
[string match
"// errchk \$G \$F.go || true" \
325 ||
[string match
"// errchk \$G \$D/\$F.go || true" \
327 ||
[string match
"// errchk \$G -e \$D/\$F.go || true" \
329 ||
[string match
"// errchk \$G \$D/\$F.go || echo BUG*" \
332 } elseif
{ [string match \
333 "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go || echo BUG*" \
335 set hold_runtests $runtests
336 set runtests
"go-test.exp"
337 set dg
-do-what
-default
"assemble"
338 regsub
"\\.go$" $test ".dir/bug0.go" file1
339 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
340 regsub
"\\.go$" $test ".dir/bug1.go" file2
341 dg
-test $file2
"-O" "-w $DEFAULT_GOCFLAGS"
342 file
delete "[file rootname [file tail $file1]].o"
343 set runtests $hold_runtests
344 } elseif
{ [string match \
345 "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \
348 "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
351 "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
359 set hold_runtests $runtests
360 set runtests
"go-test.exp"
361 set dg
-do-what
-default
"assemble"
362 regsub
"\\.go$" $test ".dir/$name1" file1
363 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
364 regsub
"\\.go$" $test ".dir/$name2" file2
366 file
delete "[file rootname [file tail $file1]].o"
367 set runtests $hold_runtests
368 } elseif
{ [string match \
369 "// \$G \$D/\$F.dir/bug0.go && (! \$G \$D/\$F.dir/bug1.go || echo BUG*" \
371 set hold_runtests $runtests
372 set runtests
"go-test.exp"
373 set dg
-do-what
-default
"assemble"
374 regsub
"\\.go$" $test ".dir/bug0.go" file1
375 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
376 regsub
"\\.go$" $test ".dir/bug1.go" file2
378 dg
-test $file2
"-O" "-w $DEFAULT_GOCFLAGS"
379 file
delete "[file rootname [file tail $file1]].o"
380 set runtests $hold_runtests
381 } elseif
{ [string match \
382 "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go && (! \$G \$D/\$F.dir/bug2.go || echo BUG*" \
384 set hold_runtests $runtests
385 set runtests
"go-test.exp"
386 set dg
-do-what
-default
"assemble"
387 regsub
"\\.go$" $test ".dir/bug0.go" file1
388 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
389 regsub
"\\.go$" $test ".dir/bug1.go" file2
390 dg
-test
-keep
-output $file2
"-O" "-w $DEFAULT_GOCFLAGS"
391 regsub
"\\.go$" $test ".dir/bug2.go" file3
393 dg
-test $file3
"-O" "-w $DEFAULT_GOCFLAGS"
394 file
delete "[file rootname [file tail $file1]].o"
395 file
delete "[file rootname [file tail $file2]].o"
396 set runtests $hold_runtests
397 } elseif
{ [string match \
398 "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go && errchk \$G \$D/\$F.dir/bug2.go" \
400 set hold_runtests $runtests
401 set runtests
"go-test.exp"
402 set dg
-do-what
-default
"assemble"
403 regsub
"\\.go$" $test ".dir/bug0.go" file1
404 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
405 regsub
"\\.go$" $test ".dir/bug1.go" file2
406 dg
-test
-keep
-output $file2
"-O" "-w $DEFAULT_GOCFLAGS"
407 regsub
"\\.go$" $test ".dir/bug2.go" file3
409 file
delete "[file rootname [file tail $file1]].o"
410 file
delete "[file rootname [file tail $file2]].o"
411 set runtests $hold_runtests
412 } elseif
{ [string match \
413 "// \$G \$D/bug160.dir/x.go && \$G \$D/bug160.dir/y.go && \$L y.\$A && ./\$A.out" \
415 set hold_runtests $runtests
416 set runtests
"go-test.exp"
417 set dg
-do-what
-default
"assemble"
418 regsub
"\\.go$" $test ".dir/x.go" file1
419 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
420 set ofile1
"[file rootname [file tail $file1]].o"
421 regsub
"\\.go$" $test ".dir/y.go" file2
422 dg
-test
-keep
-output $file2
"-O" "-w $DEFAULT_GOCFLAGS"
423 set ofile2
"[file rootname [file tail $file2]].o"
424 set dg
-do-what
-default
"link"
425 set output_file
"./[file rootname [file tail $test]].exe"
426 set comp_output
[go_target_compile
"$ofile1 $ofile2" \
427 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
428 set comp_output
[go
-dg
-prune $target_triplet $comp_output
]
429 verbose
-log $comp_output
430 set result
[go_load
"$output_file" "" ""]
431 set status [lindex $result
0]
433 file
delete $ofile1 $ofile2 $output_file
434 set runtests $hold_runtests
435 } elseif
{ [string match \
436 "// \$G \$D/bug191.dir/a.go && \$G \$D/bug191.dir/b.go && \$G \$D/\$F.go && \$L \$F.\$A" \
438 set hold_runtests $runtests
439 set runtests
"go-test.exp"
440 set dg
-do-what
-default
"assemble"
441 regsub
"\\.go$" $test ".dir/a.go" file1
442 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
443 set ofile1
"[file rootname [file tail $file1]].o"
444 regsub
"\\.go$" $test ".dir/b.go" file2
445 dg
-test
-keep
-output $file2
"-O" "-w $DEFAULT_GOCFLAGS"
446 set ofile2
"[file rootname [file tail $file2]].o"
447 dg
-test
-keep
-output
"$test" "-O" "-w $DEFAULT_GOCFLAGS"
448 set ofile3
"[file rootname [file tail $test]].o"
449 set dg
-do-what
-default
"link"
450 set output_file
"./[file rootname [file tail $test]].exe"
451 set comp_output
[go_target_compile
"$ofile1 $ofile2 $ofile3" \
452 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
453 set comp_output
[go
-dg
-prune $target_triplet $comp_output
]
454 if [string match
"" $comp_output] {
457 verbose
-log $comp_output
460 file
delete $ofile1 $ofile2 $ofile3 $output_file
461 set runtests $hold_runtests
462 } elseif
{ [string match \
463 "// \$G \$D/embed0.go && \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" \
465 set hold_runtests $runtests
466 set runtests
"go-test.exp"
467 set dg
-do-what
-default
"assemble"
468 regsub
"/\[^/\]*$" $test "/embed0.go" file1
469 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
470 set ofile1
"[file rootname [file tail $file1]].o"
471 dg
-test
-keep
-output $test
"-O" "-w $DEFAULT_GOCFLAGS"
472 set ofile2
"[file rootname [file tail $test]].o"
473 set output_file
"./[file rootname [file tail $test]].exe"
474 set comp_output
[go_target_compile
"$ofile1 $ofile2" \
475 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
476 set comp_output
[go
-dg
-prune $target_triplet $comp_output
]
477 if [string match
"" $comp_output] {
478 set result
[go_load
"$output_file" "" ""]
479 set status [lindex $result
0]
482 verbose
-log $comp_output
485 file
delete $ofile1 $ofile2 $output_file
486 set runtests $hold_runtests
487 } elseif
{ [string match \
488 "// \$G \$D/\$F.dir/chanbug.go && \$G -I. \$D/\$F.dir/chanbug2.go" \
490 set hold_runtests $runtests
491 set runtests
"go-test.exp"
492 set dg
-do-what
-default
"assemble"
493 regsub
"\\.go$" $test ".dir/chanbug.go" file1
494 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
495 regsub
"\\.go$" $test ".dir/chanbug2.go" file2
496 dg
-test $file2
"-O" "-w $DEFAULT_GOCFLAGS"
497 file
delete "[file rootname [file tail $file1]].o"
498 set runtests $hold_runtests
499 } elseif
{ [string match \
500 "// (! \$G \$D/\$F.go) | grep 'initialization loop' *" \
502 set dg
-do-what
-default
"assemble"
504 go
-dg
-runtest $test
"-w $DEFAULT_GOCFLAGS"
505 } elseif
{ [string match \
506 "// \$G \$D/\$F.dir/x.go && errchk \$G \$D/\$F.dir/y.go" \
508 set hold_runtests $runtests
509 set runtests
"go-test.exp"
510 set dg
-do-what
-default
"assemble"
511 regsub
"\\.go$" $test ".dir/x.go" file1
512 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
513 regsub
"\\.go$" $test ".dir/y.go" file2
515 file
delete "[file rootname [file tail $file1]].o"
516 set runtests $hold_runtests
517 } elseif
{ [string match
"// true*" $test_line] } {
518 # Not a real test
, just ignore.
519 } elseif
{ $test_line
== "// \$G \$D/\$F.dir/bug0.go &&" \
520 && $test_line2
== "// \$G \$D/\$F.dir/bug1.go &&" \
521 && $test_line3
== "// \$G \$D/\$F.dir/bug2.go &&" \
522 && $test_line4
== "// errchk \$G -e \$D/\$F.dir/bug3.go &&" \
523 && $test_line5
== "// \$L bug2.\$A &&" \
524 && [string match
"// ./\$A.out || echo BUG*" $test_line6] } {
525 set hold_runtests $runtests
526 set runtests
"go-test.exp"
527 set dg
-do-what
-default
"assemble"
528 regsub
"\\.go$" $test ".dir/bug0.go" file0
529 dg
-test
-keep
-output $file0
"-O -fgo-prefix=bug0" "-w $DEFAULT_GOCFLAGS"
530 set ofile0
"[file rootname [file tail $file0]].o"
531 regsub
"\\.go$" $test ".dir/bug1.go" file1
532 dg
-test
-keep
-output $file1
"-O -fgo-prefix=bug1" "-w $DEFAULT_GOCFLAGS"
533 set ofile1
"[file rootname [file tail $file1]].o"
534 regsub
"\\.go$" $test ".dir/bug2.go" file2
535 dg
-test
-keep
-output $file2
"-O" "-w $DEFAULT_GOCFLAGS"
536 set ofile2
"[file rootname [file tail $file2]].o"
537 regsub
"\\.go$" $test ".dir/bug3.go" file3
539 set output_file
"./[file rootname [file tail $test]].exe"
540 set comp_output
[go_target_compile
"$ofile0 $ofile1 $ofile2" \
541 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
542 set comp
-output
[go
-dg
-prune $target_triplet $comp_output
]
543 if [string match
"" $comp_output] {
544 set result
[go_load
"$output_file" "" ""]
545 set status [lindex $result
0]
548 verbose
-log $comp_output
551 file
delete $ofile0 $ofile1 $ofile2 $output_file
552 set runtests $hold_runtests
553 } elseif
{ $test_line
== "// \$G \$D/import2.go && \$G \$D/\$F\.go" } {
554 set hold_runtests $runtests
555 set runtests
"go-test.exp"
556 set dg
-do-what
-default
"assemble"
557 regsub
"/\[^/\]*$" $test "/import2.go" file1
558 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
559 set ofile1
"[file rootname [file tail $file1]].o"
560 dg
-test $test
"-O" "-w $DEFAULT_GOCFLAGS"
562 set runtests $hold_runtests
563 } elseif
{ $test_line
== "// \$G \$D/ddd2.go && \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" } {
564 set hold_runtests $runtests
565 set runtests
"go-test.exp"
566 set dg
-do-what
-default
"assemble"
567 regsub
"/\[^/\]*$" $test "/ddd2.go" file1
568 dg
-test
-keep
-output $file1
"-O" "-w $DEFAULT_GOCFLAGS"
569 set ofile1
"[file rootname [file tail $file1]].o"
570 dg
-test
-keep
-output $test
"-O" "-w $DEFAULT_GOCFLAGS"
571 set ofile2
"[file rootname [file tail $test]].o"
572 set output_file
"./[file rootname [file tail $test]].exe"
573 set comp_output
[go_target_compile
"$ofile1 $ofile2" \
574 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
575 set comp_output
[go
-dg
-prune $target_triplet $comp_output
]
576 if [string match
"" $comp_output] {
577 set result
[go_load
"$output_file" "" ""]
578 set status [lindex $result
0]
581 verbose
-log $comp_output
584 file
delete $ofile1 $ofile2 $output_file
585 set runtests $hold_runtests
586 } elseif
{ $test_line
== "// \$G \$D/\$F.go \$D/cmplxdivide1.go && \$L \$D/\$F.\$A && ./\$A.out" } {
587 regsub
"/\[^/\]*$" $test "/cmplxdivide1.go" test2
588 set output_file
"./[file rootname [file tail $test]].o"
589 set comp_output
[go_target_compile
"$test $test2" \
590 $output_file
"executable" "$DEFAULT_GOCFLAGS"]
591 set comp_output
[go
-dg
-prune $target_triplet $comp_output
]
592 if [string match
"" $comp_output] {
593 set result
[go_load
"$output_file" "" ""]
594 set status [lindex $result
0]
597 verbose
-log $comp_output
600 file
delete $output_file
601 } elseif
{ $test_line
== "// \$G \$D/\$F.go && \$L \$F.\$A &&" \
602 && $test_line2
== "// ./\$A.out -pass 0 >tmp.go && \$G tmp.go && \$L -o tmp1.\$A tmp.\$A && ./tmp1.\$A &&" \
603 && $test_line3
== "// ./\$A.out -pass 1 >tmp.go && errchk \$G -e tmp.go &&" \
604 && $test_line4
== "// ./\$A.out -pass 2 >tmp.go && errchk \$G -e tmp.go" } {
605 set go_execute_args
""
606 set hold_runtests $runtests
607 set runtests
"go-test.exp"
608 set dg
-do-what
-default
"link"
609 dg
-test
-keep
-output $test
"-O" "-w $DEFAULT_GOCFLAGS"
610 set output_file
"./[file rootname [file tail $test]].exe"
612 if { [catch
"exec $output_file -pass 0 >tmp.go"] != 0 } {
613 fail
"$name execution 0"
615 pass
"$name execution 0"
617 go
-torture
-execute "./tmp.go"
619 if { [catch
"exec $output_file -pass 1 >tmp.go"] != 0 } {
620 fail
"$name execution 1"
622 pass
"$name execution 1"
625 if { [catch
"exec $output_file -pass 2 >tmp.go"] != 0 } {
626 fail
"$name execution 2"
628 pass
"$name execution 2"
633 file
delete $output_file
634 set runtests $hold_runtests
635 } elseif
{ $test_line
== "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >tmp.go &&" \
636 && $test_line2
== "// errchk \$G -e tmp.go" } {
637 set go_execute_args
""
638 set hold_runtests $runtests
639 set runtests
"go-test.exp"
640 set dg
-do-what
-default
"link"
641 dg
-test
-keep
-output $test
"-O" "-w $DEFAULT_GOCFLAGS"
642 set output_file
"./[file rootname [file tail $test]].exe"
644 if { [catch
"exec $output_file >tmp.go"] != 0 } {
645 fail
"$name execution"
647 pass
"$name execution"
652 file
delete $output_file
653 set runtests $hold_runtests
654 } elseif
{ $test_line
== "// # generated by cmplxdivide.c" } {
656 } elseif
{ $test_line
== "// \$G \$D/bug302.dir/p.go && gopack grc pp.a p.\$A && \$G \$D/bug302.dir/main.go" \
657 || $test_line
== "// \$G \$D/empty.go && errchk \$G \$D/\$F.go" } {
658 # These tests
import the same package under two different
659 # names
, which gccgo does not support.
660 } elseif
{ $test_line
== "// \$G -S \$D/\$F.go | egrep initdone >/dev/null && echo FAIL || true" } {
661 # This tests whether initializers are written out
662 # statically. gccgo does not provide a way to test that
,
663 # as an initializer will be generated
for any code which
664 # has global variables which need to be registered as GC
667 clone_output
"$name: unrecognized test line: $test_line"
671 set go_execute_args
""
674 set dg
-do-what
-default $
{saved
-dg
-do-what
-default
}
675 set TORTURE_OPTIONS $saved_torture_options