Skip to content

internal/coverage/cfile: snapshot test is brittle w/ respect to -coverpkg #67951

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

Closed
thanm opened this issue Jun 12, 2024 · 2 comments
Closed
Assignees
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Jun 12, 2024

At tip, if you run the internal/coverage/cfile tests with -coverpkg set to something that does include cfile, you get:

     $ cd `go env GOROOT`
     $ cd src/internal/coverage
     $ go test -coverpkg=internal/coverage/decodecounter ./...
     ...
      --- FAIL: TestCoverageSnapshot (0.00s)
          ts_test.go:102: 0.276074 0.276074
          ts_test.go:104: erroneous snapshots, C1 >= C2 = true C1=0.276074 C2=0.276074

This is happening because the test is calling out to a function that it expects will bump up the coverage percentage, but that func is not being instrumented.

The test needs to be rewritten to make it a bit more robust.

@thanm thanm added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 12, 2024
@thanm thanm added this to the Go1.23 milestone Jun 12, 2024
@thanm thanm self-assigned this Jun 12, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/592200 mentions this issue: internal/coverage/cfile: harden the coverage snapshot test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants