From patchwork Sat Sep 11 00:49:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 64479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 8632CB70A8 for ; Sat, 11 Sep 2010 10:49:53 +1000 (EST) Received: (qmail 9069 invoked by alias); 11 Sep 2010 00:49:50 -0000 Received: (qmail 9051 invoked by uid 22791); 11 Sep 2010 00:49:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Sep 2010 00:49:43 +0000 Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id o8B0nemX003854 for ; Fri, 10 Sep 2010 17:49:40 -0700 Received: from pvg16 (pvg16.prod.google.com [10.241.210.144]) by hpaq3.eem.corp.google.com with ESMTP id o8B0nAmg017821 for ; Fri, 10 Sep 2010 17:49:38 -0700 Received: by pvg16 with SMTP id 16so1320012pvg.12 for ; Fri, 10 Sep 2010 17:49:38 -0700 (PDT) Received: by 10.143.166.11 with SMTP id t11mr380088wfo.57.1284166178204; Fri, 10 Sep 2010 17:49:38 -0700 (PDT) Received: from coign.google.com ([66.109.106.2]) by mx.google.com with ESMTPS id t18sm3884252wfc.23.2010.09.10.17.49.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Sep 2010 17:49:37 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Update to current version of master Go testsuite Date: Fri, 10 Sep 2010 17:49:30 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org gccgo uses a copy of the master Go testsuite. I have just updated that copy to the current master sources. The patch is too large to include in this message, and is largely uninteresting since it is just a copy. It may be found at SVN revision 164210. I have appended the parts of the patch which are not part of the master testsuite, which are patches to the gcc testsuite harness to run the tests. Ian Index: go.test/go-test.exp =================================================================== --- go.test/go-test.exp (revision 164030) +++ go.test/go-test.exp (working copy) @@ -42,8 +42,13 @@ proc errchk { test } { set saved-dg-do-what-default ${dg-do-what-default} set dg-do-what-default compile set filename [file tail $test] + if { "$filename" == "$test" } { + set filename "errchk-$filename" + } set fdin [open $test r] + fconfigure $fdin -encoding binary set fdout [open $filename w] + fconfigure $fdout -encoding binary while { [gets $fdin copy_line] >= 0 } { regsub "// \(GCCGO_\)?ERROR \"\(\[^\"\]*\)\".*$" $copy_line "// \{ dg-error \"\\2\" \}" out_line if [string match "*dg-error*.\**" $out_line] { @@ -55,7 +60,12 @@ proc errchk { test } { set index [string first "dg-error" $out_line] regsub -start $index -all "\{" $out_line "\\\\\[\\\{\\\\\]" out_line } + if [string match "*dg-error*\}*\}" $out_line] { + set index [string first "dg-error" $out_line] + regsub -start $index -all "\}\(.\)" $out_line "\\\\\[\\\}\\\\\]\\1" out_line + } if [string match "*dg-error*\[.\]*" $out_line] { + set index [string first "dg-error" $out_line] regsub -all "\\\[\\.\\\]" $out_line "\\\\\[.\\\\\]" out_line } puts $fdout $out_line @@ -116,10 +126,13 @@ proc go-gc-tests { } { continue } - # Skip the files in bench; they are not tests. + # Skip the files in bench and garbage; they are not tests. if [string match "*go.test/test/bench/*" $test] { continue } + if [string match "*go.test/test/garbage/*" $test] { + continue + } # Skip files in sub-subdirectories: they are components of # other tests. @@ -151,21 +164,35 @@ proc go-gc-tests { } { } set fd [open $test r] - if { [gets $fd test_line] < 0 } { - close $fd - clone_output "$test: could not read first line" - unresolved $name - continue + + set lines_ok 1 + + while 1 { + if { [gets $fd test_line] < 0 } { + close $fd + clone_output "$test: could not read first line" + unresolved $name + set lines_ok 0 + break + } + + if { [ string match "*nacl*exit 0*" $test_line ] \ + || [ string match "*exit 0*nacl*" $test_line ] \ + || [ string match "*Android*exit 0*" $test_line ] \ + || [ string match "*exit 0*Android*" $test_line ] } { + continue + } + + break } - if { [gets $fd test_line2] < 0 } { - close $fd - clone_output "$test: could not read second line" - unresolved $name + + if { $lines_ok == 0 } { continue } - set lines_ok 1 - set lineno 2 + set lineno 1 + set test_line1 $test_line + while { [eval "string match \"//*&&\" \${test_line$lineno}"] } { set lineno [expr $lineno + 1] if { [eval "gets \$fd test_line$lineno"] < 0 } { @@ -304,13 +331,25 @@ proc go-gc-tests { } { set runtests $hold_runtests } elseif { [string match \ "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \ - $test_line] } { + $test_line] \ + || [string match \ + "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \ + $test_line] } { + if { [string match \ + "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \ + $test_line] } { + set name1 "p1.go" + set name2 "p2.go" + } else { + set name1 "bug0.go" + set name2 "bug1.go" + } set hold_runtests $runtests set runtests "go-test.exp" set dg-do-what-default "assemble" - regsub "\\.go$" $test ".dir/bug0.go" file1 + regsub "\\.go$" $test ".dir/$name1" file1 dg-test -keep-output $file1 "-O" "-w $DEFAULT_GOFLAGS" - regsub "\\.go$" $test ".dir/bug1.go" file2 + regsub "\\.go$" $test ".dir/$name2" file2 errchk $file2 file delete "[file rootname [file tail $file1]].o" set runtests $hold_runtests @@ -532,8 +571,88 @@ proc go-gc-tests { } { } file delete $ofile1 $ofile2 $output_file set runtests $hold_runtests + } elseif { $test_line == "// \$G \$D/\$F.go \$D/cmplxdivide1.go && \$L \$D/\$F.\$A && ./\$A.out" } { + regsub "/\[^/\]*$" $test "/cmplxdivide1.go" test2 + set output_file "./[file rootname [file tail $test]].o" + set comp_output [go_target_compile "$test $test2" \ + $output_file "executable" "$DEFAULT_GOFLAGS"] + set comp_output [go-dg-prune $target_triplet $comp_output] + if [string match "" $comp_output] { + set result [go_load "$output_file" "" ""] + set status [lindex $result 0] + $status $name + } else { + verbose -log $comp_output + fail $name + } + file delete $output_file + } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A &&" \ + && $test_line2 == "// ./\$A.out -pass 0 >tmp.go && \$G tmp.go && \$L -o tmp1.\$A tmp.\$A && ./tmp1.\$A &&" \ + && $test_line3 == "// ./\$A.out -pass 1 >tmp.go && errchk \$G -e tmp.go &&" \ + && $test_line4 == "// ./\$A.out -pass 2 >tmp.go && errchk \$G -e tmp.go" } { + set go_execute_args "" + set hold_runtests $runtests + set runtests "go-test.exp" + set dg-do-what-default "link" + dg-test -keep-output $test "-O" "-w $DEFAULT_GOFLAGS" + set output_file "./[file rootname [file tail $test]].exe" + if [isnative] { + if { [catch "exec $output_file -pass 0 >tmp.go"] != 0 } { + fail "$name execution 0" + } else { + pass "$name execution 0" + file delete tmp.x + go-torture-execute "./tmp.go" + } + if { [catch "exec $output_file -pass 1 >tmp.go"] != 0 } { + fail "$name execution 1" + } else { + pass "$name execution 1" + errchk tmp.go + } + if { [catch "exec $output_file -pass 2 >tmp.go"] != 0 } { + fail "$name execution 2" + } else { + pass "$name execution 2" + errchk tmp.go + } + file delete tmp.go + } + file delete $output_file + set runtests $hold_runtests + } elseif { $test_line == "// \$G \$D/\$F.go && \$L \$F.\$A && ./\$A.out >tmp.go &&" \ + && $test_line2 == "// errchk \$G -e tmp.go" } { + set go_execute_args "" + set hold_runtests $runtests + set runtests "go-test.exp" + set dg-do-what-default "link" + dg-test -keep-output $test "-O" "-w $DEFAULT_GOFLAGS" + set output_file "./[file rootname [file tail $test]].exe" + if [isnative] { + if { [catch "exec $output_file >tmp.go"] != 0 } { + fail "$name execution" + } else { + pass "$name execution" + file delete tmp.x + errchk tmp.go + } + } + file delete $output_file + set runtests $hold_runtests + } elseif { $test_line == "// # generated by cmplxdivide.c" } { + # Ignore. + } elseif { $test_line == "// \$G \$D/bug302.dir/p.go && gopack grc pp.a p.\$A && \$G \$D/bug302.dir/main.go" \ + || $test_line == "// \$G \$D/empty.go && errchk \$G \$D/\$F.go" } { + # These tests import the same package under two different + # names, which gccgo does not support. + } elseif { $test_line == "// \$G -S \$D/\$F.go | egrep initdone >/dev/null && echo FAIL || true" } { + # This tests whether initializers are written out + # statically. gccgo does not provide a way to test that, + # as an initializer will be generated for any code which + # has global variables which need to be registered as GC + # roots. } else { - clone_output "Unrecognized test line: $test_line" + clone_output "$name: unrecognized test line: $test_line" unsupported $name } Index: lib/go-torture.exp =================================================================== --- lib/go-torture.exp (revision 163684) +++ lib/go-torture.exp (working copy) @@ -261,6 +261,14 @@ proc go-torture-execute { src } { set result [go_load "$executable" "$go_execute_args" ""] set status [lindex $result 0] set output [lindex $result 1] + + # In order to cooperate nicely with the master Go testsuite, + # if the output contains the string BUG, we treat the test as + # failing. + if [ string match "*BUG*" $output ] { + set status "fail" + } + if { $status == "pass" } { catch { remote_file build delete $executable } }