]> Cypherpunks repositories - gostls13.git/commitdiff
test: recognize and use gc build tag
authorIan Lance Taylor <iant@golang.org>
Thu, 17 Dec 2020 22:03:07 +0000 (14:03 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 18 Dec 2020 00:10:44 +0000 (00:10 +0000)
Change the run.go driver to recognize the "gc" build tag.

Change existing tests to use the "gc" build tag if they use some
feature that seems specific to the gc compiler, such as passing specific
options to or expecting specific behavior from "go tool compile".
Change tests to use the "!gccgo" build tag if they use "go build" or
"go run", as while those might work with compilers other than gc, they
won't work with the way that gccgo runs its testsuite (which happens
independently of the go command).

For #43252

Change-Id: I666e04b6d7255a77dfc256ee304094e3a6bb15ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/279052
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
22 files changed:
test/fixedbugs/bug302.go
test/fixedbugs/bug369.go
test/fixedbugs/issue10607.go
test/fixedbugs/issue11771.go
test/fixedbugs/issue13268.go
test/fixedbugs/issue14636.go
test/fixedbugs/issue16037_run.go
test/fixedbugs/issue19658.go
test/fixedbugs/issue21317.go
test/fixedbugs/issue21576.go
test/fixedbugs/issue22660.go
test/fixedbugs/issue22662b.go
test/fixedbugs/issue33275_run.go
test/fixedbugs/issue33555.go
test/fixedbugs/issue36437.go
test/fixedbugs/issue9355.go
test/fixedbugs/issue9862_run.go
test/linkobj.go
test/linkx_run.go
test/nosplit.go
test/run.go
test/sinit_run.go

index 87f9d4ef70ccc1ddc0cc6f3a528fc161294d9402..a2ab661277a38ff40b45c1c73232d25502f91bb5 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2010 The Go Authors. All rights reserved.
index 9316f7aad0b1df71d896b56ad0e02d6c37d3c108..83f638d04632af0dafaff07c4c6324fad14c79b7 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!windows
+// +build !nacl,!js,!windows,gc
 // run
 
 // Copyright 2011 The Go Authors. All rights reserved.
index 6f4717d8202ff1dee40ee30862e8045364e32157..448a37dcac24d6ec6c5a0b21ab554224805b614a 100644 (file)
@@ -1,4 +1,4 @@
-// +build linux,!ppc64,!riscv64
+// +build linux,!ppc64,!riscv64,gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index 99d7060d44e4b45f41940bc869492ca0a4e49737..c95dd6ba3965849ac2432eaa1494a67d209dc972 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index fcb69c90682f9338a4392610707148909ae790e1..53a82d5074ab97af601fee7bcb70ba84d60ff67a 100644 (file)
@@ -1,3 +1,4 @@
+// +build gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index 6797046e02b66d478cd7da9374762a5663b0576f..06fd193dae0ba1d8c60085f7511b618887248646 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,gc
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index d05e3f7f3143cf2ec005ecff2b8fac20c6e44d91..68104a9000795d835154d476a840c5dc95429220 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,!gccgo
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index b2539629df0c45ad3a349db4068726b6c1e55b1b..bab409c6c03cc86d64ae51ef3bb51a09d77f2d6a 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
 // run
 
 // Copyright 2017 The Go Authors. All rights reserved.
index f4ec422371349079eda33dbd999fc9b493bdd7ce..32b660c1639169262c16826024369d3e04d0a088 100644 (file)
@@ -1,3 +1,4 @@
+// +build !js,gc
 // run
 
 // Copyright 2017 The Go Authors. All rights reserved.
