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
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

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 the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 5, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Jan 5, 2018
@mvdan
Copy link
Member

mvdan 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
Copy link

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

@ianlancetaylor
Copy link
Contributor Author

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

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 7, 2018
@golang golang locked and limited conversation to collaborators Aug 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants