[infer][clang] test reporting of assertion failures

master
jrm 10 years ago
parent 5912e607ff
commit 1356fd331f

@ -236,7 +236,12 @@ def should_report(analyzer, row):
] ]
null_style_buckets = ['B1', 'B2'] null_style_buckets = ['B1', 'B2']
other_bugs = ['RESOURCE_LEAK', 'MEMORY_LEAK', 'RETAIN_CYCLE'] other_bugs = [
'RESOURCE_LEAK',
'MEMORY_LEAK',
'RETAIN_CYCLE',
'ASSERTION_FAILURE'
]
if analyzer in [ERADICATE, CHECKERS, TRACING]: if analyzer in [ERADICATE, CHECKERS, TRACING]:
# report all issues for eradicate and checkers # report all issues for eradicate and checkers

@ -345,7 +345,7 @@ let arc_mode = ref false
let objc_memory_model_on = ref false let objc_memory_model_on = ref false
let report_assertion_failure = from_env_variable "INFER_REPORT_ASSERTION_FAILURE" let report_assertion_failure = from_env_variable "INFER_REPORT_ASSERTION_FAILURE"
let default_failure_name = "Assertion_failure" let default_failure_name = "ASSERTION_FAILURE"
let analyze_models = from_env_variable "INFER_ANALYZE_MODELS" let analyze_models = from_env_variable "INFER_ANALYZE_MODELS"

@ -1055,7 +1055,8 @@ let analyze_proc exe_env (proc_name: Procname.t) : Specs.summary =
let prev_summary = Specs.get_summary_unsafe proc_name in let prev_summary = Specs.get_summary_unsafe proc_name in
let updated_summary = let updated_summary =
update_summary prev_summary specs proc_name elapsed res in update_summary prev_summary specs proc_name elapsed res in
if (Config.report_assertion_failure || !Config.report_runtime_exceptions) then if (!Sil.curr_language <> Sil.Java && Config.report_assertion_failure)
|| !Config.report_runtime_exceptions then
report_runtime_exceptions tenv cfg proc_desc updated_summary; report_runtime_exceptions tenv cfg proc_desc updated_summary;
updated_summary updated_summary

@ -50,7 +50,7 @@ void __infer_fail(char*);
void my_assert(int x) { void my_assert(int x) {
if (!x) { if (!x) {
__infer_fail("Assertion_failure"); __infer_fail("ASSERTION_FAILURE");
} }
} }

@ -1,5 +1,5 @@
digraph iCFG { digraph iCFG {
69 [label="69: Assertion failure \n _fun___infer_fail(\"Assertion_failure\":void ) [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"] 69 [label="69: Assertion failure \n _fun___infer_fail(\"ASSERTION_FAILURE\":void ) [line 32]\n APPLY_ABSTRACTION; [line 32]\n " shape="box"]
69 -> 56 ; 69 -> 56 ;
@ -61,7 +61,7 @@ digraph iCFG {
55 -> 58 ; 55 -> 58 ;
54 [label="54: Assertion failure \n _fun___infer_fail(\"Assertion_failure\":void ) [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] 54 [label="54: Assertion failure \n _fun___infer_fail(\"ASSERTION_FAILURE\":void ) [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"]
54 -> 40 ; 54 -> 40 ;
@ -149,7 +149,7 @@ digraph iCFG {
33 -> 35 ; 33 -> 35 ;
32 [label="32: Assertion failure \n _fun___infer_fail(\"Assertion_failure\":void ) [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] 32 [label="32: Assertion failure \n _fun___infer_fail(\"ASSERTION_FAILURE\":void ) [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"]
32 -> 18 ; 32 -> 18 ;
@ -215,7 +215,7 @@ digraph iCFG {
17 -> 20 ; 17 -> 20 ;
16 [label="16: Assertion failure \n _fun___infer_fail(\"Assertion_failure\":void ) [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] 16 [label="16: Assertion failure \n _fun___infer_fail(\"ASSERTION_FAILURE\":void ) [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"]
16 -> 2 ; 16 -> 2 ;

@ -21,7 +21,7 @@ public class AssertionFailureTest {
public static final String SOURCE_FILE = public static final String SOURCE_FILE =
"assertions/assertion_failure.c"; "assertions/assertion_failure.c";
public static final String ASSERTION_FAILURE = "Assertion_failure"; public static final String ASSERTION_FAILURE = "ASSERTION_FAILURE";
private static InferResults inferResults; private static InferResults inferResults;

Loading…
Cancel
Save