diff options
-rw-r--r-- | src/cmd/go/go_test.go | 18 |
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") |