]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: parallellize more test cases
authorMichael Matloob <matloob@golang.org>
Thu, 26 Dec 2019 20:03:12 +0000 (15:03 -0500)
committerMichael Matloob <matloob@golang.org>
Mon, 6 Jan 2020 17:26:08 +0000 (17:26 +0000)
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 <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/go_test.go

index 626fd46c36d70ec79627e9c9dac86c9320915da6..5494fd1adc45702d9dad209122f4e97a0781c0cf 100644 (file)
@@ -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")
 }