Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: don't cache tests that use testing/quick.Check and friends #26276

Closed
ainar-g opened this issue Jul 8, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@ainar-g
Copy link
Contributor

commented Jul 8, 2018

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

go version devel +b001ffb Sun Jul 8 04:14:45 2018 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ainar/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ainar/go"
GORACE=""
GOROOT="/home/ainar/go/go1.10"
GOTMPDIR=""
GOTOOLDIR="/home/ainar/go/go1.10/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build505661023=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/e6SHcVstHOW

$ go test foo_test.go
$ go test foo_test.go
$ go test foo_test.go

What did you expect to see?

ok  	command-line-arguments	0.002s
ok  	command-line-arguments	0.001s
ok  	command-line-arguments	0.003s

What did you see instead?

ok  	command-line-arguments	0.002s
ok  	command-line-arguments	(cached)
ok  	command-line-arguments	(cached)

My assumption here is that the people who use testing/quick want the tests to run as often as possible to maximise the potential of finding a bug. Caching the first successful result thus seems counterproductive. I know that the official way to disable caching for tests is -count 1, but it seems silly to provide a randomised testing package and than have it be almost useless by default.

If the consensus is that the people who use testing/quick should just also use -count 1, then I think it would be nice to reflect that in the package documentation.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Aug 10, 2018

Duplicate of #23799, essentially, with the same likely answer: no.

@rsc rsc closed this Aug 10, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented Aug 10, 2018

In particular see my response #23799 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.