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

runtime: TestGcSys does not really pass, should be fixed or removed #23343

Closed
ianlancetaylor opened this issue Jan 5, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@ianlancetaylor
Copy link
Contributor

commented Jan 5, 2018

The runtime test TestGcSys no longer tests anything. The test simply checks whether the function GCSys in runtime/testdata/testprog/gc.go prints OK. It currently passes because the helper function workthegc is inlined and the compiler discards the allocation of the slice. If I change the code slightly to add //go:noinline before workthegc, the test fails, saying using too much memory: 64086016 bytes (the exact number of bytes reported varies).

We should either discard the test or fix it so that it actually tests something about the GC.

(I noticed this because the test fails consistently using gccgo, which does not currently discard the slice allocation.)

CC @aclements @RLH

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Jan 5, 2018

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 5, 2018

I am curious if there is any general good practice to detect whether tests silently stopped doing what they should be doing. It is fairly easy for that to go under the radar if the test continues to pass or is always skipped.

I can imagine "write good tests" and using metrics like coverage, but when thousands of tests are involved (such as in the standard library), things can get out of hand.

@gopherbot

This comment has been minimized.

Copy link

commented Jul 7, 2018

Change https://golang.org/cl/122576 mentions this issue: runtime: make TestGcSys actually test something

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor Author

commented Jul 7, 2018

We still need to fix the test to actually test something, but at least it seems to pass now.

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.