diff options
author | Johan Jansson <johan.jansson@iki.fi> | 2021-03-24 17:14:29 +0200 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-03-25 18:05:10 +0000 |
commit | 74fe516c3549e8177aa5326e6ce17efd529e3383 (patch) | |
tree | 5fa8f2b0004bb06099193359a0701a3b3921a3f9 /src/cmd/go/internal/test/test.go | |
parent | 82a1e0f9d3e47ae7792cb857e950abc7103e9f39 (diff) | |
download | go-74fe516c3549e8177aa5326e6ce17efd529e3383.tar.gz go-74fe516c3549e8177aa5326e6ce17efd529e3383.zip |
cmd/go: add -benchtime to cacheable test flags
Add -benchtime to the list of flags that allow caching test results.
If -benchtime is set without -bench, no benchmarks are run. The cache
does not need to be invalidated in this case.
If -benchtime is set with -bench, benchmarks are run. The cache is
invalidated due to the -bench flag in this case.
Fixes #44555
Change-Id: I2eb5c9f389a587d150fb984590d145251d0fa2dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/304689
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/internal/test/test.go')
-rw-r--r-- | src/cmd/go/internal/test/test.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index 230ea2d318..ebe13205f7 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -118,8 +118,8 @@ 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 -cpu, -list, --parallel, -run, -short, and -v. If a run of go test has any test +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 @@ -1333,7 +1333,8 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo return false } switch arg[:i] { - case "-test.cpu", + case "-test.benchtime", + "-test.cpu", "-test.list", "-test.parallel", "-test.run", |