]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: build errors rather than strings in some tests
authorIan Lance Taylor <iant@golang.org>
Mon, 20 Jul 2015 15:30:45 +0000 (08:30 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 20 Jul 2015 15:57:05 +0000 (15:57 +0000)
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 <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/go_test.go

index 93f6cadf66e671042a73aebc701519132de46f09..eb1690e2e7829b16b53b89e0c9228e553bd84b38 100644 (file)
@@ -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.