From: Michael Matloob Date: Thu, 26 Dec 2019 20:03:12 +0000 (-0500) Subject: cmd/go: parallellize more test cases X-Git-Tag: go1.14rc1~167 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=57b22c51162035a52fdf09f043b1fed63faa28bc;p=gostls13.git cmd/go: parallellize more test cases Sprinkle in some more calls to tg.Parallel in the cmd/go tests. These are the easy cases that don't operate in the testdata directory. I think the best thing to do for those tests that do operate in testdata is to use the script tests. They're easier to read and write, and jump into t.Parallel immediately. Updates #17751 Change-Id: If8aeb8129cfdc0a9aa91f5a540f179790077fce5 Reviewed-on: https://go-review.googlesource.com/c/go/+/212618 Run-TryBot: Michael Matloob TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod --- diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 626fd46c36..5494fd1adc 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -913,6 +913,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() // Copy the runtime packages into a temporary GOROOT // so that we can change files. @@ -1641,6 +1642,7 @@ func TestDefaultGOPATHGet(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.setenv("GOPATH", "") tg.tempDir("home") tg.setenv(homeEnvName(), tg.path("home")) @@ -1665,6 +1667,7 @@ func TestDefaultGOPATHGet(t *testing.T) { func TestDefaultGOPATHPrintedSearchList(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.setenv("GOPATH", "") tg.tempDir("home") tg.setenv(homeEnvName(), tg.path("home")) @@ -2363,6 +2366,8 @@ func TestCgoDependsOnSyscall(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() + files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race")) tg.must(err) for _, file := range files { @@ -3724,7 +3729,7 @@ func TestMatchesOnlyBenchmarkIsOK(t *testing.T) { func TestBenchmarkLabels(t *testing.T) { tg := testgo(t) defer tg.cleanup() - // TODO: tg.parallel() + tg.parallel() tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) tg.run("test", "-run", "^$", "-bench", ".", "bench") tg.grepStdout(`(?m)^goos: `+runtime.GOOS, "go test did not print goos") @@ -4279,6 +4284,7 @@ func TestBuildmodePIE(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("main.go", `package main; func main() { print("hello") }`) src := tg.path("main.go") @@ -4442,6 +4448,7 @@ func TestUpxCompression(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("main.go", `package main; import "fmt"; func main() { fmt.Print("hello upx") }`) src := tg.path("main.go") @@ -4980,6 +4987,7 @@ func init() {} func TestBadCommandLines(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("src/x/x.go", "package x\n") tg.setenv("GOPATH", tg.path(".")) @@ -5200,6 +5208,7 @@ func TestCgoCache(t *testing.T) { func TestFilepathUnderCwdFormat(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.run("test", "-x", "-cover", "log") tg.grepStderrNot(`\.log\.cover\.go`, "-x output should contain correctly formatted filepath under cwd") }