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

Concrete playback should be able to generate multiple tests at once #2461

Closed
celinval opened this issue May 23, 2023 · 0 comments · Fixed by #2496
Closed

Concrete playback should be able to generate multiple tests at once #2461

celinval opened this issue May 23, 2023 · 0 comments · Fixed by #2496
Assignees
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.

Comments

@celinval
Copy link
Contributor

Requested feature: When handling multiple failures / cover checks, concrete playback should be able to generate one test per property.
Use case: Users will likely need to debug multiple failures or they may want to extract tests for multiple covers today. Today, there is no way to control which property Kani generate the test for.
Link to relevant documentation (Rust reference, Nomicon, RFC):

Test case:

// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Check that Kani correctly adds tests to the cover checks reachable in a harness.
extern crate kani;

#[cfg(kani)]
mod verify {
    use std::num::NonZeroU8;
    use std::convert::TryFrom;
    use kani::cover;

    #[kani::proof]
    fn try_nz_u8() {
        let val: u8 = kani::any();
        let result = NonZeroU8::try_from(val);
        match result {
            Ok(nz_val) => {
                cover!(true, "Ok");      // Cover 1
                assert_eq!(nz_val.get(), val);
            },
            Err(_) => {
                cover!(true, "Not ok");  // Cover 2
                assert_eq!(val, 0);
            }
        }
    }
}

I expect Kani to generate two different test cases for this harness. But it instead generates one test, and the following warning:

WARNING: Unable to extract concrete values from multiple failing assertions. Skipping property `verify::try_nz_u8.cover.2` with descr
iption `Ok`

Note: We should also update the warning, since concrete playback now supports different property type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.
Projects
No open projects
Status: Done
2 participants