@@ -50,6 +50,7 @@ class GlobalMessages(str, Enum):
50
50
REACH_CHECK_DESC = "[KANI_REACHABILITY_CHECK]"
51
51
REACH_CHECK_KEY = "reachCheckResult"
52
52
CHECK_ID = "KANI_CHECK_ID"
53
+ CHECK_ID_RE = CHECK_ID + r"_.*_([0-9])*"
53
54
UNSUPPORTED_CONSTRUCT_DESC = "is not currently supported by Kani"
54
55
UNWINDING_ASSERT_DESC = "unwinding assertion loop"
55
56
@@ -300,7 +301,9 @@ def postprocess_results(properties, extra_ptr_check):
300
301
property ["status" ] = "UNDETERMINED"
301
302
elif GlobalMessages .REACH_CHECK_KEY in property and property [GlobalMessages .REACH_CHECK_KEY ] == "SUCCESS" :
302
303
# Change SUCCESS to UNREACHABLE
303
- assert property ["status" ] == "SUCCESS" , "** ERROR: Expecting an unreachable property to have a status of \" SUCCESS\" "
304
+ description = property ["description" ]
305
+ assert property [
306
+ "status" ] == "SUCCESS" , f"** ERROR: Expecting the unreachable property \" { description } \" to have a status of \" SUCCESS\" "
304
307
property ["status" ] = "UNREACHABLE"
305
308
306
309
messages = ""
@@ -517,7 +520,7 @@ def annotate_properties_with_reach_results(properties, reach_checks):
517
520
for reach_check in reach_checks :
518
521
description = reach_check ["description" ]
519
522
# Extract the ID of the assert from the description
520
- match_obj = re .search (GlobalMessages .CHECK_ID + r"_.*_([0-9])*" , description )
523
+ match_obj = re .search (GlobalMessages .CHECK_ID_RE , description )
521
524
if not match_obj :
522
525
raise Exception ("Error: failed to extract check ID for reachability check \" " + description + "\" " )
523
526
check_id = match_obj .group (0 )
@@ -531,8 +534,13 @@ def get_matching_property(properties, check_id):
531
534
Find the property with the given ID
532
535
"""
533
536
for property in properties :
534
- if check_id in property ["description" ]:
535
- return property
537
+ description = property ["description" ]
538
+ match_obj = re .search ("\\ [" + GlobalMessages .CHECK_ID_RE + "\\ ]" , description )
539
+ # Currently, not all properties have a check ID
540
+ if match_obj :
541
+ prop_check_id = match_obj .group (0 )
542
+ if prop_check_id == "[" + check_id + "]" :
543
+ return property
536
544
raise Exception ("Error: failed to find a property with ID \" " + check_id + "\" " )
537
545
538
546
@@ -551,7 +559,7 @@ def remove_check_ids_from_description(properties):
551
559
they're not shown to the user. The removal of the IDs should only be done
552
560
after all ID-based post-processing is done.
553
561
"""
554
- check_id_pattern = re .compile (r"\[" + GlobalMessages .CHECK_ID + r"_.*_[0-9]* \] " )
562
+ check_id_pattern = re .compile (r"\[" + GlobalMessages .CHECK_ID_RE + r"\] " )
555
563
for property in properties :
556
564
property ["description" ] = re .sub (check_id_pattern , "" , property ["description" ])
557
565
0 commit comments