1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:44:41 -07:00

cmd/go: respect GODEBUG in test cache

GODEBUG affects test execution but was not being tracked.

Fixes #66213.
Fixes #65436.

Change-Id: I3ac3c397f0c6fa46cd9be0d22d03020d0632f64f
Reviewed-on: https://go-review.googlesource.com/c/go/+/570259
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2024-03-08 19:29:27 -05:00 committed by Gopher Robot
parent aa511b426d
commit 47d4295f92
2 changed files with 10 additions and 0 deletions

View File

@ -1859,6 +1859,8 @@ var testlogMagic = []byte("# test log\n") // known to testing/internal/testdeps/
func computeTestInputsID(a *work.Action, testlog []byte) (cache.ActionID, error) {
testlog = bytes.TrimPrefix(testlog, testlogMagic)
h := cache.NewHash("testInputs")
// The runtime always looks at GODEBUG, without telling us in the testlog.
fmt.Fprintf(h, "env GODEBUG %x\n", hashGetenv("GODEBUG"))
pwd := a.Package.Dir
for _, line := range bytes.Split(testlog, []byte("\n")) {
if len(line) == 0 {

View File

@ -23,6 +23,14 @@ go test testcache -run=TestLookupEnv
go test testcache -run=TestLookupEnv
stdout '\(cached\)'
# GODEBUG is always read
env GODEBUG=asdf=1
go test testcache -run=TestLookupEnv
! stdout '\(cached\)'
go test testcache -run=TestLookupEnv
stdout '\(cached\)'
env GODEBUG=
env TESTKEY=y
go test testcache -run=TestLookupEnv
! stdout '\(cached\)'