tg.grepStderr("not an importable package", "did not detect import main")
}
+func TestTestEmpty(t *testing.T) {
+ if !canRace {
+ t.Skip("no race detector")
+ }
+
+ wd, _ := os.Getwd()
+ testdata := filepath.Join(wd, "testdata")
+
+ for _, dir := range []string{"pkg", "test", "xtest", "pkgtest", "pkgxtest", "pkgtestxtest", "testxtest"} {
+ t.Run(dir, func(t *testing.T) {
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.setenv("GOPATH", testdata)
+ tg.cd(filepath.Join(testdata, "src/empty/"+dir))
+ tg.run("test", "-cover", "-coverpkg=.", "-race")
+ })
+ if testing.Short() {
+ break
+ }
+ }
+}
+
func TestBuildDryRunWithCgo(t *testing.T) {
if !canCgo {
t.Skip("skipping because cgo not enabled")
if p.Name == "main" && goarch == "arm" {
importPaths = append(importPaths, "math")
}
+ // In coverage atomic mode everything depends on sync/atomic.
+ if testCoverMode == "atomic" && (!p.Standard || (p.ImportPath != "runtime/cgo" && p.ImportPath != "runtime/race" && p.ImportPath != "sync/atomic")) {
+ importPaths = append(importPaths, "sync/atomic")
+ }
}
// Runtime and its internal packages depend on runtime/internal/sys,