jenkinsci / jenkinsci/coverage-model
[BUG] GO_COV Cannot Handle -coverpkg flag
- Dominant language
- Java
- Stars
- 10
- Forks
- 43
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 6
Description
When generating a coverage report using the -coverpkg flag
'go test -coverpkg=x,y,z x,y,z'
The GO_COV parser reports inaccurate coverage.
-coverpkg tells every test binary to instrument a shared,explicit set of packages regardless of which packages tests are running. So 'go test -coverpkg ./... ./...'
Builds N different binary's, one per tested package and each one instruments the entire package set.
In the earlier example for x,y,and z. All 3 binaries will write into the same cover profile, so each shared block appears once per test binary. This means duplicate blocks for the same file:line-range with different hit counts depending on whether that particular test binary happened to execute that code.
Therefore it is only safe to consume if the consumer merges duplicates correctly. Which the GO_COV parser does not.
Contributor guide
Research direction
Locate the GO_COV parser and trace how repeated file and line-range blocks are consumed from a profile produced with -coverpkg. Reproduce the issue with the provided go test -coverpkg examples, then verify that duplicate blocks are merged with correct coverage counts and that ordinary profiles remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100