mirror of
https://github.com/golang/go
synced 2024-11-23 02:10:03 -07:00
cmd/go: go test -race -i runtime/race must not install race-enabled cmd/cgo
Fix now uses same test as 'go build'. Fixes #10500. Change-Id: I2fcf2d95430643370aa29165d89a188988dee446 Reviewed-on: https://go-review.googlesource.com/12174 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
91a480c325
commit
6ab582a80d
@ -2077,3 +2077,20 @@ func TestGoInstallPkgdir(t *testing.T) {
|
||||
_, err = os.Stat(filepath.Join(pkg, "runtime.a"))
|
||||
tg.must(err)
|
||||
}
|
||||
|
||||
func TestGoTestRaceInstallCgo(t *testing.T) {
|
||||
// golang.org/issue/10500.
|
||||
// This used to install a race-enabled cgo.
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.run("tool", "-n", "cgo")
|
||||
cgo := strings.TrimSpace(tg.stdout.String())
|
||||
old, err := os.Stat(cgo)
|
||||
tg.must(err)
|
||||
tg.run("test", "-race", "-i", "runtime/race")
|
||||
new, err := os.Stat(cgo)
|
||||
tg.must(err)
|
||||
if new.ModTime() != old.ModTime() {
|
||||
t.Fatalf("go test -i runtime/race reinstalled cmd/cgo")
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ func runTest(cmd *Command, args []string) {
|
||||
if deps["C"] {
|
||||
delete(deps, "C")
|
||||
deps["runtime/cgo"] = true
|
||||
if buildContext.GOOS == runtime.GOOS && buildContext.GOARCH == runtime.GOARCH {
|
||||
if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace {
|
||||
deps["cmd/cgo"] = true
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user