diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 00:05:05 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-09 00:05:05 +0000 |
commit | 0ed5972403f806f5c0c143cdfe6b55b6b0fc777b (patch) | |
tree | ab22a1380cd600e94bb14e5a7383c490ac4a13bd /gcc/testsuite/go.test/test | |
parent | 92b0c449eee3b59e8c783a05a431e3bbfc2c02fa (diff) | |
download | gcc-0ed5972403f806f5c0c143cdfe6b55b6b0fc777b.tar.gz |
* go.test/go-test.exp (go-gc-tests): Handle runoutput test type
with arguments. Handle errorcheckoutput and rundir test types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193344 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/go.test/test')
-rw-r--r-- | gcc/testsuite/go.test/test/index.go | 36 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/index0.go | 12 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/index1.go | 12 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/index2.go | 12 |
4 files changed, 49 insertions, 23 deletions
diff --git a/gcc/testsuite/go.test/test/index.go b/gcc/testsuite/go.test/test/index.go index 461c2ee4184..daab45f7a17 100644 --- a/gcc/testsuite/go.test/test/index.go +++ b/gcc/testsuite/go.test/test/index.go @@ -1,27 +1,19 @@ -// $G $D/$F.go && $L $F.$A && -// ./$A.out -pass 0 >tmp.go && $G tmp.go && $L -o $A.out1 tmp.$A && ./$A.out1 && -// ./$A.out -pass 1 >tmp.go && errchk $G -e tmp.go && -// ./$A.out -pass 2 >tmp.go && errchk $G -e tmp.go -// rm -f tmp.go $A.out1 - -// NOTE: This test is not run by 'run.go' and so not run by all.bash. -// To run this test you must use the ./run shell script. +// skip // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Generate test of index and slice bounds checks. -// The output is compiled and run. +// The actual tests are index0.go, index1.go, index2.go. package main import ( "bufio" - "flag" "fmt" "os" - "runtime" + "unsafe" ) const prolog = ` @@ -155,14 +147,13 @@ func bug() { func main() { ` -// Passes: +// pass variable set in index[012].go // 0 - dynamic checks // 1 - static checks of invalid constants (cannot assign to types) // 2 - static checks of array bounds -var pass = flag.Int("pass", 0, "which test (0,1,2)") func testExpr(b *bufio.Writer, expr string) { - if *pass == 0 { + if pass == 0 { fmt.Fprintf(b, "\ttest(func(){use(%s)}, %q)\n", expr, expr) } else { fmt.Fprintf(b, "\tuse(%s) // ERROR \"index|overflow\"\n", expr) @@ -172,12 +163,10 @@ func testExpr(b *bufio.Writer, expr string) { func main() { b := bufio.NewWriter(os.Stdout) - flag.Parse() - - if *pass == 0 { - fmt.Fprint(b, "// $G $D/$F.go && $L $F.$A && ./$A.out\n\n") + if pass == 0 { + fmt.Fprint(b, "// run\n\n") } else { - fmt.Fprint(b, "// errchk $G -e $D/$F.go\n\n") + fmt.Fprint(b, "// errorcheck\n\n") } fmt.Fprint(b, prolog) @@ -225,9 +214,10 @@ func main() { // the next pass from running. // So run it as a separate check. thisPass = 1 - } else if a == "s" && n == "" && (i == "i64big" || i == "i64bigger") && runtime.GOARCH == "amd64" { - // On amd64, these huge numbers do fit in an int, so they are not - // rejected at compile time. + } else if a == "s" && n == "" && (i == "i64big" || i == "i64bigger") && unsafe.Sizeof(int(0)) > 4 { + // If int is 64 bits, these huge + // numbers do fit in an int, so they + // are not rejected at compile time. thisPass = 0 } else { thisPass = 2 @@ -240,7 +230,7 @@ func main() { } // Only print the test case if it is appropriate for this pass. - if thisPass == *pass { + if thisPass == pass { pae := p+a+e+big cni := c+n+i diff --git a/gcc/testsuite/go.test/test/index0.go b/gcc/testsuite/go.test/test/index0.go new file mode 100644 index 00000000000..04a16198d2a --- /dev/null +++ b/gcc/testsuite/go.test/test/index0.go @@ -0,0 +1,12 @@ +// runoutput ./index.go + +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Generate test of index and slice bounds checks. +// The output is compiled and run. + +package main + +const pass = 0 diff --git a/gcc/testsuite/go.test/test/index1.go b/gcc/testsuite/go.test/test/index1.go new file mode 100644 index 00000000000..e28efa35f1d --- /dev/null +++ b/gcc/testsuite/go.test/test/index1.go @@ -0,0 +1,12 @@ +// errorcheckoutput ./index.go + +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Generate test of index and slice bounds checks. +// The output is error checked. + +package main + +const pass = 1 diff --git a/gcc/testsuite/go.test/test/index2.go b/gcc/testsuite/go.test/test/index2.go new file mode 100644 index 00000000000..a7107cc0510 --- /dev/null +++ b/gcc/testsuite/go.test/test/index2.go @@ -0,0 +1,12 @@ +// errorcheckoutput ./index.go + +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Generate test of index and slice bounds checks. +// The output is error checked. + +package main + +const pass = 2 |