Description
What version of Go are you using (go version
)?
go version go1.10.3 freebsd/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
freebsd/amd64
What did you do?
go test -exec wrap1.sh ./...
go test -exec wrap1.sh ./..
What did you expect to see?
tests should be cached on the second attempt
What did you see instead?
full tests ran
The reason for this is the following line: https://github.com/golang/go/blob/master/src/cmd/go/internal/test/test.go#L1106
execCmd := work.FindExecCmd()
if !c.disableCache && len(execCmd) == 0 {
testlogArg = []string{"-test.testlogfile=" + a.Objdir + "testlog.txt"}
}
While the documented set of 'cacheable' test flags don't include -exec it seems like this should be supported.
While looking into this issue I also noticed this specific criteria is not mentioned when GODEBUG
includes gocachetest=1
so at the least is should be output e.g.
execCmd := work.FindExecCmd()
if len(execCmd) != 0 {
fmt.Fprintf(os.Stderr, "testcache: caching disabled for cmd: %q\n", execCmd)
} else if !c.disableCache {
testlogArg = []string{"-test.testlogfile=" + a.Objdir + "testlog.txt"}
}
With more investigation I also identified that tryCacheWithID actually includes work.ExecCmd in the calculation of the cache.ActionID.
I tried removing the execCmd check in builderRunTest and everything worked as expected, cached results are cached returned if the -exec parameter matches.