mirror of
https://github.com/golang/go
synced 2024-11-11 17:51:49 -07:00
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>
This commit is contained in:
parent
8fcf318123
commit
f1778c28a9
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js,!windows
|
||||
// +build !nacl,!js,!windows,gc
|
||||
// run
|
||||
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build linux,!ppc64,!riscv64
|
||||
// +build linux,!ppc64,!riscv64,gc
|
||||
// run
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
|
@ -1,3 +1,4 @@
|
||||
// +build gc
|
||||
// run
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js,!android
|
||||
// +build !nacl,!js,!android,gc
|
||||
// run
|
||||
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js,!android
|
||||
// +build !nacl,!js,!android,!gccgo
|
||||
// run
|
||||
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,!gccgo
|
||||
// run
|
||||
|
||||
// Copyright 2017 The Go Authors. All rights reserved.
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,!gccgo
|
||||
// run
|
||||
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,!gccgo
|
||||
// run
|
||||
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2016 The Go Authors. All rights reserved.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// +build !nacl,!js
|
||||
// +build !nacl,!js,gc
|
||||
// run
|
||||
|
||||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
|
Loading…
Reference in New Issue
Block a user