-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: TestCoverageRuns fails #17699
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
Comments
So IndexRune is allocation-free, except when it's compiled in cover mode? We could just skip that alloc test in that mode, but how do we detect that we're in cover mode at runtime? /cc @dsnet |
Yep. Alternatively, we could have TestCoverageRuns skip the test, but (frustratingly) there's no way to tell go test to skip tests that match a regexp. |
My understanding is that coverage instruments the code and inserts logic to do some bookkeeping. What is it doing that's causing the allocation? (I can look into this). I see at least 50 usages of I'm wondering if there's a bigger problem where it is flaky to do |
If only AllocsPerRun took a |
Probably. Unfortunately, pprof doesn't help much here. Running 'go test -run=TestIndexRune -memprofile=m -coverprofile=c strings' yields line numbers that are useless, because they're post-cover-rewrite line numbers. But there are four sources of allocations there, somewhere, so the complaint from AllocsPerRun is legit. |
And if *testing.T exposed whether it was in coverage mode. |
/cc @robpike |
CL https://golang.org/cl/32483 mentions this issue. |
This makes it possible to avoid tests where coverage affects the test results by skipping them (or otherwise adjusting them) when coverage is enabled. Update #17699 Change-Id: Ifcc36cfcd88ebd677890e82ba80ee3d696ed3d7c Reviewed-on: https://go-review.googlesource.com/32483 Reviewed-by: Brad Fitzpatrick <[email protected]>
CL https://golang.org/cl/32484 mentions this issue. |
Broken out from #17472.
Looks like the failure is because the coverage instrumentation causes an allocation in TestIndexRune where there wasn't one before, causing the test itself to fail.
The text was updated successfully, but these errors were encountered: