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/dist: no obvious way to disable test caching #22758

Closed
mundaym opened this issue Nov 16, 2017 · 10 comments
Closed

cmd/dist: no obvious way to disable test caching #22758

mundaym opened this issue Nov 16, 2017 · 10 comments
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@mundaym
Copy link
Member

mundaym commented Nov 16, 2017

There doesn't appear to be a way to disable the new test caching behaviour when running go tool dist test. This is a bit inconvenient when trying to recreate/resolve intermittent issues.

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

go version devel +7781fed24e Thu Nov 16 02:24:37 2017 +0000 linux/s390x

Does this issue reproduce with the latest release?

No, 1.9.x does not have test caching.

What did you do?

go tool dist test

What did you expect to see?

##### Testing packages.
ok  	archive/tar	0.033s
ok  	archive/zip	0.749s
ok  	bufio	0.126s
ok  	bytes	0.934s
ok  	compress/bzip2	0.068s
ok  	compress/flate	0.833s
ok  	compress/gzip	0.010s
ok  	compress/lzw	0.020s
ok  	compress/zlib	0.100s
ok  	container/heap	0.035s
ok  	container/list	0.015s
ok  	container/ring	0.014s
ok  	context	1.008s
...

What did you see instead?

##### Testing packages.
ok  	archive/tar	(cached)
ok  	archive/zip	(cached)
ok  	bufio	(cached)
ok  	bytes	(cached)
ok  	compress/bzip2	(cached)
ok  	compress/flate	(cached)
ok  	compress/gzip	(cached)
ok  	compress/lzw	(cached)
ok  	compress/zlib	(cached)
ok  	container/heap	(cached)
ok  	container/list	(cached)
ok  	container/ring	(cached)
ok  	context	(cached)
...

The output of go tool dist test -h is currently:

usage: go tool dist test [options]
  -banner string
    	banner prefix; blank means no section banners (default "##### ")
  -compile-only
    	compile tests, but don't run them. This is for some builders. Not all dist tests respect this flag, but most do.
  -k	keep going even when error occurred
  -list
    	list available tests
  -no-rebuild
    	overrides -rebuild (historical dreg)
  -race
    	run in race builder mode (different set of tests)
  -rebuild
    	rebuild everything first
  -run string
    	run only those tests matching the regular expression; empty means to run all. Special exception: if the string begins with '!', the match is inverted.
  -v	verbosity

The -rebuild flag does not affect the caching.

@mundaym
Copy link
Member Author

mundaym commented Nov 16, 2017

/cc @rsc

@laboger
Copy link
Contributor

laboger commented Nov 16, 2017

Did you try GOCACHE=off.

@mundaym
Copy link
Member Author

mundaym commented Nov 16, 2017

Did you try GOCACHE=off.

Ah I wasn't aware of that. Thanks, yes that does the trick.

If GOCACHE is going to be the general solution to this it might be nice to add to the dist help output.

@bradfitz bradfitz added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Documentation labels Nov 17, 2017
@bradfitz bradfitz added this to the Go1.10 milestone Nov 17, 2017
@rsc
Copy link
Contributor

rsc commented Nov 20, 2017

Why are you running go tool dist test at all instead of go test? Just curious. Normally go tool dist test is basically only for all.bash/run.bash/builders.

@mundaym
Copy link
Member Author

mundaym commented Nov 21, 2017

Normally I just use all.bash and go test when I'm testing. I sometimes use go tool dist test when I want to run the cgo and link mode tests without rebuilding everything. I could use run.bash instead, I just use go tool ... out of habit.

In this particular case I was trying to recreate a 'too many open files' failure on the builder and was changing ulimit -n in between runs to see what failed.

I guess the only other reason to use go tool dist test directly rather than run.bash would be to avoid the -rebuild flag. Useful when testing an install of Go without write access.

Since run.bash is just a thin wrapper around go tool dist test -rebuild it does have the same issue. I sometimes (rarely these days) need to run the tests a few times to be confident I've fixed an intermittent issue. In that case I don't want to see cached results.

GOCACHE=off is fine for me. Happy for this issue to be closed if you think this an obscure use case.

@laboger
Copy link
Contributor

laboger commented Nov 21, 2017 via email

@rsc
Copy link
Contributor

rsc commented Nov 29, 2017

@laboger, I believe that using -rebuild does rebuild everything even when the cache is active. cmd/dist says:

if t.rebuild {
	t.out("Building packages and commands.")
	// Force rebuild the whole toolchain.
	goInstall("go", append([]string{"-a", "-i"}, toolchain...)...)
}

The -a should be forcing a rebuild of everything. If not, that's a bug in -a.

@rsc
Copy link
Contributor

rsc commented Nov 29, 2017

@mundaym, thanks for elaborating. I will send a CL that uses -count=1 on all go test invocations from cmd/dist, so that those results are never cached.

@gopherbot
Copy link

Change https://golang.org/cl/80735 mentions this issue: cmd/dist: disable test caching during run.bash

@laboger
Copy link
Contributor

laboger commented Nov 29, 2017 via email

@golang golang locked and limited conversation to collaborators Dec 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants