mirror of
https://github.com/golang/go
synced 2024-11-26 03:47:57 -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:
parent
aa511b426d
commit
47d4295f92
@ -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) {
|
func computeTestInputsID(a *work.Action, testlog []byte) (cache.ActionID, error) {
|
||||||
testlog = bytes.TrimPrefix(testlog, testlogMagic)
|
testlog = bytes.TrimPrefix(testlog, testlogMagic)
|
||||||
h := cache.NewHash("testInputs")
|
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
|
pwd := a.Package.Dir
|
||||||
for _, line := range bytes.Split(testlog, []byte("\n")) {
|
for _, line := range bytes.Split(testlog, []byte("\n")) {
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
|
@ -23,6 +23,14 @@ go test testcache -run=TestLookupEnv
|
|||||||
go test testcache -run=TestLookupEnv
|
go test testcache -run=TestLookupEnv
|
||||||
stdout '\(cached\)'
|
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
|
env TESTKEY=y
|
||||||
go test testcache -run=TestLookupEnv
|
go test testcache -run=TestLookupEnv
|
||||||
! stdout '\(cached\)'
|
! stdout '\(cached\)'
|
||||||
|
Loading…
Reference in New Issue
Block a user