@@ -16,15 +17,10 @@ import (
        "log"
        "os"
        "os/exec"
-       "runtime"
        "strings"
 )
 
 func main() {
-       if runtime.Compiler != "gc" || runtime.GOOS == "js" {
-               return
-       }
-
        f, err := ioutil.TempFile("", "issue21317.go")
        if err != nil {
                log.Fatal(err)
index ae6161ccf52d3926a8030607f231e3b7511900fb..3f9b1ba008af4cfee4cd502d844925101ec04764 100644 (file)
@@ -1,6 +1,6 @@
 // run
 
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
 
 // Copyright 2019 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 44ba42ac968cca00dc93b8476e8954ae063399c1..9ce9c4d732e6d4b6cffb4f85e53ed3a005cdcea3 100644 (file)
@@ -1,3 +1,4 @@
+// +build !js,gc
 // run
 
 // Copyright 2017 The Go Authors. All rights reserved.
@@ -14,15 +15,10 @@ import (
        "os"
        "os/exec"
        "path/filepath"
-       "runtime"
        "strings"
 )
 
 func main() {
-       if runtime.GOOS == "js" {
-               return // no file system available on builders
-       }
-
        f, err := ioutil.TempFile("", "issue22660.go")
        if err != nil {
                log.Fatal(err)
index 0fcfe8d0db6d9440a4f1582e904d40bb2b88638e..8da17679be08e9f58047df4cdd8de94a46542738 100644 (file)
@@ -1,3 +1,4 @@
+// +build !js,gc
 // run
 
 // Copyright 2018 The Go Authors. All rights reserved.
@@ -13,7 +14,6 @@ import (
        "log"
        "os"
        "os/exec"
-       "runtime"
        "strings"
 )
 
@@ -36,10 +36,6 @@ var tests = []struct {
 }
 
 func main() {
-       if runtime.GOOS == "js" {
-               return // can not exec go tool
-       }
-
        f, err := ioutil.TempFile("", "issue22662b.go")
        if err != nil {
                log.Fatal(err)
index f3e2e14f392eb7177dacdced583902b99b545e5f..ed03dccf4c8086bb8253ae1e4f029d9fd7dc57b6 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
 // run
 
 // Copyright 2019 The Go Authors. All rights reserved.
index 7debd2049cd956468b9022951e1074e37abd439b..c1fcd2a79b387a8b23020bc42c2cf666471bee6d 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
 // run
 
 // Copyright 2019 The Go Authors. All rights reserved.
index f96544beff810846c657725a8b19194c505a3edb..c7a11d27a8934985d1bc975d7a60f4e96d793746 100644 (file)
@@ -1,6 +1,6 @@
 // run
 
-// +build !nacl,!js
+// +build !nacl,!js,gc
 
 // Copyright 2020 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index ab3369d415df19165c8d5be13084e66bb17192d2..319a2a90df9ba26c8725fe179abe6e349262afb8 100644 (file)
@@ -1,3 +1,4 @@
+// +build !js,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
@@ -13,14 +14,9 @@ import (
        "os/exec"
        "path/filepath"
        "regexp"
-       "runtime"
 )
 
 func main() {
-       if runtime.Compiler != "gc" || runtime.GOOS == "js" {
-               return
-       }
-
        err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
        check(err)
 
index 299e8095450d8a97f0e27898c876ba8f1c6a1123..c956c7f7bd50f3aa0445ea1f5f994421dfc28b24 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index 2902d23f4b867074ba3b8d37a275507f3d5cfc41..4c9bd24568b112a9bbd6a01d4d02ccaebf64e505 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index f25053bf28e9c1b7502ba42c6a8f5356a86d80da..ccfc3a93dff14e0ea52872ac9f684ba981bee1f9 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index a3f2a9fb7eba4ecf5154b00278c2542d03c279e8..faa7b8c2d8583b13aa647335419e42dec4781ed9 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!aix,!gcflags_noopt
+// +build !nacl,!js,!aix,!gcflags_noopt,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index 4abf32d25c8b6755d9d36e942d40579ac111dcc8..db3e9f6c2fc18040fc63b81c27375b90c53031d1 100644 (file)
@@ -438,7 +438,7 @@ func (ctxt *context) match(name string) bool {
                }
        }
 
-       if name == ctxt.GOOS || name == ctxt.GOARCH {
+       if name == ctxt.GOOS || name == ctxt.GOARCH || name == "gc" {
                return true
        }
 
index c37fc9b88c8fc0df365a4ddc92ad8196d1b082d7..dcaf3383312602a524efb566e007ff635fa1dec4 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.