aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2020-01-10 11:27:08 -0500
committerMichael Matloob <matloob@golang.org>2020-02-19 21:00:02 +0000
commit1bf9d3cc5b0a0703cd1ecc569ee89c924cbc08bb (patch)
tree93f94d3ca35d7c99a8ef8092c248f3df51e03f2a /src
parent250c06f54e0c6c155b5e384fd112f2fa42a2bff3 (diff)
downloadgo-1bf9d3cc5b0a0703cd1ecc569ee89c924cbc08bb.tar.xz
cmd/go: convert TestGoTest(Cpu|Mutex)profile.* to script framework
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: Ie8b54b272e8a04720e437a37a5e5b0afd73481b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/214285 Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/go/go_test.go48
-rw-r--r--src/cmd/go/testdata/script/test_profile.txt19
2 files changed, 19 insertions, 48 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index d944ff7daf..fed6487357 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -1527,54 +1527,6 @@ func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) {
tg.grepStderr("^hello world", `ldflags -X "main.extern=hello world"' failed`)
}
-func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) {
- skipIfGccgo(t, "gccgo has no standard packages")
- tooSlow(t)
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- 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) {
- skipIfGccgo(t, "gccgo has no standard packages")
- tooSlow(t)
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- 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 TestGoTestMutexprofileLeavesBinaryBehind(t *testing.T) {
- skipIfGccgo(t, "gccgo has no standard packages")
- tooSlow(t)
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- tg.makeTempdir()
- tg.cd(tg.path("."))
- tg.run("test", "-mutexprofile", "errors.prof", "errors")
- tg.wantExecutable("errors.test"+exeSuffix, "go test -mutexprofile did not create errors.test")
-}
-
-func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) {
- skipIfGccgo(t, "gccgo has no standard packages")
- tooSlow(t)
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- tg.makeTempdir()
- tg.cd(tg.path("."))
- tg.run("test", "-mutexprofile", "errors.prof", "-o", "myerrors.test"+exeSuffix, "errors")
- tg.wantExecutable("myerrors.test"+exeSuffix, "go test -mutexprofile -o myerrors.test did not create myerrors.test")
-}
-
func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) {
skipIfGccgo(t, "gccgo has no standard packages")
tooSlow(t)
diff --git a/src/cmd/go/testdata/script/test_profile.txt b/src/cmd/go/testdata/script/test_profile.txt
new file mode 100644
index 0000000000..4bfa2cc493
--- /dev/null
+++ b/src/cmd/go/testdata/script/test_profile.txt
@@ -0,0 +1,19 @@
+[gccgo] skip 'gccgo has no standard packages'
+[short] skip
+
+# Check go test -cpuprofile creates errors.test
+go test -cpuprofile errors.prof errors
+exists -exec errors.test$GOEXE
+
+# Check go test -cpuprofile -o myerrors.test creates errors.test
+go test -cpuprofile errors.prof -o myerrors.test$GOEXE errors
+exists -exec myerrors.test$GOEXE
+
+# Check go test -mutexprofile creates errors.test
+go test -mutexprofile errors.prof errors
+exists -exec errors.test$GOEXE
+
+# Check go test -mutexprofile -o myerrors.test creates errors.test
+go test -mutexprofile errors.prof -o myerrors.test$GOEXE errors
+exists -exec myerrors.test$GOEXE
+