Skip to content

Conversation

@zhassan-aws
Copy link
Contributor

Description of changes:

Include satisfiable cover properties as part of what concrete playback can generate tests for.

Resolved issues:

Resolves #2133

Related RFC:

Optional #ISSUE-NUMBER.

Call-outs:

Testing:

  • How is this change tested? Added a new test

  • Is this a refactor change? No

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

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

@zhassan-aws zhassan-aws requested a review from a team as a code owner January 18, 2023 18:53
&& results.iter().all(|r| !r.result.generated_concrete_test)
{
println!(
"INFO: The concrete playback feature never generated unit tests because there were no failing harnesses."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we even need this? I was also wondering if we print that when a unit tests wasn't generated because it already existed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it is better than not printing anything, which could leave the user wondering whether the --concrete-playback option had any effect.

Copy link
Contributor Author

@zhassan-aws zhassan-aws Jan 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also wondering if we print that when a unit tests wasn't generated because it already existed.

We do that here.

I misunderstood the question initially. We currently don't print it if the test already existed. Not sure if we should.

#[kani::proof]
pub fn harness() {
let x: i32 = kani::any();
kani::cover!(x != 0 && x / 2 == 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this check to have only one satisfying value, so we avoid having to change the test whenever CBMC decides to produce a different value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Done.

@zhassan-aws zhassan-aws merged commit 7f232fe into model-checking:main Jan 18, 2023
@zhassan-aws zhassan-aws deleted the concrete-playback-cover branch January 18, 2023 23:47
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.

Support concrete playback for kani::cover

2 participants