mirror of
https://github.com/golang/go
synced 2024-11-24 02:30:12 -07:00
bd95f889cd
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 <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> |
||
---|---|---|
.. | ||
altpath/src | ||
src | ||
unnamed1 | ||
unnamed2 | ||
test.bash |