1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:10:05 -07:00

add a test case and keep documentation in sync

This commit is contained in:
kezhao 2021-07-27 14:11:07 +08:00
parent 3a66d48c6f
commit 1b7e32d480
3 changed files with 26 additions and 20 deletions

View File

@ -1446,16 +1446,16 @@
// 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
// 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
// or non-test flags outside this set, the result is not cached. To
// disable test caching, use any test flag or argument other than the
// cacheable flags. The idiomatic way to disable test caching explicitly
// is to use -count=1. Tests that open files within the package's source
// root (usually $GOPATH) or that consult environment variables only
// match future runs in which the files and environment variables are unchanged.
// A cached test result is treated as executing in no time at all,
// so a successful package test result will be cached and reused
// regardless of -timeout setting.
// -list, -parallel, -run, -short, -timeout, -failfast, and -v.
// If a run of go test has any test or non-test flags outside this set,
// the result is not cached. To disable test caching, use any test flag
// or argument other than the cacheable flags. The idiomatic way to disable
// test caching explicitly is to use -count=1. Tests that open files within
// the package's source root (usually $GOPATH) or that consult environment
// variables only match future runs in which the files and environment
// variables are unchanged. A cached test result is treated as executing
// in no time at all,so a successful package test result will be cached and
// reused regardless of -timeout setting.
//
// In addition to the build flags, the flags handled by 'go test' itself are:
//

View File

@ -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
test binary and the flags on the command line come entirely from a
restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
-list, -parallel, -run, -short, -timeout, -failfast, and -v. If a run of go test has any test
or non-test flags outside this set, the result is not cached. To
disable test caching, use any test flag or argument other than the
cacheable flags. The idiomatic way to disable test caching explicitly
is to use -count=1. Tests that open files within the package's source
root (usually $GOPATH) or that consult environment variables only
match future runs in which the files and environment variables are unchanged.
A cached test result is treated as executing in no time at all,
so a successful package test result will be cached and reused
regardless of -timeout setting.
-list, -parallel, -run, -short, -timeout, -failfast, and -v.
If a run of go test has any test or non-test flags outside this set,
the result is not cached. To disable test caching, use any test flag
or argument other than the cacheable flags. The idiomatic way to disable
test caching explicitly is to use -count=1. Tests that open files within
the package's source root (usually $GOPATH) or that consult environment
variables only match future runs in which the files and environment
variables are unchanged. A cached test result is treated as executing
in no time at all,so a successful package test result will be cached and
reused regardless of -timeout setting.
In addition to the build flags, the flags handled by 'go test' itself are:

View File

@ -108,6 +108,12 @@ go test testcache -run=Benchtime -bench=Benchtime -benchtime=1x
go test testcache -run=Benchtime -bench=Benchtime -benchtime=1x
! 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,
# even if the test does not stat them explicitly.