-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: test caching misses on alternate runs #23526
Comments
Hint: the package it's retesting on alternate runs is the only one that has no non-test files. |
This might be related to the weirdness involved in loading Go packages containing only test files in the new Was this also broken when test caching was first introduced? |
I believe this issue has something to do with the fact that |
Yes it does, and I have filed upspin/upspin#572 |
Closing as not go's fault. |
Reopening. After https://upspin-review.googlesource.com/c/upspin/+/18420 the behavior has changed. Now for me it never caches the upspin.io/test results. I believe this must be something we are doing in upspin, but I am reopening to get help figuring out what. |
Now, unlike previously, this doesn't cache either (cd'ing into the test directory itself):
Are there diagnostics one can print to see what caching decisions are being made? |
cc @rsc |
I can no longer recreate the problem. It does reliably cache the test results for me, whether in the test directory or not.. The debugging that I know of is to use There may be a better way that I don't know about. |
I just cd'd to the upspin.io directory and did
There is some evidence that this works for people who don't have I tried diff'ing /tmp/3 and /tmp/4, since
All those "no such file or directory" messages bother me. These seem to be tests involving files, and it's not just upbox (moreover, upbox tests are caching). I can't find a reason the errors test, for example, is rerunning though. If I do it by itself, it caches. But if I run the full test, it does not. I'll keep digging but the output with GODEBUG=gocachehash=` is inscrutable at best. |
Progress of a sort. The integration tests in
But why errors would fail eludes me. It works in isolation. More digging. |
A much smaller case, showing the toggling of caching. A run of upspin.io/shutdown manages to break the cache for upspin.io/errors:
Now the shutdown test is odd in that it execs a version of itself to create a child process for testing. But I cannot explain why that would cause the test cache for the errors package to go bad. |
This is a clue I think:
The shutdown test writes to /dev/null, but /dev/null gives a different hash each time. As a total hack, I changed go test to return a constant hash for /dev/null and everything caches properly, always. I think this is the essence of the problem. |
Do you have the latest cmd/go? The current internal/test/test.go says:
If /dev/null is being included then the question is why inDir("/dev/null", yourGOROOT) is returning true. |
As I wrote in the first message, my go command was from Jan 21, less than a week ago. I just synced and rebuilt and of course it all works. So the bug has been fixed in the last few days. Sorry for the spam. (Fun to track down though.) |
Checkout upspin:
go get -u upspin.io/cmd/upspin
. ThenThe first run takes a minute or two and will of course cache everything. The next run takes 7 seconds, as everything is cached. The third run reruns the test for
upspin.io/test
, only. This pattern continues: Even runs report cached values and run quickly; odd runs report mostly cached runs but retestupspin.io/test
and take a minute or so.The text was updated successfully, but these errors were encountered: