Skip to content

Commit 895ce57

Browse files
Stop-on-fail verifier with fault localization
Variant that reports fault localization information.
1 parent 7d527ef commit 895ce57

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Verifier for stopping at the first failing property
4+
and localizing the fault
5+
6+
Author: Daniel Kroening, Peter Schrammel
7+
8+
\*******************************************************************/
9+
10+
/// \file
11+
/// Goto Verifier for stopping at the first failing property
12+
/// and localizing the fault
13+
14+
#ifndef CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_WITH_FAULT_LOCALIZATION_H
15+
#define CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_WITH_FAULT_LOCALIZATION_H
16+
17+
#include "bmc_util.h"
18+
#include "fault_localization_provider.h"
19+
#include "goto_verifier.h"
20+
21+
/// Stops when the first failing property is found and localizes the fault
22+
/// Requires an incremental goto checker that is a
23+
/// `goto_trace_providert` and `fault_localization_providert`.
24+
template <class incremental_goto_checkerT>
25+
class stop_on_fail_verifier_with_fault_localizationt : public goto_verifiert
26+
{
27+
public:
28+
stop_on_fail_verifier_with_fault_localizationt(
29+
const optionst &options,
30+
ui_message_handlert &ui_message_handler,
31+
abstract_goto_modelt &goto_model)
32+
: goto_verifiert(options, ui_message_handler),
33+
goto_model(goto_model),
34+
incremental_goto_checker(options, ui_message_handler, goto_model)
35+
{
36+
properties = std::move(initialize_properties(goto_model));
37+
}
38+
39+
resultt operator()() override
40+
{
41+
(void)incremental_goto_checker(properties);
42+
return determine_result(properties);
43+
}
44+
45+
void report() override
46+
{
47+
switch(determine_result(properties))
48+
{
49+
case resultt::PASS:
50+
report_success(ui_message_handler);
51+
break;
52+
53+
case resultt::FAIL:
54+
{
55+
const goto_tracet goto_trace =
56+
incremental_goto_checker.build_shortest_trace();
57+
const fault_location_infot fault_location =
58+
incremental_goto_checker.localize_fault(
59+
goto_trace.get_last_step().property_id);
60+
61+
output_error_trace_with_fault_localization(
62+
goto_trace,
63+
incremental_goto_checker.get_namespace(),
64+
trace_optionst(options),
65+
fault_location,
66+
ui_message_handler);
67+
68+
report_failure(ui_message_handler);
69+
break;
70+
}
71+
72+
case resultt::UNKNOWN:
73+
report_inconclusive(ui_message_handler);
74+
break;
75+
76+
case resultt::ERROR:
77+
report_error(ui_message_handler);
78+
break;
79+
}
80+
}
81+
82+
protected:
83+
abstract_goto_modelt &goto_model;
84+
incremental_goto_checkerT incremental_goto_checker;
85+
};
86+
87+
#endif // CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_WITH_FAULT_LOCALIZATION_H

0 commit comments

Comments
 (0)