Skip to content

Commit eda5f14

Browse files
committed
JBMC: support validation
This invokes validation using the same arguments as CBMC.
1 parent 249fb3f commit eda5f14

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,16 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
369369
"symex-coverage-report",
370370
cmdline.get_value("symex-coverage-report"));
371371

372+
if(cmdline.isset("validate-ssa-equation"))
373+
{
374+
options.set_option("validate-ssa-equation", true);
375+
}
376+
377+
if(cmdline.isset("validate-goto-model"))
378+
{
379+
options.set_option("validate-goto-model", true);
380+
}
381+
372382
PARSE_OPTIONS_GOTO_TRACE(cmdline, options);
373383

374384
if(cmdline.isset("no-lazy-methods"))
@@ -553,6 +563,11 @@ int jbmc_parse_optionst::doit()
553563
if(set_properties(goto_model))
554564
return 7; // should contemplate EX_USAGE from sysexits.h
555565

566+
if(cmdline.isset("validate-goto-model"))
567+
{
568+
goto_model.validate(validation_modet::INVARIANT);
569+
}
570+
556571
// The `configure_bmc` callback passed will enable enum-unwind-static if
557572
// applicable.
558573
return bmct::do_language_agnostic_bmc(
@@ -585,6 +600,11 @@ int jbmc_parse_optionst::doit()
585600
// particular function:
586601
add_failed_symbols(lazy_goto_model.symbol_table);
587602

603+
if(cmdline.isset("validate-goto-model"))
604+
{
605+
lazy_goto_model.validate(validation_modet::INVARIANT);
606+
}
607+
588608
// Provide show-goto-functions and similar dump functions after symex
589609
// executes. If --paths is active, these dump routines run after every
590610
// paths iteration. Its return value indicates that if we ran any dump
@@ -1141,6 +1161,7 @@ void jbmc_parse_optionst::help()
11411161
" --version show version and exit\n"
11421162
" --xml-ui use XML-formatted output\n"
11431163
" --json-ui use JSON-formatted output\n"
1164+
HELP_VALIDATE
11441165
HELP_GOTO_TRACE
11451166
HELP_FLUSH
11461167
" --verbosity # verbosity level\n"

jbmc/src/jbmc/jbmc_parse_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/ui_message.h>
1616
#include <util/parse_options.h>
1717
#include <util/timestamper.h>
18+
#include <util/validation_interface.h>
1819

1920
#include <langapi/language.h>
2021

@@ -80,6 +81,7 @@ class optionst;
8081
"(localize-faults)(localize-faults-method):" \
8182
"(java-threading)" \
8283
OPT_GOTO_TRACE \
84+
OPT_VALIDATE \
8385
"(symex-driven-lazy-loading)"
8486
// clang-format on
8587

0 commit comments

Comments
 (0)