-
Notifications
You must be signed in to change notification settings - Fork 277
Stop-on-fail verifier [blocks: 3968] #3796
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
Merged
tautschnig
merged 6 commits into
diffblue:develop
from
peterschrammel:stop-on-fail-verifier
Feb 1, 2019
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9901817
Add stop-on-fail verifier
peterschrammel 2e84e22
Use goto verifier for stop-on-fail in CBMC
peterschrammel dc6a46c
Use goto verifier for stop-on-fail in JBMC
peterschrammel 9ad2f6c
Use goto verifier for dimacs and SMT2 outfile in CBMC
peterschrammel 1e0323e
Use goto verifier for dimacs and SMT2 outfile in JBMC
peterschrammel 3b71199
Amend goto-checker docs
peterschrammel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,16 +19,18 @@ Author: Daniel Kroening, [email protected] | |
#include <util/config.h> | ||
#include <util/exit_codes.h> | ||
#include <util/invariant.h> | ||
#include <util/make_unique.h> | ||
#include <util/unicode.h> | ||
#include <util/xml.h> | ||
#include <util/version.h> | ||
#include <util/xml.h> | ||
|
||
#include <langapi/language.h> | ||
|
||
#include <ansi-c/ansi_c_language.h> | ||
|
||
#include <goto-checker/all_properties_verifier.h> | ||
#include <goto-checker/all_properties_verifier_with_trace_storage.h> | ||
#include <goto-checker/stop_on_fail_verifier.h> | ||
|
||
#include <goto-programs/adjust_float_expressions.h> | ||
#include <goto-programs/lazy_goto_model.h> | ||
|
@@ -566,11 +568,33 @@ int jbmc_parse_optionst::doit() | |
} | ||
} | ||
|
||
if( | ||
options.get_bool_option("dimacs") || | ||
!options.get_option("outfile").empty()) | ||
{ | ||
if(!options.get_bool_option("paths")) | ||
{ | ||
stop_on_fail_verifiert<multi_path_symex_checkert> verifier( | ||
options, ui_message_handler, goto_model); | ||
(void)verifier(); | ||
return CPROVER_EXIT_SUCCESS; | ||
} | ||
} | ||
|
||
std::unique_ptr<goto_verifiert> verifier = nullptr; | ||
|
||
if(!options.get_bool_option("paths") && !options.is_set("cover")) | ||
if( | ||
!options.get_bool_option("paths") && !options.is_set("cover") && | ||
!options.get_bool_option("dimacs") && | ||
options.get_option("outfile").empty()) | ||
{ | ||
if(!options.get_bool_option("stop-on-fail")) | ||
if(options.get_bool_option("stop-on-fail")) | ||
{ | ||
verifier = util_make_unique< | ||
stop_on_fail_verifiert<java_multi_path_symex_checkert>>( | ||
options, ui_message_handler, goto_model); | ||
} | ||
else | ||
{ | ||
verifier = util_make_unique<all_properties_verifier_with_trace_storaget< | ||
java_multi_path_symex_checkert>>( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ Author: Daniel Kroening, [email protected] | |
#include <util/exception_utils.h> | ||
#include <util/exit_codes.h> | ||
#include <util/invariant.h> | ||
#include <util/make_unique.h> | ||
#include <util/unicode.h> | ||
#include <util/version.h> | ||
|
||
|
@@ -38,6 +39,7 @@ Author: Daniel Kroening, [email protected] | |
#include <goto-checker/multi_path_symex_checker.h> | ||
#include <goto-checker/multi_path_symex_only_checker.h> | ||
#include <goto-checker/properties.h> | ||
#include <goto-checker/stop_on_fail_verifier.h> | ||
|
||
#include <goto-programs/adjust_float_expressions.h> | ||
#include <goto-programs/initialize_goto_model.h> | ||
|
@@ -564,11 +566,31 @@ int cbmc_parse_optionst::doit() | |
} | ||
} | ||
|
||
if( | ||
options.get_bool_option("dimacs") || !options.get_option("outfile").empty()) | ||
{ | ||
if(!options.get_bool_option("paths")) | ||
{ | ||
stop_on_fail_verifiert<multi_path_symex_checkert> verifier( | ||
options, ui_message_handler, goto_model); | ||
(void)verifier(); | ||
return CPROVER_EXIT_SUCCESS; | ||
} | ||
} | ||
|
||
std::unique_ptr<goto_verifiert> verifier = nullptr; | ||
|
||
if(!options.get_bool_option("paths") && !options.is_set("cover")) | ||
if( | ||
!options.get_bool_option("paths") && !options.is_set("cover") && | ||
!options.get_bool_option("dimacs") && options.get_option("outfile").empty()) | ||
{ | ||
if(!options.get_bool_option("stop-on-fail")) | ||
if(options.get_bool_option("stop-on-fail")) | ||
{ | ||
verifier = | ||
util_make_unique<stop_on_fail_verifiert<multi_path_symex_checkert>>( | ||
options, ui_message_handler, goto_model); | ||
} | ||
else | ||
{ | ||
verifier = util_make_unique< | ||
all_properties_verifier_with_trace_storaget<multi_path_symex_checkert>>( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Goto Verifier for stopping at the first failing property | ||
|
||
Author: Daniel Kroening, Peter Schrammel | ||
|
||
\*******************************************************************/ | ||
|
||
/// \file | ||
/// Goto Verifier for stopping at the first failing property | ||
|
||
#ifndef CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H | ||
#define CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H | ||
|
||
#include "bmc_util.h" | ||
#include "goto_verifier.h" | ||
|
||
/// Stops when the first failing property is found. | ||
/// Requires an incremental goto checker that is a | ||
/// `goto_trace_providert` and `witness_providert`. | ||
template <class incremental_goto_checkerT> | ||
class stop_on_fail_verifiert : public goto_verifiert | ||
{ | ||
public: | ||
stop_on_fail_verifiert( | ||
const optionst &options, | ||
ui_message_handlert &ui_message_handler, | ||
abstract_goto_modelt &goto_model) | ||
: goto_verifiert(options, ui_message_handler), | ||
goto_model(goto_model), | ||
incremental_goto_checker(options, ui_message_handler, goto_model) | ||
{ | ||
properties = std::move(initialize_properties(goto_model)); | ||
} | ||
|
||
resultt operator()() override | ||
{ | ||
(void)incremental_goto_checker(properties); | ||
return determine_result(properties); | ||
} | ||
|
||
void report() override | ||
{ | ||
switch(determine_result(properties)) | ||
{ | ||
case resultt::PASS: | ||
report_success(ui_message_handler); | ||
incremental_goto_checker.output_proof(); | ||
break; | ||
|
||
case resultt::FAIL: | ||
{ | ||
goto_tracet goto_trace = incremental_goto_checker.build_trace(); | ||
output_error_trace( | ||
goto_trace, | ||
incremental_goto_checker.get_namespace(), | ||
trace_optionst(options), | ||
ui_message_handler); | ||
report_failure(ui_message_handler); | ||
incremental_goto_checker.output_error_witness(goto_trace); | ||
break; | ||
} | ||
|
||
case resultt::UNKNOWN: | ||
report_inconclusive(ui_message_handler); | ||
break; | ||
|
||
case resultt::ERROR: | ||
report_error(ui_message_handler); | ||
break; | ||
} | ||
} | ||
|
||
protected: | ||
abstract_goto_modelt &goto_model; | ||
incremental_goto_checkerT incremental_goto_checker; | ||
}; | ||
|
||
#endif // CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.