aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghvender <raghvenders@gmail.com>2023-12-11 15:41:45 -0600
committerGopher Robot <gobot@golang.org>2024-01-29 17:59:20 +0000
commite076c1b897b30648db794b66fd10929fe9a9852e (patch)
tree0f55d58482f7d44f69316b56a4112adc6f80a12b
parentcc38c68ae09fa591697a4239a7dedd2efe386995 (diff)
downloadgo-e076c1b897b30648db794b66fd10929fe9a9852e.tar.gz
go-e076c1b897b30648db794b66fd10929fe9a9852e.zip
cmd/go: allow test caching for the -fullpath flag
Change-Id: I5662b8ff617772ca2afec8bf419c468a3e69c392 Reviewed-on: https://go-review.googlesource.com/c/go/+/548996 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--src/cmd/go/alldocs.go2
-rw-r--r--src/cmd/go/internal/test/test.go5
-rw-r--r--src/cmd/go/testdata/script/test_cache_inputs.txt7
3 files changed, 11 insertions, 3 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 05e42a6d311..a6166a7fdb0 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1802,7 +1802,7 @@
// 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.
+// -list, -parallel, -run, -short, -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
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 8a40547f2e3..b2b5d340278 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -126,7 +126,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, and -v.
+-list, -parallel, -run, -short, -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
@@ -1717,7 +1717,8 @@ func (c *runCache) tryCacheWithID(b *work.Builder, a *work.Action, id string) bo
"-test.short",
"-test.timeout",
"-test.failfast",
- "-test.v":
+ "-test.v",
+ "-test.fullpath":
// These are cacheable.
// Note that this list is documented above,
// so if you add to this list, update the docs too.
diff --git a/src/cmd/go/testdata/script/test_cache_inputs.txt b/src/cmd/go/testdata/script/test_cache_inputs.txt
index 3705c700d10..1868da98420 100644
--- a/src/cmd/go/testdata/script/test_cache_inputs.txt
+++ b/src/cmd/go/testdata/script/test_cache_inputs.txt
@@ -114,6 +114,13 @@ go test testcache -run=TestOSArgs -failfast
go test testcache -run=TestOSArgs -failfast
stdout '\(cached\)'
+# golang.org/issue/64638: that includes the `-fullpath` argument.
+go test testcache -run=TestOSArgs -fullpath
+! stdout '\(cached\)'
+go test testcache -run=TestOSArgs -fullpath
+stdout '\(cached\)'
+
+
# Executables within GOROOT and GOPATH should affect caching,
# even if the test does not stat them explicitly.