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=inplace produces unit test inside the harness #2450

Closed
jaisnan opened this issue May 18, 2023 · 1 comment · Fixed by #2454
Closed

Concrete Playback=inplace produces unit test inside the harness #2450

jaisnan opened this issue May 18, 2023 · 1 comment · Fixed by #2454
Assignees
Labels
[C] Bug This is a bug. Something isn't working. [F] Crash Kani crashed T-High Priority Tag issues that have high priority

Comments

@jaisnan
Copy link
Contributor

jaisnan commented May 18, 2023

When I invoke concrete playback with Kani 0.28, the unit test is produced inside the harness instead of after it. Happens regardless of where the harness is placed (inside a module, outside of it).

using the following command line invocation:

kani /home/ubuntu/rectangle_example/src/main.rs --harness stretched_rectangle_can_hold_original --enable-unstable --concrete-playback=inplace

with Kani version: 0.28

I expected to see this happen: the unit test should be placed after the harness

    #[kani::proof]
    pub fn stretched_rectangle_can_hold_original() {
        let original = Rectangle {
            width: kani::any(),
            height: kani::any(),
        };
        let factor = kani::any();
        if let Some(larger) = original.stretch(factor) {
            assert!(larger.can_hold(&original));
        }
    }
    #[test]
    fn kani_concrete_playback_stretched_rectangle_can_hold_original_7840735556438970593() {
        let concrete_vals: Vec<Vec<u8>> = vec![
            // 0ul
            vec![0, 0, 0, 0, 0, 0, 0, 0],
            // 1ul
            vec![1, 0, 0, 0, 0, 0, 0, 0],
            // 9223372036854841360ul
            vec![16, 0, 1, 0, 0, 0, 0, 128],
        ];
        kani::concrete_playback_run(concrete_vals, stretched_rectangle_can_hold_original);
   }

Instead, this happened: the unit test was placed inside the harness

    #[kani::proof]
    pub fn stretched_rectangle_can_hold_original() {
      #[test]
      fn kani_concrete_playback_stretched_rectangle_can_hold_original_7840735556438970593() {
          let concrete_vals: Vec<Vec<u8>> = vec![
              // 0ul
              vec![0, 0, 0, 0, 0, 0, 0, 0],
              // 1ul
              vec![1, 0, 0, 0, 0, 0, 0, 0],
              // 9223372036854841360ul
              vec![16, 0, 1, 0, 0, 0, 0, 128],
          ];
          kani::concrete_playback_run(concrete_vals, stretched_rectangle_can_hold_original);
     }
        let original = Rectangle {
            width: kani::any(),
            height: kani::any(),
        };
        let factor = kani::any();
        if let Some(larger) = original.stretch(factor) {
            assert!(larger.can_hold(&original));
        }
    }
@jaisnan jaisnan added the [C] Bug This is a bug. Something isn't working. label May 18, 2023
@jaisnan
Copy link
Contributor Author

jaisnan commented May 18, 2023

Note: Installed kani 0.27.0 and the issue disappeared.

@celinval celinval added [F] Crash Kani crashed T-High Priority Tag issues that have high priority labels May 18, 2023
@celinval celinval self-assigned this May 19, 2023
celinval added a commit to celinval/kani-dev that referenced this issue May 23, 2023
@celinval celinval moved this to Done in Kani 2023-05-29 May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working. [F] Crash Kani crashed T-High Priority Tag issues that have high priority
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants