tg.grepStdout(`ok\s+vetfail/p2`, "did not run vetfail/p2")
}
+func TestTestRebuild(t *testing.T) {
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.parallel()
+
+ // golang.org/issue/23701.
+ // b_test imports b with augmented method from export_test.go.
+ // b_test also imports a, which imports b.
+ // Must not accidentally see un-augmented b propagate through a to b_test.
+ tg.tempFile("src/a/a.go", `package a
+ import "b"
+ type Type struct{}
+ func (*Type) M() b.T {return 0}
+ `)
+ tg.tempFile("src/b/b.go", `package b
+ type T int
+ type I interface {M() T}
+ `)
+ tg.tempFile("src/b/export_test.go", `package b
+ func (*T) Method() *T { return nil }
+ `)
+ tg.tempFile("src/b/b_test.go", `package b_test
+ import (
+ "testing"
+ "a"
+ . "b"
+ )
+ func TestBroken(t *testing.T) {
+ x := new(T)
+ x.Method()
+ _ = new(a.Type)
+ }
+ `)
+
+ tg.setenv("GOPATH", tg.path("."))
+ tg.run("test", "b")
+}
+
func TestInstallDeps(t *testing.T) {
tooSlow(t)
tg := testgo(t)
t.ImportXtest = true
}
- if ptest != p && localCover {
+ if ptest != p {
// We have made modifications to the package p being tested
// and are rebuilding p (as ptest).
// Arrange to rebuild all packages q such that
// Strictly speaking, the rebuild is only necessary if the
// modifications to p change its export metadata, but
// determining that is a bit tricky, so we rebuild always.
- // TODO(rsc): Once we get export metadata changes
- // handled properly, look into the expense of dropping
- // "&& localCover" above.
- //
- // This will cause extra compilation, so for now we only do it
- // when testCover is set. The conditions are more general, though,
- // and we may find that we need to do it always in the future.
recompileForTest(pmain, p, ptest, pxtest)
}