]> Cypherpunks repositories - gostls13.git/commit
cmd/go: invalidate cached test results if env vars or files change
authorRuss Cox <rsc@golang.org>
Mon, 4 Dec 2017 18:57:48 +0000 (13:57 -0500)
committerDominik Honnef <dominik@honnef.co>
Mon, 11 Dec 2017 19:08:32 +0000 (19:08 +0000)
commit29be20a111d87b41b91e79a59fd3df95062ce91a
tree7ae1ee760e54cd98e51751682338319f3d048626
parent8c227765f70b5677901692a71d8662f395186a83
cmd/go: invalidate cached test results if env vars or files change

When we write a cached test result, we now also write a log of the
environment variables and files inspected by the test run,
along with a hash of their content. Before reusing a cached test result,
we recompute the hash of the content specified by the log, and only
use the result if that content has not changed.

This makes test caching behave correctly for tests that consult
environment variables or stat or read files or directories.

Fixes #22593.

Change-Id: I8608798e73c90e0c1911a38bf7e03e1232d784dc
Reviewed-on: https://go-review.googlesource.com/81895
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
18 files changed:
src/cmd/go/go_test.go
src/cmd/go/internal/cache/cache.go
src/cmd/go/internal/test/test.go
src/cmd/go/testdata/src/testcache/testcache_test.go [new file with mode: 0644]
src/go/build/deps_test.go
src/internal/testlog/log.go [new file with mode: 0644]
src/os/env.go
src/os/exec.go
src/os/exec/exec_test.go
src/os/file.go
src/os/file_plan9.go
src/os/file_unix.go
src/os/file_windows.go
src/os/stat_plan9.go
src/os/stat_unix.go
src/os/stat_windows.go
src/testing/internal/testdeps/deps.go
src/testing/testing.go