OSDN Git Service

13e801b73f82254375d987defa5a6b3bb31ed246
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / go.test / go-test.exp
1 #   Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
2 #   Written by Ian Lance Taylor <iant@google.com>.
3
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.
8 #
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.
13 #
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/>.
17
18
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.
27 #
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
33
34 load_lib go-dg.exp
35 load_lib go-torture.exp
36
37 # Compare two files
38 proc filecmp { file1 file2 testname } {
39     set f1 [open $file1 r]
40     set f2 [open $file2 r]
41     set ok 1
42     while { [gets $f1 line1] >= 0 } {
43         if { [gets $f2 line2] < 0 } {
44             verbose -log "output mismatch: $file2 shorter than $file1"
45             set ok 0
46             break
47         }
48         if { $line1 != $line2 } {
49             verbose -log "output mismatch comparing $file1 and $file2"
50             verbose -log "expected \"$line1\""
51             verbose -log "got      \"$line2\""
52             set ok 0
53             break
54         }
55     }
56     if { [gets $f2 line2] >= 0 } {
57         verbose -log "output mismatch: $file1 shorter than $file2"
58         set ok 0
59     }
60     close $f1
61     close $f2
62     if { ! $ok } {
63         fail $testname
64     } else {
65         pass $testname
66     }
67 }
68
69 # Implement errchk
70 proc errchk { test opts } {
71     global dg-do-what-default
72     global DEFAULT_GOCFLAGS
73     global runtests
74
75     set saved-dg-do-what-default ${dg-do-what-default}
76     set dg-do-what-default compile
77     set filename [file tail $test]
78     if { "$filename" == "$test" } {
79         set filename "errchk-$filename"
80     }
81     set fdin [open $test r]
82     fconfigure $fdin -encoding binary
83     set fdout [open $filename w]
84     fconfigure $fdout -encoding binary
85     while { [gets $fdin copy_line] >= 0 } {
86         if [string match "*////*" $copy_line] {
87             puts $fdout $copy_line
88             continue
89         }
90         regsub "// \(GCCGO_\)?ERROR \"\(\[^\"\]*\)\".*$" $copy_line "// \{ dg-error \"\\2\" \}" out_line
91         if [string match "*dg-error*\\\[*" $out_line] {
92             set index [string first "dg-error" $out_line]
93             regsub -start $index -all "\\\\\\\[" $out_line "\\\\\\\\\\\[" out_line
94         }
95         if [string match "*dg-error*\\\]*" $out_line] {
96             set index [string first "dg-error" $out_line]
97             regsub -start $index -all "\\\\\\\]" $out_line "\\\\\\\\\\\]" out_line
98         }
99         if [string match "*dg-error*.\**" $out_line] {
100             # I worked out the right number of backslashes by
101             # experimentation, not analysis.
102             regsub -all "\\.\\*" $out_line "\\\\\[ -~\\\\\]*" out_line
103         }
104         if [string match "*dg-error*\\\[?\\\]*" $out_line] {
105             set index [string first "dg-error" $out_line]
106             regsub -all "\\\[\(.\)\\\]" $out_line "\\\\\[\\1\\\\\]" out_line
107         }
108         if [string match "*dg-error*\{*" $out_line] {
109             set index [string first "dg-error" $out_line]
110             regsub -start $index -all "\(\[^\\\\]\)\{" $out_line "\\1\\\\\[\\\{\\\\\]" out_line
111         }
112         if [string match "*dg-error*\}*\}" $out_line] {
113             set index [string first "dg-error" $out_line]
114             regsub -start $index -all "\(\[^\\\\]\)\}\(.\)" $out_line "\\1\\\\\[\\\}\\\\\]\\2" out_line
115         }
116         if [string match "*dg-error*\(*" $out_line] {
117             set index [string first "dg-error" $out_line]
118             regsub -start $index -all "\\\\\\\(" $out_line "\\\\\[\\\(\\\\\]" out_line
119         }
120         if [string match "*dg-error*\)*\}" $out_line] {
121             set index [string first "dg-error" $out_line]
122             regsub -start $index -all "\\\\\\\)\(.\)" $out_line "\\\\\[\\\)\\\\\]\\1" out_line
123         }
124         # Special case for bug332, in which the error message wants to
125         # match the file name, which is not what dg-error expects.
126         if [string match "*dg-error*bug332*" $out_line] {
127             set index [string first "dg-error" $out_line]
128             regsub -start $index "bug332" $out_line "undefined type" out_line
129         }
130         puts $fdout $out_line
131     }
132     close $fdin
133     close $fdout
134
135     set hold_runtests $runtests
136     set runtests "go-test.exp"
137     go-dg-runtest $filename "-fno-show-column $DEFAULT_GOCFLAGS $opts"
138     set runtests $hold_runtests
139
140     file delete $filename
141     set dg-do-what-default ${saved-dg-do-what-default}
142 }
143
144 # This is an execution test which should fail.
145 proc go-execute-xfail { test } {
146     global DEFAULT_GOCFLAGS
147     global runtests
148
149     set filename [file tail $test]
150     set fdin [open $test r]
151     set fdout [open $filename w]
152     puts $fdout "// { dg-do run { xfail *-*-* } }"
153     while { [gets $fdin copy_line] >= 0 } {
154         puts $fdout $copy_line
155     }
156     close $fdin
157     close $fdout
158
159     set hold_runtests $runtests
160     set runtests "go-test.exp"
161     go-dg-runtest $filename "-w $DEFAULT_GOCFLAGS"
162     set runtests $hold_runtests
163
164     file delete $filename
165 }
166
167 # N.B. Keep in sync with libgo/configure.ac.
168 proc go-set-goarch { } {
169     global target_triplet
170
171     switch -glob $target_triplet {
172         "alpha*-*-*" {
173             set goarch "alpha"
174         }
175         "arm*-*-*" -
176         "ep9312*-*-*" -
177         "strongarm*-*-*" -
178         "xscale-*-*" {
179             set goarch "arm"
180         }
181         "i?86-*-*" -
182         "x86_64-*-*" {
183             if [check_effective_target_ia32] {
184                 set goarch "386"
185             } else {
186                 set goarch "amd64"
187             }
188         }
189         "mips*-*-*" {
190             if [check_no_compiler_messages mipso32 assembly {
191                 #if _MIPS_SIM != _ABIO32
192                 #error FOO
193                 #endif
194             }] {
195                 set goarch "mipso32"
196             } elseif [check_no_compiler_messages mipsn32 assembly {
197                 #if _MIPS_SIM != _ABIN32
198                 #error FOO
199                 #endif
200             }] {
201                 set goarch "mipsn32"
202             } elseif [check_no_compiler_messages mipsn64 assembly {
203                 #if _MIPS_SIM != _ABI64
204                 #error FOO
205                 #endif
206             }] {
207                 set goarch "mipsn64"
208             } elseif [check_no_compiler_messages mipso64 assembly {
209                 #if _MIPS_SIM != _ABIO64
210                 #error FOO
211                 #endif
212             }] {
213                 set goarch "mipso64"
214             } else {
215                 perror "$target_triplet: unrecognized MIPS ABI"
216                 return ""
217             }
218         }
219         "sparc*-*-*" {
220             if [check_effective_target_ilp32] {
221                 set goarch "sparc"
222             } else {
223                 set goarch "sparc64"
224             }
225         }
226         default {
227             perror "$target_triplet: unhandled architecture"
228             return ""
229         }       
230     }
231     verbose -log "Setting GOARCH=$goarch" 1
232     setenv GOARCH $goarch
233 }
234
235 proc go-gc-tests { } {
236     global srcdir subdir
237     global runtests
238     global GCC_UNDER_TEST
239     global TOOL_OPTIONS
240     global TORTURE_OPTIONS
241     global dg-do-what-default
242     global go_compile_args
243     global go_execute_args
244     global target_triplet
245
246     # If a testcase doesn't have special options, use these.
247     global DEFAULT_GOCFLAGS
248     if ![info exists DEFAULT_GOCFLAGS] {
249         set DEFAULT_GOCFLAGS " -pedantic-errors"
250     }
251
252     set options ""
253     lappend options "additional_flags=$DEFAULT_GOCFLAGS"
254
255     # Set GOARCH for tests that need it.
256     go-set-goarch
257
258     # Running all the torture options takes too long and, since the
259     # frontend ignores the standard options, it doesn't significantly
260     # improve testing.
261     set saved_torture_options $TORTURE_OPTIONS
262     set TORTURE_OPTIONS [ list { -O2 -g }]
263
264     set saved-dg-do-what-default ${dg-do-what-default}
265
266     set testdir [pwd]
267
268     set tests [lsort [find $srcdir/$subdir *.go]]
269     foreach test $tests {
270         if ![runtest_file_p $runtests $test] {
271             continue
272         }
273
274         # Skip the files in bench; they are not tests.
275         if [string match "*go.test/test/bench/*" $test] {
276             continue
277         }
278
279         # Skip files in sub-subdirectories: they are components of
280         # other tests.
281         if [string match "*go.test/test/*/*/*" $test] {
282             continue
283         }
284
285         set name [dg-trim-dirname $srcdir $test]
286
287         # Skip certain tests if target is RTEMS OS.
288         if [istarget "*-*-rtems*"] {
289             if { [string match "*go.test/test/args.go" \
290                    $test] \
291                  || [string match "*go.test/test/env.go" \
292                    $test] } {
293                     untested "$name: uses the command-line or environment variables"
294                     continue
295             }
296
297             if { [string match "*go.test/test/stack.go" \
298                    $test] \
299                  || [string match "*go.test/test/peano.go" \
300                    $test] \
301                  || [string match "*go.test/test/chan/goroutines.go" \
302                    $test] } {
303                     untested "$name: has very high memory requirement"
304                     continue
305             }
306         }
307
308         if { [string match "*bug347*" $test] \
309                  || [string match "*bug348*" $test] } {
310             # These bugs rely on runtime.Caller which currently fails.
311             untested $name
312             continue
313         }
314
315         if { [file tail $test] == "init1.go" } {
316             # This tests whether GC runs during init, which for gccgo
317             # it currently does not.
318             untested $name
319             continue
320         }
321
322         if { [file tail $test] == "closure.go" } {
323             # This tests whether function closures do any memory
324             # allocation, which for gccgo they currently do.
325             untested $name
326             continue
327         }
328
329         set fd [open $test r]
330
331         set lines_ok 1
332
333         while 1 {
334             if { [gets $fd test_line] < 0 } {
335                 close $fd
336                 clone_output "$test: could not read first line"
337                 unresolved $name
338                 set lines_ok 0
339                 break
340             }
341
342             if { [ string match "*nacl*exit 0*" $test_line ] \
343                      || [ string match "*exit 0*nacl*" $test_line ] \
344                      || [ string match "*Android*exit 0*" $test_line ] \
345                      || [ string match "*exit 0*Android*" $test_line ] \
346                      || [ string match "*\"\$GOOS\" == windows*" $test_line ] } {
347                 continue
348             }
349
350             break
351         }
352
353         if { $lines_ok == 0 } {
354             continue
355         }
356
357         set lineno 1
358         set test_line1 $test_line
359
360         while { [eval "string match \"//*&&\" \${test_line$lineno}"] } {
361             set lineno [expr $lineno + 1]
362             if { [eval "gets \$fd test_line$lineno"] < 0 } {
363                 close $fd
364                 clone_output "$test: could not read line $lineno"
365                 unresolved $name
366                 set lines_ok 0
367                 break
368             }
369         }
370         if { $lines_ok == 0 } {
371             continue
372         }
373
374         close $fd
375
376         set go_compile_args ""
377         set go_execute_args ""
378         if { [regexp ".*\\\$A.out (\[^|&>2\].*)\$" $test_line match progargs] } {
379             set go_execute_args $progargs
380             verbose -log "$test: go_execute_args is $go_execute_args"
381             set index [string last " $progargs" $test_line]
382             set test_line [string replace $test_line $index end]
383         } elseif { [string match "*go.test/test/chan/goroutines.go" $test] \
384                    && [getenv GCCGO_RUN_ALL_TESTS] == "" } {
385             # goroutines.go spawns by default 10000 threads, which is too much
386             # for many OSes.
387             if { [getenv GCC_TEST_RUN_EXPENSIVE] == "" } {
388                 set go_execute_args 64
389             } elseif { ![is_remote host] && ![is_remote target] } {
390                 # When using low ulimit -u limit, use maximum of
391                 # a quarter of that limit and 10000 even when running expensive
392                 # tests, otherwise parallel tests might fail after fork failures.
393                 set nproc [lindex [remote_exec host {sh -c ulimit\ -u}] 1]
394                 if { [string is integer -strict $nproc] } {
395                         set nproc [expr $nproc / 4]
396                         if { $nproc > 10000 } { set nproc 10000 }
397                         if { $nproc < 16 } { set nproc 16 }
398                         set go_execute_args $nproc
399                 }
400             }
401             if { "$go_execute_args" != "" } {
402                 verbose -log "$test: go_execute_args is $go_execute_args"
403             }
404         }
405
406         if { $test_line == "// \$G \$D/\$F\.go && \$L \$F\.\$A && \./\$A\.out >tmp.go &&" \
407              && $test_line2 == "// \$G tmp\.go && \$L tmp\.\$A && \./\$A\.out || echo BUG: 64bit" } {
408             # 64bit.go is a special case.
409             set go_execute_args ""
410             set hold_runtests $runtests
411             set runtests "go-test.exp"
412             set dg-do-what-default "link"
413             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
414             set output_file "./[file rootname [file tail $test]].exe"
415             set base "[file rootname [file tail $test]]"
416             if [isnative] {
417                 if { [catch "exec $output_file >$base-out.go"] != 0 } {
418                     fail "$name execution"
419                 } else {
420                     pass "$name execution"
421                     file delete $base-out.x
422                     go-torture-execute "./$base-out.go"
423                 }
424                 file delete $base-out.go
425             }
426             file delete $output_file
427             set runtests $hold_runtests
428         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" \
429                    || $test_line == "// \$G \$F.go && \$L \$F.\$A && ./\$A.out" \
430                    || $test_line == "// \$G \$F.go && \$L \$F.\$A &&./\$A.out" \
431                    || $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && \$A.out" \
432                    || [string match \
433                            "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out || echo BUG*" \
434                            $test_line]
435                    || [string match \
436                            "// \$G \$F.go && \$L \$F.\$A && (./\$A.out || echo BUG*" \
437                            $test_line]
438                    || [string match \
439                            "// \$G \$D/\$F.go && \$L \$F.\$A && (./\$A.out || echo BUG*" \
440                            $test_line]
441                    || [string match \
442                            "// \$G \$F.go && \$L \$F.\$A && GOMAXPROCS=* ./\$A.out" \
443                            $test_line]
444                    || [string match \
445                            "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >* || echo BUG*" \
446                            $test_line] } {
447             # This is a vanilla execution test.
448             go-torture-execute $test
449             file delete core [glob -nocomplain core.*]
450         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out 2>&1 | cmp - \$D/\$F.out" \
451                        || $test_line == "// \$G \$F.go && \$L \$F.\$A && ./\$A.out 2>&1 | cmp - \$D/\$F.out" \
452                        || $test_line == "// (\$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out 2>&1 | cmp - \$D/\$F.out)" } {
453             # This is an execution test for which we need to check the
454             # program output.
455             set hold_runtests $runtests
456             set runtests "go-test.exp"
457             set dg-do-what-default "link"
458             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
459             set output_file "./[file rootname [file tail $test]].exe"
460             set base "[file rootname [file tail $test]]"
461             if [isnative] {
462                 verbose -log "$output_file >$base.p 2>&1"
463                 if { [catch "exec $output_file 2>$base.p" catcherr] != 0 } {
464                     verbose -log $catcherr
465                     fail "$name execution"
466                     untested "$name compare"
467                 } else {
468                     pass "$name execution"
469                     regsub "\\.go$" $test ".out" expect
470                     filecmp $expect $base.p "$name compare"
471                 }
472                 #file delete $base.p
473             } else {
474                 untested "$name execution"
475                 untested "$name compare"
476             }
477             set runtests $hold_runtests
478         } elseif { [string match \
479                         "// \$G \$D/\$F.go && \$L \$F.\$A || echo BUG*" \
480                         $test_line] \
481                    || [string match "// \$G \$F.go && \$L \$F.\$A  #*" \
482                            $test_line]
483                    || $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A" } {
484             # This is a vanilla compile and link test.
485             set dg-do-what-default "link"
486             go-dg-runtest $test "-w $DEFAULT_GOCFLAGS"
487         } elseif { [string match "// \$G \$D/\$F.go" $test_line] \
488                    || [string match "// \$G \$D/\$F.go || echo BUG*" \
489                            $test_line] \
490                    || [string match "// \$G \$D/\$F.go || echo \"Bug*" \
491                            $test_line] \
492                    || [string match "// \$G \$D/\$F.go || echo \"Issue*" \
493                            $test_line] \
494                    || [string match "// \$G \$F.go || echo BUG*" \
495                            $test_line] \
496                    || [string match "// ! \$G \$D/\$F.go && echo BUG*" \
497                            $test_line] \
498                    || $test_line == "// echo bug395 is broken  # takes 90+ seconds to break" } {
499             # This is a vanilla compile test.
500             set dg-do-what-default "assemble"
501             go-dg-runtest $test "-w $DEFAULT_GOCFLAGS"
502         } elseif { [string match "// \$G \$D/\$F.go && echo BUG*" \
503                         $test_line] \
504                    || $test_line == "// ! \$G \$D/\$F.go >/dev/null" \
505                    || $test_line == "// ! \$G \$D/\$F.go" \
506                    || $test_line == "// ! \$G \$F.go" \
507                    || [string match "// ! \$G \$D/\$F.go || echo BUG*" \
508                         $test_line] } {
509             # This is a compile test which should fail.
510             set dg-do-what-default "assemble"
511             setup_xfail "*-*-*"
512             go-dg-runtest $test "-w $DEFAULT_GOCFLAGS"
513         } elseif { [string match "// \$G \$D/\$F.go && \$L \$F.\$A && ! ./\$A.out" \
514                         $test_line] \
515                    || [string match "// \$G \$D/\$F.go && \$L \$F.\$A && ! ./\$A.out || echo BUG: *" \
516                         $test_line] \
517                    || [string match "// \$G \$D/\$F.go && \$L \$F.\$A && (! ./\$A.out || echo BUG: *" \
518                         $test_line] \
519                    || ($test_line == "// \$G \$D/\$F.go && \$L \$F.\$A &&"
520                        && $test_line2 == "//    ((! sh -c ./\$A.out) >/dev/null 2>&1 || echo BUG: should fail)") } {
521             go-execute-xfail $test
522         } elseif { [string match "// errchk \$G \$F.go" $test_line] \
523                     || [string match "// errchk \$G -e \$F.go" $test_line] \
524                     || [string match "// errchk \$G \$D/\$F.go" $test_line] \
525                     || [string match "//errchk \$G \$D/\$F.go" $test_line] \
526                     || [string match "// errchk \$G -e \$D/\$F.go" \
527                             $test_line] \
528                     || [string match "// ! errchk \$G \$D/\$F.go" $test_line] \
529                     || [string match "// ! errchk \$G -e \$D/\$F.go" \
530                             $test_line] \
531                     || [string match "// errchk \$G \$F.go || true" \
532                             $test_line] \
533                     || [string match "// errchk \$G \$D/\$F.go || true" \
534                             $test_line] \
535                     || [string match "// errchk \$G -e \$D/\$F.go || true" \
536                             $test_line] \
537                     || [string match "// errchk \$G \$D/\$F.go || echo BUG*" \
538                             $test_line] } {
539             errchk $test ""
540         } elseif { [string match \
541                         "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go || echo BUG*" \
542                         $test_line] \
543                        || [string match \
544                                "// \$G \$D/\$F.dir/one.go && \$G \$D/\$F.dir/two.go" \
545                                $test_line] } {
546             if { [string match \
547                       "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go || echo BUG*" \
548                       $test_line] } {
549                 set name1 "bug0.go"
550                 set name2 "bug1.go"
551             } elseif { [string match \
552                             "// \$G \$D/\$F.dir/one.go && \$G \$D/\$F.dir/two.go" \
553                             $test_line] } {
554                 set name1 "one.go"
555                 set name2 "two.go"
556             }
557             set hold_runtests $runtests
558             set runtests "go-test.exp"
559             set dg-do-what-default "assemble"
560             regsub "\\.go$" $test ".dir/$name1" file1
561             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
562             regsub "\\.go$" $test ".dir/$name2" file2
563             dg-test $file2 "-O" "-w $DEFAULT_GOCFLAGS"
564             file delete "[file rootname [file tail $file1]].o"
565             set runtests $hold_runtests
566         } elseif { [string match \
567                         "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \
568                         $test_line] \
569                        || [string match \
570                                "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
571                                $test_line] \
572                        || [string match \
573                                "// \$G \$D/\$F.dir/b.go && \$G \$D/\$F.dir/a.go" \
574                                $test_line] \
575                        || [string match \
576                                "// \$G \$D/\$F.dir/io.go && errchk \$G -e \$D/\$F.dir/main.go" \
577                                $test_line] } {
578             if { [string match \
579                       "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \
580                       $test_line] } {
581                 set name1 "bug0.go"
582                 set name2 "bug1.go"
583             } elseif { [string match \
584                             "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
585                             $test_line] } {
586                 set name1 "p1.go"
587                 set name2 "p2.go"
588             } elseif { [string match \
589                             "// \$G \$D/\$F.dir/b.go && \$G \$D/\$F.dir/a.go" \
590                             $test_line] } {
591                 set name1 "b.go"
592                 set name2 "a.go"
593             } elseif { [string match \
594                             "// \$G \$D/\$F.dir/io.go && errchk \$G -e \$D/\$F.dir/main.go" \
595                             $test_line] } {
596                 set name1 "io.go"
597                 set name2 "main.go"
598             }
599             set hold_runtests $runtests
600             set runtests "go-test.exp"
601             set dg-do-what-default "assemble"
602             regsub "\\.go$" $test ".dir/$name1" file1
603             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
604             regsub "\\.go$" $test ".dir/$name2" file2
605             errchk $file2 ""
606             file delete "[file rootname [file tail $file1]].o"
607             set runtests $hold_runtests
608         } elseif { [string match \
609                         "// \$G \$D/\${F}1.go && errchk \$G \$D/\$F.go" \
610                         $test_line ] } {
611             set hold_runtests $runtests
612             set runtests "go-test.exp"
613             set dg-do-what-default "assemble"
614             regsub "\\.go$" $test "1.go" file1
615             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
616             errchk $test ""
617             file delete "[file rootname [file tail $file1]].o"
618             set runtests $hold_runtests
619         } elseif { [string match \
620                         "// \$G \$D/\$F.dir/bug0.go && (! \$G \$D/\$F.dir/bug1.go || echo BUG*" \
621                         $test_line] } {
622             set hold_runtests $runtests
623             set runtests "go-test.exp"
624             set dg-do-what-default "assemble"
625             regsub "\\.go$" $test ".dir/bug0.go" file1
626             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
627             regsub "\\.go$" $test ".dir/bug1.go" file2
628             setup_xfail "*-*-*"
629             dg-test $file2 "-O" "-w $DEFAULT_GOCFLAGS"
630             file delete "[file rootname [file tail $file1]].o"
631             set runtests $hold_runtests
632         } elseif { [string match \
633                         "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go && (! \$G \$D/\$F.dir/bug2.go || echo BUG*" \
634                         $test_line] } {
635             set hold_runtests $runtests
636             set runtests "go-test.exp"
637             set dg-do-what-default "assemble"
638             regsub "\\.go$" $test ".dir/bug0.go" file1
639             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
640             regsub "\\.go$" $test ".dir/bug1.go" file2
641             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
642             regsub "\\.go$" $test ".dir/bug2.go" file3
643             setup_xfail "*-*-*"
644             dg-test $file3 "-O" "-w $DEFAULT_GOCFLAGS"
645             file delete "[file rootname [file tail $file1]].o"
646             file delete "[file rootname [file tail $file2]].o"
647             set runtests $hold_runtests
648         } elseif { [string match \
649                         "// \$G \$D/\$F.dir/bug0.go && \$G \$D/\$F.dir/bug1.go && errchk \$G \$D/\$F.dir/bug2.go" \
650                         $test_line] } {
651             set hold_runtests $runtests
652             set runtests "go-test.exp"
653             set dg-do-what-default "assemble"
654             regsub "\\.go$" $test ".dir/bug0.go" file1
655             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
656             regsub "\\.go$" $test ".dir/bug1.go" file2
657             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
658             regsub "\\.go$" $test ".dir/bug2.go" file3
659             errchk $file3 ""
660             file delete "[file rootname [file tail $file1]].o"
661             file delete "[file rootname [file tail $file2]].o"
662             set runtests $hold_runtests
663         } elseif { [string match \
664                         "// \$G \$D/bug160.dir/x.go && \$G \$D/bug160.dir/y.go && \$L y.\$A && ./\$A.out" \
665                         $test_line] \
666                        || [string match \
667                                "// \$G \$D/\$F.dir/p.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out" \
668                                $test_line] } {
669             if { [string match \
670                         "// \$G \$D/bug160.dir/x.go && \$G \$D/bug160.dir/y.go && \$L y.\$A && ./\$A.out" \
671                       $test_line] } {
672                 set name1 "x.go"
673                 set name2 "y.go"
674             } elseif { [string match \
675                            "// \$G \$D/\$F.dir/p.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out" \
676                             $test_line] } {
677                 set name1 "p.go"
678                 set name2 "main.go"
679             }
680             set hold_runtests $runtests
681             set runtests "go-test.exp"
682             set dg-do-what-default "assemble"
683             regsub "\\.go$" $test ".dir/$name1" file1
684             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
685             set ofile1 "[file rootname [file tail $file1]].o"
686             regsub "\\.go$" $test ".dir/$name2" file2
687             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
688             set ofile2 "[file rootname [file tail $file2]].o"
689             set dg-do-what-default "link"
690             set output_file "./[file rootname [file tail $test]].exe"
691             set comp_output [go_target_compile "$ofile1 $ofile2" \
692                                  $output_file "executable" "$options"]
693             set comp_output [go-dg-prune $target_triplet $comp_output]
694             verbose -log $comp_output
695             set result [go_load "$output_file" "" ""]
696             set status [lindex $result 0]
697             $status $name
698             file delete $ofile1 $ofile2 $output_file
699             set runtests $hold_runtests
700         } elseif { [string match \
701                         "// \$G \$D/bug191.dir/a.go && \$G \$D/bug191.dir/b.go && \$G \$D/\$F.go && \$L \$F.\$A" \
702                         $test_line] } {
703             set hold_runtests $runtests
704             set runtests "go-test.exp"
705             set dg-do-what-default "assemble"
706             regsub "\\.go$" $test ".dir/a.go" file1
707             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
708             set ofile1 "[file rootname [file tail $file1]].o"
709             regsub "\\.go$" $test ".dir/b.go" file2
710             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
711             set ofile2 "[file rootname [file tail $file2]].o"
712             dg-test -keep-output "$test" "-O" "-w $DEFAULT_GOCFLAGS"
713             set ofile3 "[file rootname [file tail $test]].o"
714             set dg-do-what-default "link"
715             set output_file "./[file rootname [file tail $test]].exe"
716             set comp_output [go_target_compile "$ofile1 $ofile2 $ofile3" \
717                                  $output_file "executable" "$options"]
718             set comp_output [go-dg-prune $target_triplet $comp_output]
719             if [string match "" $comp_output] {
720                 pass $name
721             } else {
722                 verbose -log $comp_output
723                 fail $name
724             }
725             file delete $ofile1 $ofile2 $ofile3 $output_file
726             set runtests $hold_runtests
727         } elseif { [string match \
728                         "// \$G \$D/embed0.go && \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" \
729                         $test_line ] } {
730             set hold_runtests $runtests
731             set runtests "go-test.exp"
732             set dg-do-what-default "assemble"
733             regsub "/\[^/\]*$" $test "/embed0.go" file1
734             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
735             set ofile1 "[file rootname [file tail $file1]].o"
736             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
737             set ofile2 "[file rootname [file tail $test]].o"
738             set output_file "./[file rootname [file tail $test]].exe"
739             set comp_output [go_target_compile "$ofile1 $ofile2" \
740                                  $output_file "executable" "$options"]
741             set comp_output [go-dg-prune $target_triplet $comp_output]
742             if [string match "" $comp_output] {
743                 set result [go_load "$output_file" "" ""]
744                 set status [lindex $result 0]
745                 $status $name
746             } else {
747                 verbose -log $comp_output
748                 fail $name
749             }
750             file delete $ofile1 $ofile2 $output_file
751             set runtests $hold_runtests
752         } elseif { [string match \
753                         "// \$G \$D/\$F.dir/lib.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out || echo BUG*" \
754                         $test_line ] || \
755                        [string match \
756                             "// \$G \$D/\$F.dir/p.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out || echo BUG*" \
757                             $test_line ] } {
758             if { [string match \
759                       "// \$G \$D/\$F.dir/lib.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out || echo BUG*" \
760                       $test_line ] } {
761                 set name1 "lib.go"
762                 set name2 "main.go"
763             } elseif { [string match \
764                             "// \$G \$D/\$F.dir/p.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ./\$A.out || echo BUG*" \
765                             $test_line ] } {
766                 set name1 "p.go"
767                 set name2 "main.go"
768             }
769             set hold_runtests $runtests
770             set runtests "go-test.exp"
771             set dg-do-what-default "assemble"
772             regsub "\\.go$" $test ".dir/$name1" file1
773             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
774             set ofile1 "[file rootname [file tail $file1]].o"
775             regsub "\\.go$" $test ".dir/$name2" file2
776             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
777             set ofile2 "[file rootname [file tail $file2]].o"
778             set dg-do-what-default "link"
779             set output_file "./[file rootname [file tail $file2]].exe"
780             set comp_output [go_target_compile "$ofile1 $ofile2" \
781                                  $output_file "executable" "$options"]
782             set comp_output [go-dg-prune $target_triplet $comp_output]
783             if [string match "" $comp_output] {
784                 set result [go_load "$output_file" "" ""]
785                 set status [lindex $result 0]
786                 $status $name
787             } else {
788                 verbose -log $comp_output
789                 fail $name
790             }
791             file delete $ofile1 $ofile2 $output_file
792             set runtests $hold_runtests
793         } elseif { [string match \
794                         "// \$G \$D/\$F.dir/chanbug.go && \$G -I. \$D/\$F.dir/chanbug2.go" \
795                         $test_line] } {
796             set hold_runtests $runtests
797             set runtests "go-test.exp"
798             set dg-do-what-default "assemble"
799             regsub "\\.go$" $test ".dir/chanbug.go" file1
800             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
801             regsub "\\.go$" $test ".dir/chanbug2.go" file2
802             dg-test $file2 "-O" "-w $DEFAULT_GOCFLAGS"
803             file delete "[file rootname [file tail $file1]].o"
804             set runtests $hold_runtests
805         } elseif { [string match \
806                         "// (! \$G \$D/\$F.go) | grep 'initialization loop' *" \
807                         $test_line] } {
808             set dg-do-what-default "assemble"
809             setup_xfail "*-*-*"
810             go-dg-runtest $test "-w $DEFAULT_GOCFLAGS"
811         } elseif { [string match \
812                         "// \$G \$D/\$F.dir/x.go && errchk \$G \$D/\$F.dir/y.go" \
813                         $test_line] } {
814             set hold_runtests $runtests
815             set runtests "go-test.exp"
816             set dg-do-what-default "assemble"
817             regsub "\\.go$" $test ".dir/x.go" file1
818             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
819             regsub "\\.go$" $test ".dir/y.go" file2
820             errchk $file2 ""
821             file delete "[file rootname [file tail $file1]].o"
822             set runtests $hold_runtests
823         } elseif { "$test_line" == "" || [string match "// true*" $test_line] } {
824             # Not a real test, just ignore.
825         } elseif { $test_line == "// \$G \$D/\$F.dir/bug0.go &&" \
826                        && $test_line2 == "// \$G \$D/\$F.dir/bug1.go &&" \
827                        && $test_line3 == "// \$G \$D/\$F.dir/bug2.go &&" \
828                        && $test_line4 == "// errchk \$G -e \$D/\$F.dir/bug3.go &&" \
829                        && $test_line5 == "// \$L bug2.\$A &&" \
830                        && [string match "// ./\$A.out || echo BUG*" $test_line6] } {
831             set hold_runtests $runtests
832             set runtests "go-test.exp"
833             set dg-do-what-default "assemble"
834             regsub "\\.go$" $test ".dir/bug0.go" file0
835             dg-test -keep-output $file0 "-O -fgo-prefix=bug0" "-w $DEFAULT_GOCFLAGS"
836             set ofile0 "[file rootname [file tail $file0]].o"
837             regsub "\\.go$" $test ".dir/bug1.go" file1
838             dg-test -keep-output $file1 "-O -fgo-prefix=bug1" "-w $DEFAULT_GOCFLAGS"
839             set ofile1 "[file rootname [file tail $file1]].o"
840             regsub "\\.go$" $test ".dir/bug2.go" file2
841             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
842             set ofile2 "[file rootname [file tail $file2]].o"
843             regsub "\\.go$" $test ".dir/bug3.go" file3
844             errchk $file3 ""
845             set output_file "./[file rootname [file tail $test]].exe"
846             set comp_output [go_target_compile "$ofile0 $ofile1 $ofile2" \
847                                  $output_file "executable" "$options"]
848             set comp-output [go-dg-prune $target_triplet $comp_output]
849             if [string match "" $comp_output] {
850                 set result [go_load "$output_file" "" ""]
851                 set status [lindex $result 0]
852                 $status $name
853             } else {
854                 verbose -log $comp_output
855                 fail $name
856             }
857             file delete $ofile0 $ofile1 $ofile2 $output_file
858             set runtests $hold_runtests
859         } elseif { $test_line == "// \$G \$D/import2.go && \$G \$D/\$F\.go" \
860                        || $test_line == "// \$G \$D/recursive1.go && \$G \$D/\$F.go" } {
861             if { $test_line == "// \$G \$D/import2.go && \$G \$D/\$F\.go" } {
862                 set name1 "import2.go"
863             } elseif { $test_line == "// \$G \$D/recursive1.go && \$G \$D/\$F.go" } {
864                 set name1 "recursive1.go"
865             }
866             set hold_runtests $runtests
867             set runtests "go-test.exp"
868             set dg-do-what-default "assemble"
869             regsub "/\[^/\]*$" $test "/${name1}" file1
870             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
871             set ofile1 "[file rootname [file tail $file1]].o"
872             dg-test $test "-O" "-w $DEFAULT_GOCFLAGS"
873             file delete $ofile1
874             set runtests $hold_runtests
875         } elseif { $test_line == "// \$G \$D/ddd2.go && \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" } {
876             set hold_runtests $runtests
877             set runtests "go-test.exp"
878             set dg-do-what-default "assemble"
879             regsub "/\[^/\]*$" $test "/ddd2.go" file1
880             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
881             set ofile1 "[file rootname [file tail $file1]].o"
882             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
883             set ofile2 "[file rootname [file tail $test]].o"
884             set output_file "./[file rootname [file tail $test]].exe"
885             set comp_output [go_target_compile "$ofile1 $ofile2" \
886                                  $output_file "executable" "$options"]
887             set comp_output [go-dg-prune $target_triplet $comp_output]
888             if [string match "" $comp_output] {
889                 set result [go_load "$output_file" "" ""]
890                 set status [lindex $result 0]
891                 $status $name
892             } else {
893                 verbose -log $comp_output
894                 fail $name
895             }
896             file delete $ofile1 $ofile2 $output_file
897             set runtests $hold_runtests
898         } elseif { $test_line == "// \$G \$D/\$F.go \$D/cmplxdivide1.go && \$L \$D/\$F.\$A && ./\$A.out" } {
899             regsub "/\[^/\]*$" $test "/cmplxdivide1.go" test2
900             set output_file "./[file rootname [file tail $test]].o"
901             set comp_output [go_target_compile "$test $test2" \
902                                  $output_file "executable" "$options"]
903             set comp_output [go-dg-prune $target_triplet $comp_output]
904             if [string match "" $comp_output] {
905                 set result [go_load "$output_file" "" ""]
906                 set status [lindex $result 0]
907                 $status $name
908             } else {
909                 verbose -log $comp_output
910                 fail $name
911             }
912             file delete $output_file
913         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A &&" \
914                        && $test_line2 == "// ./\$A.out -pass 0 >tmp.go && \$G tmp.go && \$L -o \$A.out1 tmp.\$A && ./\$A.out1 &&" \
915                        && $test_line3 == "// ./\$A.out -pass 1 >tmp.go && errchk \$G -e tmp.go &&" \
916                        && $test_line4 == "// ./\$A.out -pass 2 >tmp.go && errchk \$G -e tmp.go" } {
917             set go_execute_args ""
918             set hold_runtests $runtests
919             set runtests "go-test.exp"
920             set dg-do-what-default "link"
921             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
922             set output_file "./[file rootname [file tail $test]].exe"
923             if [isnative] {
924                 if { [catch "exec $output_file -pass 0 >tmp.go"] != 0 } {
925                     fail "$name execution 0"
926                 } else {
927                     pass "$name execution 0"
928                     file delete tmp.x
929                     go-torture-execute "./tmp.go"
930                 }
931                 if { [catch "exec $output_file -pass 1 >tmp.go"] != 0 } {
932                     fail "$name execution 1"
933                 } else {
934                     pass "$name execution 1"
935                     errchk tmp.go ""
936                 }
937                 if { [catch "exec $output_file -pass 2 >tmp.go"] != 0 } {
938                     fail "$name execution 2"
939                 } else {
940                     pass "$name execution 2"
941                     errchk tmp.go ""
942                 }
943                 file delete tmp.go
944             }
945             file delete $output_file
946             set runtests $hold_runtests
947         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >tmp.go &&" \
948                         && $test_line2 == "// errchk \$G -e tmp.go" } {
949             set go_execute_args ""
950             set hold_runtests $runtests
951             set runtests "go-test.exp"
952             set dg-do-what-default "link"
953             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
954             set output_file "./[file rootname [file tail $test]].exe"
955             if [isnative] {
956                 if { [catch "exec $output_file >tmp.go"] != 0 } {
957                     fail "$name execution"
958                 } else {
959                     pass "$name execution"
960                     file delete tmp.x
961                     errchk tmp.go ""
962                 }
963             }
964             file delete $output_file
965             set runtests $hold_runtests
966         } elseif { [string match \
967                         "// \$G \$D/\$F.dir/p.go && \$G \$D/\$F.dir/main.go && \$L main.\$A && ! ./\$A.out || echo BUG*" \
968                         $test_line] } {
969             set hold_runtests $runtests
970             set runtests "go-test.exp"
971             set dg-do-what-default "assemble"
972             regsub "\\.go$" $test ".dir/p.go" file1
973             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
974             set ofile1 "[file rootname [file tail $file1]].o"
975             regsub "\\.go$" $test ".dir/main.go" file2
976             dg-test -keep-output $file2 "-O" "-w $DEFAULT_GOCFLAGS"
977             set ofile2 "[file rootname [file tail $file2]].o"
978             set output_file "./[file rootname [file tail $test]].exe"
979             set comp_output [go_target_compile "$ofile1 $ofile2" \
980                                  $output_file "executable" "$options"]
981             set comp_output [go-dg-prune $target_triplet $comp_output]
982             if [string match "" $comp_output] {
983                 setup_xfail "*-*-*"
984                 set result [go_load "$output_file" "" ""]
985                 set status [lindex $result 0]
986                 $status $name
987             } else {
988                 verbose -log $comp_output
989                 fail $name
990             }
991             file delete $ofile1 $ofile2 $output_file
992             set runtests $hold_runtests
993         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >tmp.go &&"
994                    && $test_line2 == "// \$G tmp.go && \$L tmp.\$A && ./\$A.out || echo BUG: select5" } {
995             set go_execute_args ""
996             set hold_runtests $runtests
997             set runtests "go-test.exp"
998             set dg-do-what-default "link"
999             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
1000             set output_file "./[file rootname [file tail $test]].exe"
1001             set base "[file rootname [file tail $test]]"
1002             if [isnative] {
1003                 if { [catch "exec $output_file > $base-out.go"] != 0 } {
1004                     fail "$name execution"
1005                 } else {
1006                     pass "$name execution"
1007                     file delete $base-out.x
1008                     go-torture-execute "./$base-out.go"
1009                 }
1010                 file delete $base-out.go
1011             }
1012             file delete $output_file
1013             set runtests $hold_runtests
1014         } elseif { $test_line == "// errchk \$G -e \$D/\$F.dir/\[ab\].go" } {
1015             regsub "\\.go$" $test ".dir/a.go" file1
1016             regsub "\\.go$" $test ".dir/b.go" file2
1017             errchk "$file1" "$file2"
1018         } elseif { $test_line == "// \$G \$D/\$F.go \$D/z*.go && \$L \$F.\$A && ./\$A.out" } {
1019             set dir [file dirname $test]
1020             set go_compile_args [glob $dir/z*.go]
1021             go-torture-execute $test
1022         } elseif { $test_line == "// \$G -N -o slow.\$A \$D/bug369.dir/pkg.go &&" \
1023                        && $test_line2 == "// \$G -o fast.\$A \$D/bug369.dir/pkg.go &&" \
1024                        && $test_line3 == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out" } {
1025             set hold_runtests $runtests
1026             set runtests "go-test.exp"
1027             set dg-do-what-default "assemble"
1028             regsub "\\.go$" $test ".dir/pkg.go" file1
1029             dg-test -keep-output $file1 "" "-fgo-prefix=slow -w $DEFAULT_GOCFLAGS"
1030             set ofile1 "[file rootname [file tail $file1]].o"
1031             file rename -force $ofile1 slow.o
1032             dg-test -keep-output $file1 "-O2" "-fgo-prefix=fast -w $DEFAULT_GOCFLAGS"
1033             file rename -force $ofile1 fast.o
1034             set ofile2 "[file rootname [file tail $test]].o"
1035             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
1036             set output_file "./[file rootname [file tail $test]].exe"
1037             set comp_output [go_target_compile "$ofile2 slow.o fast.o" \
1038                                  $output_file "executable" "$options"]
1039             set comp_output [go-dg-prune $target_triplet $comp_output]
1040             if [string match "" $comp_output] {
1041                 set result [go_load "$output_file" "" ""]
1042                 set status [lindex $result 0]
1043                 $status $name
1044             } else {
1045                 verbose -log $comp_output
1046                 fail $name
1047             }
1048             file delete slow.o fast.o $ofile2 $output_file
1049             set runtests $hold_runtests
1050         } elseif { [string match \
1051                         "// \$G \$D/\$F.dir/pkg.go && \$G \$D/\$F.go || echo *" \
1052                         $test_line ] } {
1053             set hold_runtests $runtests
1054             set runtests "go-test.exp"
1055             set dg-do-what-default "assemble"
1056             regsub "\\.go$" $test ".dir/pkg.go" file1
1057             dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOCFLAGS"
1058             dg-test $test "-O" "-w $DEFAULT_GOCFLAGS"
1059             file delete "[file rootname [file tail $file1]].o"
1060             set runtests $hold_runtests
1061         } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >tmp.go &&"
1062                    && $test_line2 == "// \$G tmp.go && \$L tmp.\$A && ./\$A.out" } {
1063             set go_execute_args ""
1064             set hold_runtests $runtests
1065             set runtests "go-test.exp"
1066             set dg-do-what-default "link"
1067             dg-test -keep-output $test "-O" "-w $DEFAULT_GOCFLAGS"
1068             set output_file "./[file rootname [file tail $test]].exe"
1069             set base "[file rootname [file tail $test]]"
1070             if [isnative] {
1071                 if { [catch "exec $output_file >$base-out.go"] != 0 } {
1072                     fail "$name execution"
1073                 } else {
1074                     pass "$name execution"
1075                     file delete $base-out.x
1076                     go-torture-execute "./$base-out.go"
1077                 }
1078                 file delete $base-out.go
1079             }
1080             file delete $output_file
1081             set runtests $hold_runtests
1082         } elseif { $test_line == "// # generated by cmplxdivide.c" } {
1083             # Ignore.
1084         } elseif { $test_line == "// \$G \$D/bug302.dir/p.go && gopack grc pp.a p.\$A && \$G \$D/bug302.dir/main.go" \
1085                    || $test_line == "// \$G \$D/empty.go && errchk \$G \$D/\$F.go" } {
1086             # These tests import the same package under two different
1087             # names, which gccgo does not support.
1088         } elseif { $test_line == "// \$G -S \$D/\$F.go | egrep initdone >/dev/null && echo BUG sinit || true" } {
1089             # This tests whether initializers are written out
1090             # statically.  gccgo does not provide a way to test that,
1091             # as an initializer will be generated for any code which
1092             # has global variables which need to be registered as GC
1093             # roots.
1094         } elseif { $test_line == "// errchk -0 \$G -m -l \$D/\$F.go" } {
1095             # This tests debug output of the gc compiler, which is
1096             # meaningless for gccgo.
1097         } elseif { $test_line == "// \[ \$O == 6 \] || errchk \$G -e \$D/\$F.go" \
1098                        || $test_line == "// \[ \$O != 6 \]  || errchk \$G -e \$D/\$F.go" } {
1099             # This tests specific handling of the gc compiler on types
1100             # that are too large.  It is target specific in a way I
1101             # haven't bothered to check for here.
1102         } else {
1103             clone_output "$name: unrecognized test line: $test_line"
1104             unsupported $name
1105         }
1106
1107         set go_compile_args ""
1108         set go_execute_args ""
1109     }
1110
1111     set dg-do-what-default ${saved-dg-do-what-default}
1112     set TORTURE_OPTIONS $saved_torture_options
1113 }
1114
1115 go-gc-tests