You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GOARCH='amd64'
GOOS='darwin'
What did you do?
I am running tests that run coverage binaries that write to their covdata to the -test.gocoverdir however the reported coverage is wrong. The reported coverage only takes into account the covdata generated by the go test process and not also the coverage generated by the subprocesses that also generate coverage to the same gocoverdir.
To demonstrate this I have a newly created package that deals with signals. In order to test this package I had to create an "acceptance binary" (a binary created with go build -cover) and use it as part of my regular tests so that I can send signals and test the functionality of my library.
However when I run go test -cover although the unit test coverage and the acceptance-binary coverage are being written to the same gocoverdir the go test command only shows the coverage of the unit tests and so does the cover profile.
However if you set the gocoverdir manually and build the percentage and textfmt cover profile manually you get complete coverage. This should be the default of the go test command. To run and build its coverage from all generated coverage.
Follow these steps to reproduce:
git clone [email protected]:davidmdm/xcontext.git
cd xcontext
git checkout gocoverdir
# This simply runs a normal coverage and you will see only 20% coverage reported
./coverage-regular.sh
# This sets a gocoverdir to a local folder and builds the percentage from it. You will notice the go test# command still reports 20% coverage, but the covdata percent command reports 100% coverage.
./coverage-gocoverdir.sh
What did you expect to see?
I expected the go test to use all the covdata generated and present correct coverage.
Note the difference between a normal run and one where covdata is manually collected and proccessed:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am running tests that run coverage binaries that write to their
covdata
to the-test.gocoverdir
however the reported coverage is wrong. The reported coverage only takes into account the covdata generated by thego test
process and not also the coverage generated by the subprocesses that also generate coverage to the samegocoverdir
.To demonstrate this I have a newly created package that deals with signals. In order to test this package I had to create an "acceptance binary" (a binary created with
go build -cover
) and use it as part of my regular tests so that I can send signals and test the functionality of my library.However when I run
go test -cover
although the unit test coverage and the acceptance-binary coverage are being written to the same gocoverdir the go test command only shows the coverage of the unit tests and so does the cover profile.However if you set the
gocoverdir
manually and build the percentage and textfmt cover profile manually you get complete coverage. This should be the default of thego test
command. To run and build its coverage from all generated coverage.Follow these steps to reproduce:
What did you expect to see?
I expected the
go test
to use all the covdata generated and present correct coverage.Note the difference between a normal run and one where covdata is manually collected and proccessed:
Go test output:
Manually processed:
I expect to see all of my coverage taken into account when running
go test -cover
.The text was updated successfully, but these errors were encountered: