diff options
author | Kale Blankenship <kale@lemnisys.com> | 2017-01-02 13:41:39 -0800 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-01-05 00:57:43 +0000 |
commit | 2547aec42a851603fe8091677a3fc5e3a5f731cd (patch) | |
tree | 5d0f033cb09e5428c19fabdc6c751a4c0d5332eb | |
parent | 2815045a50862276082048714337f95c46e98605 (diff) | |
download | go-2547aec42a851603fe8091677a3fc5e3a5f731cd.tar.gz go-2547aec42a851603fe8091677a3fc5e3a5f731cd.zip |
cmd/go: retain test binary when go test is run with -mutexprofile
Fixes #18494
Change-Id: I8a190acae6d5f1d20d4e4e4547d84e10e8a7fe68
Reviewed-on: https://go-review.googlesource.com/34793
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r-- | src/cmd/go/go_test.go | 20 | ||||
-rw-r--r-- | src/cmd/go/testflag.go | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index f7ea6c8bbd..5727eb094e 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -1885,6 +1885,26 @@ func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) { tg.wantExecutable("myerrors.test"+exeSuffix, "go test -cpuprofile -o myerrors.test did not create myerrors.test") } +func TestGoTestMutexprofileLeavesBinaryBehind(t *testing.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) { + 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) { tg := testgo(t) defer tg.cleanup() diff --git a/src/cmd/go/testflag.go b/src/cmd/go/testflag.go index cf4d2b47ff..fa53bfcdf0 100644 --- a/src/cmd/go/testflag.go +++ b/src/cmd/go/testflag.go @@ -151,10 +151,10 @@ func testFlags(args []string) (packageNames, passToTest []string) { testBench = true case "timeout": testTimeout = value - case "blockprofile", "cpuprofile", "memprofile": + case "blockprofile", "cpuprofile", "memprofile", "mutexprofile": testProfile = true testNeedBinary = true - case "mutexprofile", "trace": + case "trace": testProfile = true case "coverpkg": testCover = true |