aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-04-05 10:57:03 -0400
committerRuss Cox <rsc@golang.org>2017-04-05 20:34:07 +0000
commit853d533ed60a023389e155a6cb0b412b278183e6 (patch)
tree65e186f0069d575a8a6a337d498e76b3161dcd78
parent166f2159d8fef1f52a6529a59070bcdf44c6e4d4 (diff)
downloadgo-853d533ed60a023389e155a6cb0b412b278183e6.tar.gz
go-853d533ed60a023389e155a6cb0b412b278183e6.zip
[release-branch.go1.8] cmd/go: add test for test -race -i behavior
This was fixed in CL 37598 but the test was (rightly) dropped because it modified $GOROOT. Here's a variant that does not. For #19151. Change-Id: Iccdbbf9ae8ac4c252e52f4f8ff996963573c4682 Reviewed-on: https://go-review.googlesource.com/39592 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/39618 Reviewed-by: Austin Clements <austin@google.com>
-rw-r--r--src/cmd/go/go_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 56de65ce55..fa78578d12 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -2227,6 +2227,24 @@ func TestTestEmpty(t *testing.T) {
}
}
+func TestTestRaceInstall(t *testing.T) {
+ if !canRace {
+ t.Skip("no race detector")
+ }
+
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
+
+ tg.tempDir("pkg")
+ pkgdir := tg.path("pkg")
+ tg.run("install", "-race", "-pkgdir="+pkgdir, "std")
+ tg.run("test", "-race", "-pkgdir="+pkgdir, "-i", "-v", "empty/pkg")
+ if tg.getStderr() != "" {
+ t.Error("go test -i -race: rebuilds cached packages")
+ }
+}
+
func TestBuildDryRunWithCgo(t *testing.T) {
if !canCgo {
t.Skip("skipping because cgo not enabled")