From b9a3e5979d6d085f11aae63f44d82ef50356033d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 20 Jul 2015 08:30:45 -0700 Subject: [PATCH] cmd/go: build errors rather than strings in some tests Speed up the test suite by building the errors package rather than the strings package in some cases where the specific package we are building doesn't matter. The errors package is smaller, and doesn't have any assembler code. Also make a couple of tests run in parallel. Update #11779. Change-Id: I62e47f8655f9d85bf93c70ae6e6121276d96aee0 Reviewed-on: https://go-review.googlesource.com/12365 Run-TryBot: Ian Lance Taylor Reviewed-by: David Crawshaw TryBot-Result: Gobot Gobot --- src/cmd/go/go_test.go | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 93f6cadf66..eb1690e2e7 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -767,7 +767,7 @@ func TestGoInstallErrorOnCrossCompileToBin(t *testing.T) { tg.run("install", "cmd/pack") } -func TestGoInstsallDetectsRemovedFilesInPackageMain(t *testing.T) { +func TestGoInstallDetectsRemovedFilesInPackageMain(t *testing.T) { tg := testgo(t) defer tg.cleanup() tg.parallel() @@ -1422,35 +1422,37 @@ func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) { func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) { tg := testgo(t) defer tg.cleanup() - tg.creatingTemp("strings.prof") - tg.creatingTemp("strings.test" + exeSuffix) - tg.run("test", "-cpuprofile", "strings.prof", "strings") - tg.wantExecutable("strings.test"+exeSuffix, "go test -cpuprofile did not create strings.test") + tg.makeTempdir() + tg.cd(tg.path(".")) + tg.run("test", "-cpuprofile", "errors.prof", "errors") + tg.wantExecutable("errors.test"+exeSuffix, "go test -cpuprofile did not create errors.test") } -func TestGoTestCpuProfileDashOControlsBinaryLocation(t *testing.T) { +func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) { tg := testgo(t) defer tg.cleanup() - tg.creatingTemp("strings.prof") - tg.creatingTemp("mystrings.test" + exeSuffix) - tg.run("test", "-cpuprofile", "strings.prof", "-o", "mystrings.test"+exeSuffix, "strings") - tg.wantExecutable("mystrings.test"+exeSuffix, "go test -cpuprofile -o mystrings.test did not create mystrings.test") + tg.makeTempdir() + tg.cd(tg.path(".")) + tg.run("test", "-cpuprofile", "errors.prof", "-o", "myerrors.test"+exeSuffix, "errors") + tg.wantExecutable("myerrors.test"+exeSuffix, "go test -cpuprofile -o myerrors.test did not create myerrors.test") } func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) { tg := testgo(t) defer tg.cleanup() - tg.creatingTemp("mystrings.test" + exeSuffix) - tg.run("test", "-c", "-o", "mystrings.test"+exeSuffix, "strings") - tg.wantExecutable("mystrings.test"+exeSuffix, "go test -c -o mystrings.test did not create mystrings.test") + tg.parallel() + tg.makeTempdir() + tg.run("test", "-c", "-o", tg.path("myerrors.test"+exeSuffix), "errors") + tg.wantExecutable(tg.path("myerrors.test"+exeSuffix), "go test -c -o myerrors.test did not create myerrors.test") } func TestGoTestDashOWritesBinary(t *testing.T) { tg := testgo(t) defer tg.cleanup() - tg.creatingTemp("mystrings.test" + exeSuffix) - tg.run("test", "-o", "mystrings.test"+exeSuffix, "strings") - tg.wantExecutable("mystrings.test"+exeSuffix, "go test -o mystrings.test did not create mystrings.test") + tg.parallel() + tg.makeTempdir() + tg.run("test", "-o", tg.path("myerrors.test"+exeSuffix), "errors") + tg.wantExecutable(tg.path("myerrors.test"+exeSuffix), "go test -o myerrors.test did not create myerrors.test") } // Issue 4568. -- 2.50.0