Skip to content

Commit 47d4295

Browse files
rscgopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Russ Cox <[email protected]>
1 parent aa511b4 commit 47d4295

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/cmd/go/internal/test/test.go

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

src/cmd/go/testdata/script/test_cache_inputs.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ go test testcache -run=TestLookupEnv
2323
go test testcache -run=TestLookupEnv
2424
stdout '\(cached\)'
2525

26+
# GODEBUG is always read
27+
env GODEBUG=asdf=1
28+
go test testcache -run=TestLookupEnv
29+
! stdout '\(cached\)'
30+
go test testcache -run=TestLookupEnv
31+
stdout '\(cached\)'
32+
env GODEBUG=
33+
2634
env TESTKEY=y
2735
go test testcache -run=TestLookupEnv
2836
! stdout '\(cached\)'

0 commit comments

Comments
 (0)