aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2020-03-12 09:29:14 -0400
committerBryan C. Mills <bcmills@google.com>2020-03-12 17:46:03 +0000
commitc4113b64c2b21e55949f7b28249f03c25bf63072 (patch)
tree4bedaf6d12e02b77d2df082b1f76ec28503f58e1 /src
parent040855e39bb471b09f3803cbca2c8d683b2bc6dc (diff)
downloadgo-c4113b64c2b21e55949f7b28249f03c25bf63072.tar.xz
cmd/go: fix test failures with -count=2
In each test, either set the -n flag to avoid writing build artifacts to the cache, or set GOCACHE explicitly to point to a clean cache. Tested manually with 'go test -count=2 cmd/go'. Fixes #37820 Change-Id: I24403e738b1a10d5fe9dc8d98ef27a76ebe2704a Reviewed-on: https://go-review.googlesource.com/c/go/+/223140 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/testdata/script/build_gcflags.txt3
-rw-r--r--src/cmd/go/testdata/script/cgo_flag_contains_space.txt9
-rw-r--r--src/cmd/go/testdata/script/gcflags_patterns.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_get_commit.txt3
-rw-r--r--src/cmd/go/testdata/script/mod_get_tags.txt3
5 files changed, 14 insertions, 6 deletions
diff --git a/src/cmd/go/testdata/script/build_gcflags.txt b/src/cmd/go/testdata/script/build_gcflags.txt
index e0accb10d5..b47237410d 100644
--- a/src/cmd/go/testdata/script/build_gcflags.txt
+++ b/src/cmd/go/testdata/script/build_gcflags.txt
@@ -7,7 +7,8 @@ env GO111MODULE=off
[!linux] skip # test only works if c-archive implies -shared
[short] skip
-go build -x -buildmode=c-archive -gcflags=all=-shared=false ./override.go
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+go build -x -n -buildmode=c-archive -gcflags=all=-shared=false ./override.go
stderr '^.*/compile (.* )?-shared (.* )?-shared=false'
-- override.go --
diff --git a/src/cmd/go/testdata/script/cgo_flag_contains_space.txt b/src/cmd/go/testdata/script/cgo_flag_contains_space.txt
index 940340e98d..a3372bbbc7 100644
--- a/src/cmd/go/testdata/script/cgo_flag_contains_space.txt
+++ b/src/cmd/go/testdata/script/cgo_flag_contains_space.txt
@@ -1,15 +1,16 @@
[short] skip
[!cgo] skip
-go run -x main.go
+env GOCACHE=$WORK/gocache # Looking for compile flags, so need a clean cache.
+go build -x -n main.go
stderr '"-I[^"]+c flags"' # find quoted c flags
-! stderr '"-I[^"]+c flags".*"-I[^"]+c flags"' # don't find too many quoted c flags
+! stderr '"-I[^"]+c flags".*"-I[^"]+c flags"' # don't find too many quoted c flags per line
stderr '"-L[^"]+ld flags"' # find quoted ld flags
-! stderr '"-L[^"]+c flags".*"-L[^"]+c flags"' # don't find too many quoted ld flags
+! stderr '"-L[^"]+c flags".*"-L[^"]+c flags"' # don't find too many quoted ld flags per line
-- main.go --
package main
// #cgo CFLAGS: -I"c flags"
// #cgo LDFLAGS: -L"ld flags"
import "C"
-func main() {} \ No newline at end of file
+func main() {}
diff --git a/src/cmd/go/testdata/script/gcflags_patterns.txt b/src/cmd/go/testdata/script/gcflags_patterns.txt
index dce8e39715..5374493a43 100644
--- a/src/cmd/go/testdata/script/gcflags_patterns.txt
+++ b/src/cmd/go/testdata/script/gcflags_patterns.txt
@@ -3,6 +3,8 @@ env GO111MODULE=off
[!gc] skip 'using -gcflags and -ldflags'
[short] skip
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+
# -gcflags=-e applies to named packages, not dependencies
go build -n -v -gcflags=-e z1 z2
stderr 'compile.* -e.* -p z1'
diff --git a/src/cmd/go/testdata/script/mod_get_commit.txt b/src/cmd/go/testdata/script/mod_get_commit.txt
index a906babbd5..d108242c70 100644
--- a/src/cmd/go/testdata/script/mod_get_commit.txt
+++ b/src/cmd/go/testdata/script/mod_get_commit.txt
@@ -14,6 +14,9 @@ go get -d golang.org/x/text@14c0d48
# dropping -d, we should see a build.
[short] skip
+
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+
go get -x golang.org/x/text/language@14c0d48
stderr 'compile|cp|gccgo .*language\.a$'
diff --git a/src/cmd/go/testdata/script/mod_get_tags.txt b/src/cmd/go/testdata/script/mod_get_tags.txt
index 603c76983f..e9869e3f02 100644
--- a/src/cmd/go/testdata/script/mod_get_tags.txt
+++ b/src/cmd/go/testdata/script/mod_get_tags.txt
@@ -14,7 +14,8 @@ stdout 'rsc.io/quote v1.5.2'
[short] skip
# Packages that are only imported in excluded files should not be built.
-go get -x .
+env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
+go get -n -x .
stderr 'compile.* -p m '
! stderr 'compile.* -p example.com/version '
! stderr 'compile.* -p rsc.io/quote '