diff options
author | Michael Matloob <matloob@golang.org> | 2020-01-10 17:53:05 -0500 |
---|---|---|
committer | Carlos Amedee <carlos@golang.org> | 2020-06-29 20:51:58 +0000 |
commit | efed90aedc039caffb6e412e31ee2f1fa4094bce (patch) | |
tree | 8ba9b181e66876b9267f6c0ef9b255aba11fb3db | |
parent | 67d894ee652a3c6fd0a883a33b86686371b96a0e (diff) | |
download | go-efed90aedc039caffb6e412e31ee2f1fa4094bce.tar.gz go-efed90aedc039caffb6e412e31ee2f1fa4094bce.zip |
[release-branch.go1.14] cmd/go: convert TestBuildIDContainsArchModeEnv to the script framework
Part of converting all tests to script framework to improve
test parallelism.
Fixes #39824
Updates #36320
Updates #17751
Change-Id: I69c69809fb1698c8198ef3ea00103a9acb7b6ce7
Reviewed-on: https://go-review.googlesource.com/c/go/+/214387
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
(cherry picked from CL 214387)
Reviewed-on: https://go-review.googlesource.com/c/go/+/239738
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
-rw-r--r-- | src/cmd/go/go_test.go | 39 | ||||
-rw-r--r-- | src/cmd/go/testdata/script/build_cache_arch_mode.txt | 27 |
2 files changed, 27 insertions, 39 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 8ca34d49ca..de0f5957e0 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -3955,45 +3955,6 @@ func TestCgoFlagContainsSpace(t *testing.T) { tg.grepStderrNot(`"-L[^"]+c flags".*"-L[^"]+c flags"`, "found too many quoted ld flags") } -// Issue 9737: verify that GOARM and GO386 affect the computed build ID. -func TestBuildIDContainsArchModeEnv(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - - var tg *testgoData - testWith := func(before, after func()) func(*testing.T) { - return func(t *testing.T) { - tg = testgo(t) - defer tg.cleanup() - tg.tempFile("src/mycmd/x.go", `package main -func main() {}`) - tg.setenv("GOPATH", tg.path(".")) - - tg.cd(tg.path("src/mycmd")) - tg.setenv("GOOS", "linux") - before() - tg.run("install", "mycmd") - after() - tg.wantStale("mycmd", "stale dependency", "should be stale after environment variable change") - } - } - - t.Run("386", testWith(func() { - tg.setenv("GOARCH", "386") - tg.setenv("GO386", "387") - }, func() { - tg.setenv("GO386", "sse2") - })) - - t.Run("arm", testWith(func() { - tg.setenv("GOARCH", "arm") - tg.setenv("GOARM", "5") - }, func() { - tg.setenv("GOARM", "7") - })) -} - func TestListTests(t *testing.T) { tooSlow(t) var tg *testgoData diff --git a/src/cmd/go/testdata/script/build_cache_arch_mode.txt b/src/cmd/go/testdata/script/build_cache_arch_mode.txt new file mode 100644 index 0000000000..7e751d02b9 --- /dev/null +++ b/src/cmd/go/testdata/script/build_cache_arch_mode.txt @@ -0,0 +1,27 @@ +# Issue 9737: verify that GOARM and GO386 affect the computed build ID + +[short] skip + +# 386 +cd $GOPATH/src/mycmd +env GOOS=linux +env GOARCH=386 +env GO386=387 +go install mycmd +env GO386=sse2 +stale mycmd + +# arm +cd $GOPATH/src/mycmd +env GOOS=linux +env GOARCH=arm +env GOARM=5 +go install mycmd +env GOARM=7 +stale mycmd + + +-- mycmd/x.go -- +package main + +func main() {}
\ No newline at end of file |