Skip to content

Commit 220fe79

Browse files
committed
cmd/go: add '-skip' to list of cacheable test flags
-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 <[email protected]> Reviewed-by: Sam Thanawalla <[email protected]>
1 parent b45c7d5 commit 220fe79

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/cmd/go/alldocs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cmd/go/internal/test/test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ elapsed time in the summary line.
127127
The rule for a match in the cache is that the run involves the same
128128
test binary and the flags on the command line come entirely from a
129129
restricted set of 'cacheable' test flags, defined as -benchtime, -cpu,
130-
-list, -parallel, -run, -short, -timeout, -failfast, -fullpath and -v.
130+
-list, -parallel, -run, -short, -skip, -timeout, -failfast, -fullpath and -v.
131131
If a run of go test has any test or non-test flags outside this set,
132132
the result is not cached. To disable test caching, use any test flag
133133
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
17811781
"-test.parallel",
17821782
"-test.run",
17831783
"-test.short",
1784+
"-test.skip",
17841785
"-test.timeout",
17851786
"-test.failfast",
17861787
"-test.v",

src/cmd/go/testdata/script/test_cache_inputs.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ go test testcache -run=TestOSArgs -fullpath
128128
go test testcache -run=TestOSArgs -fullpath
129129
stdout '\(cached\)'
130130

131+
# golang.org/issue/70692: that includes the `-skip` flag
132+
go test testcache -run=TestOdd -skip=TestOddFile
133+
! stdout '\(cached\)'
134+
go test testcache -run=TestOdd -skip=TestOddFile
135+
stdout '\(cached\)'
131136

132137
# Executables within GOROOT and GOPATH should affect caching,
133138
# even if the test does not stat them explicitly.

0 commit comments

Comments
 (0)