Skip to content

Commit

Permalink
Report results as UNDETERMINED instead of SUCCESS if an unwinding ass…
Browse files Browse the repository at this point in the history
…ertion fails (#889)
  • Loading branch information
zhassan-aws authored and tedinski committed Mar 4, 2022
1 parent 28baca5 commit b1a547e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
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`.

0 comments on commit b1a547e

Please sign in to comment.