Commit 57b22c51 authored by Michael Matloob's avatar Michael Matloob

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 <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent db669723
......@@ -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")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment