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 87f9d4ef70..a2ab661277 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 9316f7aad0..83f638d046 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 6f4717d820..448a37dcac 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 99d7060d44..c95dd6ba39 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 fcb69c9068..53a82d5074 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 6797046e02..06fd193dae 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 d05e3f7f31..68104a9000 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 b2539629df..bab409c6c0 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 f4ec422371..32b660c163 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 ae6161ccf5..3f9b1ba008 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 44ba42ac96..9ce9c4d732 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 0fcfe8d0db..8da17679be 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 f3e2e14f39..ed03dccf4c 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 7debd2049c..c1fcd2a79b 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 f96544beff..c7a11d27a8 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 ab3369d415..319a2a90df 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 299e809545..c956c7f7bd 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 2902d23f4b..4c9bd24568 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 f25053bf28..ccfc3a93df 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 a3f2a9fb7e..faa7b8c2d8 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 4abf32d25c..db3e9f6c2f 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 c37fc9b88c..dcaf338331 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.