diff options
| author | Russ Cox <rsc@golang.org> | 2017-10-30 15:28:11 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2017-10-31 13:19:15 +0000 |
| commit | 2beb173e9858c966a1db351883cfdccc8cdca583 (patch) | |
| tree | 247c00c4683d3d45a959b902484cf41409428de3 /src/internal/testenv | |
| parent | 99be9cc02cdb42d692a5889500e1b68d6155ae62 (diff) | |
| download | go-2beb173e9858c966a1db351883cfdccc8cdca583.tar.xz | |
all: respect $GO_GCFLAGS during run.bash
If the go install doesn't use the same flags as the main build
it can overwrite the installed standard library, leading to
flakiness and slow future tests.
Force uses of 'go install' etc to propagate $GO_GCFLAGS
or disable them entirely, to avoid problems.
As I understand it, the main place this happens is the ssacheck builder.
If there are other uses that need to run some of the now-disabled
tests we can reenable fixed tests in followup CLs.
Change-Id: Ib860a253539f402f8a96a3c00ec34f0bbf137c9a
Reviewed-on: https://go-review.googlesource.com/74470
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/internal/testenv')
| -rw-r--r-- | src/internal/testenv/testenv.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go index 88c93bfe70..83f0e8347a 100644 --- a/src/internal/testenv/testenv.go +++ b/src/internal/testenv/testenv.go @@ -33,6 +33,13 @@ func Builder() string { // HasGoBuild reports whether the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. func HasGoBuild() bool { + if os.Getenv("GO_GCFLAGS") != "" { + // It's too much work to require every caller of the go command + // to pass along "-gcflags="+os.Getenv("GO_GCFLAGS"). + // For now, if $GO_GCFLAGS is set, report that we simply can't + // run go build. + return false + } switch runtime.GOOS { case "android", "nacl": return false @@ -48,6 +55,9 @@ func HasGoBuild() bool { // and then run them with os.StartProcess or exec.Command. // If not, MustHaveGoBuild calls t.Skip with an explanation. func MustHaveGoBuild(t testing.TB) { + if os.Getenv("GO_GCFLAGS") != "" { + t.Skipf("skipping test: 'go build' not compatible with setting $GO_GCFLAGS") + } if !HasGoBuild() { t.Skipf("skipping test: 'go build' not available on %s/%s", runtime.GOOS, runtime.GOARCH) } |
