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

Report results as UNDETERMINED instead of SUCCESS if an unwinding assertion fails #889

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions scripts/cbmc_json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,14 @@ def postprocess_results(properties):
annotate_properties_with_reach_results(properties, reach_checks)

for property in properties:
if has_reachable_unsupported_constructs:
if has_reachable_unsupported_constructs or has_failed_unwinding_asserts:
# Change SUCCESS to UNDETERMINED for all properties
if property["status"] == "SUCCESS":
property["status"] = "UNDETERMINED"
elif GlobalMessages.REACH_CHECK_KEY in property and property[GlobalMessages.REACH_CHECK_KEY] == "SUCCESS":
# Change SUCCESS to UNREACHABLE
assert property["status"] == "SUCCESS", "** ERROR: Expecting an unreachable property to have a status of \"SUCCESS\""
property["status"] = "UNREACHABLE"
# TODO: Handle unwinding assertion failure

messages = ""
if has_reachable_unsupported_constructs:
Expand Down
3 changes: 3 additions & 0 deletions tests/expected/report/insufficient_unwind/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
UNDETERMINED
[Kani] info: Verification output shows one or more unwinding failures.
[Kani] tip: Consider increasing the unwinding value or disabling `--unwinding-assertions`.
18 changes: 18 additions & 0 deletions tests/expected/report/insufficient_unwind/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT

// This test checks that Kani reports UNDETERMINED if the specified unwinding is
// insufficient. The minimum required unwinding is 7.

// kani-flags: --unwind 6

fn main() {
let x: bool = kani::any();
let v = if x { vec![1, 2, 3] } else { vec![1, 1, 1, 1, 1, 1] };

let mut sum = 0;
for i in v {
sum += i;
}
assert!(sum == 6);
}
1 change: 1 addition & 0 deletions tests/expected/unwind_tip/expected
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
UNDETERMINED
[Kani] info: Verification output shows one or more unwinding failures.
[Kani] tip: Consider increasing the unwinding value or disabling `--unwinding-assertions`.