mirror of
https://github.com/golang/go
synced 2024-09-24 11:10:12 -06:00
cmd/go: go test flag -failfast should be cacheable
Add failfast to cacheable list and update docs
Fixes #47355
Change-Id: I75b371c45b80a3b179ff070b7b9d092a504380c0
GitHub-Last-Rev: abe61fd48c
GitHub-Pull-Request: golang/go#47371
Reviewed-on: https://go-review.googlesource.com/c/go/+/337229
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
0f85b0c0e1
commit
ace1730a41
@ -1446,16 +1446,16 @@
|
|||||||
// The rule for a match in the cache is that the run involves the same
|
// The rule for a match in the cache is that the run involves the same
|
||||||
// test binary and the flags on the command line come entirely from a
|
// test binary and the flags on the command line come entirely from a
|
||||||
// restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
|
// restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
|
||||||
// -list, -parallel, -run, -short, and -v. If a run of go test has any test
|
// -list, -parallel, -run, -short, -timeout, -failfast, and -v.
|
||||||
// or non-test flags outside this set, the result is not cached. To
|
// If a run of go test has any test or non-test flags outside this set,
|
||||||
// disable test caching, use any test flag or argument other than the
|
// the result is not cached. To disable test caching, use any test flag
|
||||||
// cacheable flags. The idiomatic way to disable test caching explicitly
|
// or argument other than the cacheable flags. The idiomatic way to disable
|
||||||
// is to use -count=1. Tests that open files within the package's source
|
// test caching explicitly is to use -count=1. Tests that open files within
|
||||||
// root (usually $GOPATH) or that consult environment variables only
|
// the package's source root (usually $GOPATH) or that consult environment
|
||||||
// match future runs in which the files and environment variables are unchanged.
|
// variables only match future runs in which the files and environment
|
||||||
// A cached test result is treated as executing in no time at all,
|
// variables are unchanged. A cached test result is treated as executing
|
||||||
// so a successful package test result will be cached and reused
|
// in no time at all,so a successful package test result will be cached and
|
||||||
// regardless of -timeout setting.
|
// reused regardless of -timeout setting.
|
||||||
//
|
//
|
||||||
// In addition to the build flags, the flags handled by 'go test' itself are:
|
// In addition to the build flags, the flags handled by 'go test' itself are:
|
||||||
//
|
//
|
||||||
|
@ -119,16 +119,16 @@ elapsed time in the summary line.
|
|||||||
The rule for a match in the cache is that the run involves the same
|
The rule for a match in the cache is that the run involves the same
|
||||||
test binary and the flags on the command line come entirely from a
|
test binary and the flags on the command line come entirely from a
|
||||||
restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
|
restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
|
||||||
-list, -parallel, -run, -short, and -v. If a run of go test has any test
|
-list, -parallel, -run, -short, -timeout, -failfast, and -v.
|
||||||
or non-test flags outside this set, the result is not cached. To
|
If a run of go test has any test or non-test flags outside this set,
|
||||||
disable test caching, use any test flag or argument other than the
|
the result is not cached. To disable test caching, use any test flag
|
||||||
cacheable flags. The idiomatic way to disable test caching explicitly
|
or argument other than the cacheable flags. The idiomatic way to disable
|
||||||
is to use -count=1. Tests that open files within the package's source
|
test caching explicitly is to use -count=1. Tests that open files within
|
||||||
root (usually $GOPATH) or that consult environment variables only
|
the package's source root (usually $GOPATH) or that consult environment
|
||||||
match future runs in which the files and environment variables are unchanged.
|
variables only match future runs in which the files and environment
|
||||||
A cached test result is treated as executing in no time at all,
|
variables are unchanged. A cached test result is treated as executing
|
||||||
so a successful package test result will be cached and reused
|
in no time at all,so a successful package test result will be cached and
|
||||||
regardless of -timeout setting.
|
reused regardless of -timeout setting.
|
||||||
|
|
||||||
In addition to the build flags, the flags handled by 'go test' itself are:
|
In addition to the build flags, the flags handled by 'go test' itself are:
|
||||||
|
|
||||||
@ -1351,6 +1351,7 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo
|
|||||||
"-test.run",
|
"-test.run",
|
||||||
"-test.short",
|
"-test.short",
|
||||||
"-test.timeout",
|
"-test.timeout",
|
||||||
|
"-test.failfast",
|
||||||
"-test.v":
|
"-test.v":
|
||||||
// These are cacheable.
|
// These are cacheable.
|
||||||
// Note that this list is documented above,
|
// Note that this list is documented above,
|
||||||
|
@ -108,6 +108,12 @@ go test testcache -run=Benchtime -bench=Benchtime -benchtime=1x
|
|||||||
go test testcache -run=Benchtime -bench=Benchtime -benchtime=1x
|
go test testcache -run=Benchtime -bench=Benchtime -benchtime=1x
|
||||||
! stdout '\(cached\)'
|
! stdout '\(cached\)'
|
||||||
|
|
||||||
|
# golang.org/issue/47355: that includes the `-failfast` argument.
|
||||||
|
go test testcache -run=TestOSArgs -failfast
|
||||||
|
! stdout '\(cached\)'
|
||||||
|
go test testcache -run=TestOSArgs -failfast
|
||||||
|
stdout '\(cached\)'
|
||||||
|
|
||||||
# Executables within GOROOT and GOPATH should affect caching,
|
# Executables within GOROOT and GOPATH should affect caching,
|
||||||
# even if the test does not stat them explicitly.
|
# even if the test does not stat them explicitly.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user