]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: disable ccache when setting HOME to non-existent dir
authorMark Pulford <mark@kyne.com.au>
Fri, 3 Aug 2018 14:19:21 +0000 (00:19 +1000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 3 Aug 2018 15:14:33 +0000 (15:14 +0000)
This fixes tests on systems where ccache is the default compiler.

Also simplify a prior workaround for this fault.

Fixed #26789

Change-Id: I031ff0b65ace7fc5e284393298e004aa2ad3b6f5
Reviewed-on: https://go-review.googlesource.com/127775
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/go/go_test.go
src/cmd/go/script_test.go

index 318f4393e3b24ca31329c3bfed49bce9365e1eb0..6ac625cfce78342d03574f6b7b1126d48eba0f17 100644 (file)
@@ -224,13 +224,11 @@ func TestMain(m *testing.M) {
        os.Unsetenv("GOBIN")
        os.Unsetenv("GOPATH")
        os.Unsetenv("GIT_ALLOW_PROTOCOL")
-       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")
+       // On some systems the default C compiler is ccache.
+       // Setting HOME to a non-existent directory will break
+       // those systems. Disable ccache and use real compiler. Issue 17668.
+       os.Setenv("CCACHE_DISABLE", "1")
        if os.Getenv("GOCACHE") == "" {
                os.Setenv("GOCACHE", testGOCACHE) // because $HOME is gone
        }
index 90cf3a5679e85baafd4ff60cd32cc61aad36ebf1..389485bc6582e7328cdea96250c13bd820aa3d9c 100644 (file)
@@ -87,6 +87,7 @@ func (ts *testScript) setup() {
                "WORK=" + ts.workdir, // must be first for ts.abbrev
                "PATH=" + testBin + string(filepath.ListSeparator) + os.Getenv("PATH"),
                homeEnvName() + "=/no-home",
+               "CCACHE_DISABLE=1", // ccache breaks with non-existent HOME
                "GOARCH=" + runtime.GOARCH,
                "GOCACHE=" + testGOCACHE,
                "GOOS=" + runtime.GOOS,