1
0
mirror of https://github.com/golang/go synced 2024-11-08 08:56:16 -07:00
go/src/cmd
Russ Cox bd95f889cd 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 <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-03 22:07:55 +00:00
..
addr2line
api all: revert "all: prefer strings.IndexByte over strings.Index" 2017-10-05 23:19:10 +00:00
asm cmd/internal/obj/x86: add most missing AVX1/2 insts 2017-11-03 15:32:07 +00:00
buildid cmd/buildid: add new tool factoring out code needed by go command 2017-10-11 18:16:02 +00:00
cgo cmd/cgo: remove unnecessary nil check 2017-11-01 08:21:26 +00:00
compile cmd/compile: fix reassignment check 2017-11-03 20:09:26 +00:00
cover cmd/cover: don't try to attach directives to synthetic decls 2017-10-17 22:14:28 +00:00
dist cmd/go: cache successful test results 2017-11-03 22:07:55 +00:00
doc all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
fix all: revert "all: prefer strings.LastIndexByte over strings.LastIndex" 2017-10-05 23:19:42 +00:00
go cmd/go: cache successful test results 2017-11-03 22:07:55 +00:00
gofmt
internal cmd/internal/obj/x86: add most missing AVX1/2 insts 2017-11-03 15:32:07 +00:00
link cmd/link: restore windows stack commit size back to 4KB 2017-11-03 00:09:40 +00:00
nm cmd/internal/goobj: accept int64 in readInt 2017-11-01 18:23:58 +00:00
objdump cmd/internal/goobj: accept int64 in readInt 2017-11-01 18:23:58 +00:00
pack
pprof
trace cmd/trace: fix a javascript bug in handling import error 2017-10-20 16:34:50 +00:00
vendor cmd/vendor/github.com/google/pprof: refresh from upstream 2017-11-03 17:45:05 +00:00
vet cmd/go: pass package config to vet during "go vet" 2017-11-01 13:47:48 +00:00