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

Fix storing coverage data in cargo projects #3527

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

adpaco-aws
Copy link
Contributor

This PR changes the condition we use to decide where to store the coverage data resulting from a coverage-enabled verification run. The previous condition would otherwise cause Kani to crash at the end of the run in some cases:

Source-based code coverage results:

src/pair.rs (pair::Pair::new)
 * 6:5 - 8:6 COVERED

src/pair.rs (pair::Pair::sum)
 * 9:5 - 11:6 COVERED

src/pair.rs (pair::kani_tests::test_one_plus_two)
 * 29:5 - 32:6 COVERED

Verification Time: 0.083455205s

thread 'main' panicked at kani-driver/src/coverage/cov_session.rs:70:43:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The PR also adds a new cargo-coverage mode to compiletest which runs cargo kani with the source-based coverage feature enabled. This ensures that coverage-enabled cargo kani runs are also being tested, and will also be helpful for testing the upcoming coverage tool (#3121) with cargo packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@adpaco-aws adpaco-aws requested a review from a team as a code owner September 20, 2024 14:35
@adpaco-aws adpaco-aws added this pull request to the merge queue Sep 20, 2024
Merged via the queue into model-checking:main with commit f1221b1 Sep 20, 2024
27 checks passed
@adpaco-aws adpaco-aws deleted the issue-cov-save-results branch September 20, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants