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

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

ianlancetaylor opened this issue Jan 5, 2018 · 3 comments

Comments

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor 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

@mvdan 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

This comment has been minimized.

Copy link

@gopherbot gopherbot 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

@ianlancetaylor ianlancetaylor commented Jul 7, 2018

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
@gopherbot gopherbot closed this in 0a51940 Aug 22, 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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.