1
0
mirror of https://github.com/golang/go synced 2024-11-26 14:08:37 -07:00

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 <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2015-07-20 08:30:45 -07:00
parent f35868a49a
commit b9a3e5979d

View 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.