Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: Go compiler tests fail with ccache #17668

Closed
mpx opened this issue Oct 30, 2016 · 6 comments
Closed

cmd/go: Go compiler tests fail with ccache #17668

mpx opened this issue Oct 30, 2016 · 6 comments

Comments

@mpx
Copy link
Contributor

mpx commented Oct 30, 2016

Go compiler tests fail at 0f06d0a when ccache is installed. Ccache is unable to cache objects since $HOME is not writeable. Ccache is installed by default on some Linux distros (eg, "C Development Tools and Libraries" package group on Fedora).

@rsc Perhaps TestMain could create an empty test directory for $HOME and remove it afterwards?

Using go version go1.7.3 linux/amd64 for bootstrap.

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/z/home/mark/Prog/go"
GORACE=""
GOROOT="/home/mark/go"
GOTOOLDIR="/home/mark/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build484003543=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

  1. Install ccache
  2. Ensure ccache cc is first in PATH
  3. Build/test compiler at 0f06d0a

cmd/go tests fail with:

--- FAIL: TestCoverageWithCgo (0.09s)
go_test.go:252: running testgo [test -short -cover ./testdata/cgocover]
go_test.go:267: standard output:
go_test.go:268: FAIL _/home/mark/go-dev/src/cmd/go/testdata/cgocover [build failed]

go_test.go:271: standard error:
go_test.go:272: # _/home/mark/go-dev/src/cmd/go/testdata/cgocover
[..]
full error output:
ccache: error: Failed to create directory /test-go-home-does-not-exist/.ccache/tmp: Permission denied

go_test.go:281: go [test -short -cover ./testdata/cgocover] failed unexpectedly: exit status 2
--- FAIL: TestGoTestRaceInstallCgo (0.91s)
go_test.go:252: running testgo [tool -n cgo]
go_test.go:267: standard output:
go_test.go:268: /home/mark/go-dev/pkg/tool/linux_amd64/cgo

go_test.go:252: running testgo [test -race -i runtime/race]
go_test.go:271: standard error:
go_test.go:272: # runtime/cgo
ccache: error: Failed to create directory /test-go-home-does-not-exist/.ccache/tmp: Permission denied

go_test.go:281: go [test -race -i runtime/race] failed unexpectedly: exit status 2
--- FAIL: TestCgoConsistentResults (0.05s)
go_test.go:252: running testgo [build -o /tmp/gotest057782968/cgotest1 cgotest]
go_test.go:271: standard error:
go_test.go:272: # cgotest
[..]
full error output:
ccache: error: Failed to create directory /test-go-home-does-not-exist/.ccache/tmp: Permission denied

go_test.go:281: go [build -o /tmp/gotest057782968/cgotest1 cgotest] failed unexpectedly: exit status 2
--- FAIL: TestCgoHandlesWlORIGIN (0.05s)
go_test.go:252: running testgo [build origin]
go_test.go:271: standard error:
go_test.go:272: # origin
[..]
full error output:
ccache: error: Failed to create directory /test-go-home-does-not-exist/.ccache/tmp: Permission denied

go_test.go:281: go [build origin] failed unexpectedly: exit status 2
FAIL
FAIL cmd/go 24.875s

@bradfitz
Copy link
Contributor

Considering that Go isn't written in C, how much does this really matter?

@ianlancetaylor
Copy link
Contributor

@bradfitz It doesn't matter but it's confusing to have the tests fail. Sent a CL to avoid the confusion in this case.

@gopherbot
Copy link

CL https://golang.org/cl/32328 mentions this issue.

@mpx
Copy link
Contributor Author

mpx commented Oct 30, 2016

Re cl/32328 (setting CCACHE_DIR), would it be better to create an empty temporary directory for the duration of the test and remove it afterwards?

This is a more general solution that gives the sub processes a clean environment without gitconfig,.., and it isn't ccache specific.
I don't see any need to support caching objects for tests. The main aim is to avoid future confusion and bug reports on a standard Linux install.

@ianlancetaylor
Copy link
Contributor

@mpx I don't really have an opinion. Want to send a CL?

@mpx
Copy link
Contributor Author

mpx commented Oct 30, 2016

Build works now. I'll leave it there - thanks for the quick fix.

@mikioh mikioh changed the title Go compiler tests fail with ccache cmd/go: Go compiler tests fail with ccache Oct 30, 2016
@golang golang locked and limited conversation to collaborators Oct 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants