]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add '-skip' to list of cacheable test flags
authorMichael Matloob <matloob@golang.org>
Wed, 5 Feb 2025 20:27:29 +0000 (15:27 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 5 Feb 2025 21:25:26 +0000 (13:25 -0800)
-run is cacheable, so -skip should be cacheable too.

Fixes #70692

Change-Id: I16880189b0d3a963f8f08008fc7fedcdc6f11630
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/646997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
src/cmd/go/alldocs.go
src/cmd/go/internal/test/test.go
src/cmd/go/testdata/script/test_cache_inputs.txt

index e28f68df6a0b526fa483ae825271f76dd4de9000..7289b5f4b1e16f28c8f54436841445493e7877a0 100644 (file)
 // 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, -fullpath and -v.
+// -list, -parallel, -run, -short, -skip, -timeout, -failfast, -fullpath 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
index e3cd50d59c88fbb6d6b2c5b662ca14271274f497..28ab6a09355020883157ef42233a9677b1a7fb99 100644 (file)
@@ -127,7 +127,7 @@ 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, -fullpath and -v.
+-list, -parallel, -run, -short, -skip, -timeout, -failfast, -fullpath 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
@@ -1781,6 +1781,7 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo
                        "-test.parallel",
                        "-test.run",
                        "-test.short",
+                       "-test.skip",
                        "-test.timeout",
                        "-test.failfast",
                        "-test.v",
index 68a700b11607637c3ce7a6b9e18cdde267cc7d57..796a5880eb6146be16d7a1a01bc9ad25f32541c8 100644 (file)
@@ -128,6 +128,11 @@ go test testcache -run=TestOSArgs -fullpath
 go test testcache -run=TestOSArgs -fullpath
 stdout '\(cached\)'
 
+# golang.org/issue/70692: that includes the `-skip` flag
+go test testcache -run=TestOdd -skip=TestOddFile
+! stdout '\(cached\)'
+go test testcache -run=TestOdd -skip=TestOddFile
+stdout '\(cached\)'
 
 # Executables within GOROOT and GOPATH should affect caching,
 # even if the test does not stat them explicitly.