-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Update code coverage #3173
Update code coverage #3173
Conversation
c4d44ce
to
33778c9
Compare
2279194
to
183d84f
Compare
I do not agree with some of the supporting arguments for switching to
As far as my concern, we do not have enough datapints to affirm that kcov is the problem and we need to identify what part of the code triggers the error. |
183d84f
to
26f5412
Compare
d43e5fd
to
09bf2d0
Compare
09bf2d0
to
f2c31df
Compare
dd9e289
to
84d03a6
Compare
I think this is because we explicitly exclude test modules for kcov:
|
@roypat Yes this is why. Excluding tests is a non-optimal solution here. I would propose to evaluate test code coverage and production code coverage separately. With this approach we can get the benefits of evaluating test coverage without the negative of this giving us false confidence in our production code coverage. But this is outside this PR for now I will make the change to exclude test code. |
84d03a6
to
552de3f
Compare
Signed-off-by: Jonathan Woollett-Light <[email protected]>
552de3f
to
b3d8959
Compare
Changes
Changed code coverage to use grcov.
Coverage value changes
grcov includes the test code as covered lines (where as kcov does not appear to do so). This moderately increases our line coverage.
Unit test and profiling tool chains
Previously we ran tests with the
aarch64-unknown-linux-musl
andx86_64-unkown-linux-musl
tool chains to generate code coverage data then ran the unit tests under thex86_64-unknown-linux-gnu
andaarch64-unknown-linux-gnu
tool chains. This accomplished testing both both combinations of tool chains covering both our primarymusl
targets and the commonly usedgnu
target.At present
aarch64-unknown-linux-musl
is not supported with profiling by Rust lang, I opened an issue regarding this rust-lang/rustup#3095 (interestinglyx86_64-unknown-linux-musl
is supported rust-lang/rust#79556). To accommodate this we need to generate code coverage using the respectivegnu
tool chains ofx86_64-unknown-linux-gnu
andaarch64-unknown-linux-gnu
and then run unit tests with themusl
tool chains ofaarch64-unknown-linux-musl
andx86_64-unkown-linux-musl
. This does shift our code coverage metric generation frommusl
tognu
although maintains the same actual code coverage for both. I do not believe this represents a decrease in security or safety. Actual test coverage across all tool chains is identical as before and it is extremely unlikely the test coverage will diverge between thegnu
andmusl
tool chains in the future (or until profiling is support byaarch64-unknown-linux-musl
at which point we can use themusl
tool chains for code coverage generation).Reason
We currently use cargo_kcov (a wrapper around kcov). cargo_kcov appears unmaintained with the last commit >2 years ago.
grcov is a popular coverage tool for Rust. It does not produce the same error as kcov with #3105. It offers a better solution in the long term.
The primary advantages of grcov over kcov are:
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
git commit -s
).unsafe
code is documented.CHANGELOG.md
.rust-vmm
.