-
Notifications
You must be signed in to change notification settings - Fork 17.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: cache successful test results
This CL adds caching of successful test results, keyed by the action ID of the test binary and its command line arguments. Suppose you run: go test -short std <edit a typo in a comment in math/big/float.go> go test -short std Before this CL, the second go test would re-run all the tests for the std packages. Now, the second go test will use the cached result immediately (without any compile or link steps) for any packages that do not transitively import math/big, and then it will, after compiling math/big and seeing that the .a file didn't change, reuse the cached test results for the remaining packages without any additional compile or link steps. Suppose that instead of editing a typo you made a substantive change to one function, but you left the others (including their line numbers) unchanged. Then the second go test will re-link any of the tests that transitively depend on math/big, but it still will not re-run the tests, because the link will result in the same test binary as the first run. The only cacheable test arguments are: -cpu -list -parallel -run -short -v Using any other test flag disables the cache for that run. The suggested argument to mean "turn off the cache" is -count=1 (asking "please run this 1 time, not 0"). There's an open question about re-running tests when inputs like environment variables and input files change. For now we will assume that users will bypass the test cache when they need to do so, using -count=1 or "go test" with no arguments. This CL documents the new cache but also documents the previously-undocumented distinction between "go test" with no arguments (now called "local directory mode") and with arguments (now called "package list mode"). It also cleans up a minor detail of package list mode buffering that used to change whether test binary stderr was sent to go command stderr based on details like exactly how many packages were listed or how many CPUs the host system had. Clearly the file descriptor receiving output should not depend on those, so package list mode now consistently merges all output to stdout, where before it mostly did that but not always. Fixes #11193. Change-Id: I120edef347b9ddd5b10e247bfd5bd768db9c2182 Reviewed-on: https://go-review.googlesource.com/75631 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: David Crawshaw <[email protected]>
- Loading branch information
Showing
8 changed files
with
427 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.