aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-17 14:03:07 -0800
committerIan Lance Taylor <iant@golang.org>2020-12-18 00:10:44 +0000
commitf1778c28a9c6a898e9d78207847d61b189c49b5c (patch)
tree9bd31f79613c5f2f3b805e2d15d7d173d89ae6d6 /test
parent8fcf318123e15abf6ce35e33831bdb64a4e071ff (diff)
downloadgo-f1778c28a9c6a898e9d78207847d61b189c49b5c.tar.gz
go-f1778c28a9c6a898e9d78207847d61b189c49b5c.zip
test: recognize and use gc build tag
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>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/bug302.go2
-rw-r--r--test/fixedbugs/bug369.go2
-rw-r--r--test/fixedbugs/issue10607.go2
-rw-r--r--test/fixedbugs/issue11771.go2
-rw-r--r--test/fixedbugs/issue13268.go1
-rw-r--r--test/fixedbugs/issue14636.go2
-rw-r--r--test/fixedbugs/issue16037_run.go2
-rw-r--r--test/fixedbugs/issue19658.go2
-rw-r--r--test/fixedbugs/issue21317.go6
-rw-r--r--test/fixedbugs/issue21576.go2
-rw-r--r--test/fixedbugs/issue22660.go6
-rw-r--r--test/fixedbugs/issue22662b.go6
-rw-r--r--test/fixedbugs/issue33275_run.go2
-rw-r--r--test/fixedbugs/issue33555.go2
-rw-r--r--test/fixedbugs/issue36437.go2
-rw-r--r--test/fixedbugs/issue9355.go6
-rw-r--r--test/fixedbugs/issue9862_run.go2
-rw-r--r--test/linkobj.go2
-rw-r--r--test/linkx_run.go2
-rw-r--r--test/nosplit.go2
-rw-r--r--test/run.go2
-rw-r--r--test/sinit_run.go2
22 files changed, 22 insertions, 37 deletions
diff --git a/test/fixedbugs/bug302.go b/test/fixedbugs/bug302.go
index 87f9d4ef70c..a2ab661277a 100644
--- a/test/fixedbugs/bug302.go
+++ b/test/fixedbugs/bug302.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2010 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/bug369.go b/test/fixedbugs/bug369.go
index 9316f7aad0b..83f638d0463 100644
--- a/test/fixedbugs/bug369.go
+++ b/test/fixedbugs/bug369.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!windows
+// +build !nacl,!js,!windows,gc
// run
// Copyright 2011 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue10607.go b/test/fixedbugs/issue10607.go
index 6f4717d8202..448a37dcac2 100644
--- a/test/fixedbugs/issue10607.go
+++ b/test/fixedbugs/issue10607.go
@@ -1,4 +1,4 @@
-// +build linux,!ppc64,!riscv64
+// +build linux,!ppc64,!riscv64,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue11771.go b/test/fixedbugs/issue11771.go
index 99d7060d44e..c95dd6ba396 100644
--- a/test/fixedbugs/issue11771.go
+++ b/test/fixedbugs/issue11771.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue13268.go b/test/fixedbugs/issue13268.go
index fcb69c90682..53a82d5074a 100644
--- a/test/fixedbugs/issue13268.go
+++ b/test/fixedbugs/issue13268.go
@@ -1,3 +1,4 @@
+// +build gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue14636.go b/test/fixedbugs/issue14636.go
index 6797046e02b..06fd193dae0 100644
--- a/test/fixedbugs/issue14636.go
+++ b/test/fixedbugs/issue14636.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,gc
// run
// Copyright 2016 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue16037_run.go b/test/fixedbugs/issue16037_run.go
index d05e3f7f314..68104a90007 100644
--- a/test/fixedbugs/issue16037_run.go
+++ b/test/fixedbugs/issue16037_run.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android
+// +build !nacl,!js,!android,!gccgo
// run
// Copyright 2016 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue19658.go b/test/fixedbugs/issue19658.go
index b2539629df0..bab409c6c03 100644
--- a/test/fixedbugs/issue19658.go
+++ b/test/fixedbugs/issue19658.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2017 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue21317.go b/test/fixedbugs/issue21317.go
index f4ec4223713..32b660c1639 100644
--- a/test/fixedbugs/issue21317.go
+++ b/test/fixedbugs/issue21317.go
@@ -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)
diff --git a/test/fixedbugs/issue21576.go b/test/fixedbugs/issue21576.go
index ae6161ccf52..3f9b1ba008a 100644
--- a/test/fixedbugs/issue21576.go
+++ b/test/fixedbugs/issue21576.go
@@ -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
diff --git a/test/fixedbugs/issue22660.go b/test/fixedbugs/issue22660.go
index 44ba42ac968..9ce9c4d732e 100644
--- a/test/fixedbugs/issue22660.go
+++ b/test/fixedbugs/issue22660.go
@@ -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)
diff --git a/test/fixedbugs/issue22662b.go b/test/fixedbugs/issue22662b.go
index 0fcfe8d0db6..8da17679be0 100644
--- a/test/fixedbugs/issue22662b.go
+++ b/test/fixedbugs/issue22662b.go
@@ -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)
diff --git a/test/fixedbugs/issue33275_run.go b/test/fixedbugs/issue33275_run.go
index f3e2e14f392..ed03dccf4c8 100644
--- a/test/fixedbugs/issue33275_run.go
+++ b/test/fixedbugs/issue33275_run.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2019 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue33555.go b/test/fixedbugs/issue33555.go
index 7debd2049cd..c1fcd2a79b3 100644
--- a/test/fixedbugs/issue33555.go
+++ b/test/fixedbugs/issue33555.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!gccgo
// run
// Copyright 2019 The Go Authors. All rights reserved.
diff --git a/test/fixedbugs/issue36437.go b/test/fixedbugs/issue36437.go
index f96544beff8..c7a11d27a89 100644
--- a/test/fixedbugs/issue36437.go
+++ b/test/fixedbugs/issue36437.go
@@ -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
diff --git a/test/fixedbugs/issue9355.go b/test/fixedbugs/issue9355.go
index ab3369d415d..319a2a90df9 100644
--- a/test/fixedbugs/issue9355.go
+++ b/test/fixedbugs/issue9355.go
@@ -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)
diff --git a/test/fixedbugs/issue9862_run.go b/test/fixedbugs/issue9862_run.go
index 299e8095450..c956c7f7bd5 100644
--- a/test/fixedbugs/issue9862_run.go
+++ b/test/fixedbugs/issue9862_run.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2015 The Go Authors. All rights reserved.
diff --git a/test/linkobj.go b/test/linkobj.go
index 2902d23f4b8..4c9bd24568b 100644
--- a/test/linkobj.go
+++ b/test/linkobj.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2016 The Go Authors. All rights reserved.
diff --git a/test/linkx_run.go b/test/linkx_run.go
index f25053bf28e..ccfc3a93dff 100644
--- a/test/linkx_run.go
+++ b/test/linkx_run.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.
diff --git a/test/nosplit.go b/test/nosplit.go
index a3f2a9fb7eb..faa7b8c2d85 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -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.
diff --git a/test/run.go b/test/run.go
index 4abf32d25c8..db3e9f6c2fc 100644
--- a/test/run.go
+++ b/test/run.go
@@ -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
}
diff --git a/test/sinit_run.go b/test/sinit_run.go
index c37fc9b88c8..dcaf3383312 100644
--- a/test/sinit_run.go
+++ b/test/sinit_run.go
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,gc
// run
// Copyright 2014 The Go Authors. All rights reserved.