// Don't let these environment variables confuse the test.
os.Unsetenv("GOBIN")
os.Unsetenv("GOPATH")
+ if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
+ // On some systems the default C compiler is ccache.
+ // Setting HOME to a non-existent directory will break
+ // those systems. Set CCACHE_DIR to cope. Issue 17668.
+ os.Setenv("CCACHE_DIR", filepath.Join(home, ".ccache"))
+ }
os.Setenv("HOME", "/test-go-home-does-not-exist")
r := m.Run()
var _ = xmain.X
func TestFoo(t *testing.T) {}
`)
+ tg.creatingTemp("p4" + exeSuffix)
tg.run("build", "p4")
tg.runFail("test", "p4")
tg.grepStderr("import \"x\" is a program, not an importable package", "did not diagnose package main")
var _ = xmain.X
func TestFoo(t *testing.T) {}
`)
+ tg.creatingTemp("p5" + exeSuffix)
tg.run("build", "p5")
tg.runFail("test", "p5")
tg.grepStderr("import \"x\" is a program, not an importable package", "did not diagnose package main")