mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
8c227765f7
commit
29be20a111
18 changed files with 652 additions and 47 deletions
|
|
@ -8,6 +8,7 @@ package os
|
|||
|
||||
import (
|
||||
"internal/poll"
|
||||
"internal/testlog"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
|
@ -159,6 +160,8 @@ const DevNull = "/dev/null"
|
|||
// methods on the returned File can be used for I/O.
|
||||
// If there is an error, it will be of type *PathError.
|
||||
func OpenFile(name string, flag int, perm FileMode) (*File, error) {
|
||||
testlog.Open(name)
|
||||
|
||||
chmod := false
|
||||
if !supportsCreateWithStickyBit && flag&O_CREATE != 0 && perm&ModeSticky != 0 {
|
||||
if _, err := Stat(name); IsNotExist(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue