Add SMTCheckerTest for isoltest

This commit is contained in:
Leonardo Alt
2019-12-09 15:32:08 +01:00
parent 3e8584bd21
commit 225041738e
14 changed files with 204 additions and 35 deletions
+16 -8
View File
@@ -48,7 +48,8 @@ CHC::CHC(
#else
m_interface(make_shared<smt::CHCSmtLib2Interface>(_smtlib2Responses)),
#endif
m_outerErrorReporter(_errorReporter)
m_outerErrorReporter(_errorReporter),
m_enabledSolvers(_enabledSolvers)
{
(void)_smtlib2Responses;
(void)_enabledSolvers;
@@ -58,15 +59,22 @@ void CHC::analyze(SourceUnit const& _source)
{
solAssert(_source.annotation().experimentalFeatures.count(ExperimentalFeature::SMTChecker), "");
bool usesZ3 = false;
#ifdef HAVE_Z3
auto z3Interface = dynamic_pointer_cast<smt::Z3CHCInterface>(m_interface);
solAssert(z3Interface, "");
m_context.setSolver(z3Interface->z3Interface());
#else
auto smtlib2Interface = dynamic_pointer_cast<smt::CHCSmtLib2Interface>(m_interface);
solAssert(smtlib2Interface, "");
m_context.setSolver(smtlib2Interface->smtlib2Interface());
usesZ3 = m_enabledSolvers.z3;
if (usesZ3)
{
auto z3Interface = dynamic_pointer_cast<smt::Z3CHCInterface>(m_interface);
solAssert(z3Interface, "");
m_context.setSolver(z3Interface->z3Interface());
}
#endif
if (!usesZ3)
{
auto smtlib2Interface = dynamic_pointer_cast<smt::CHCSmtLib2Interface>(m_interface);
solAssert(smtlib2Interface, "");
m_context.setSolver(smtlib2Interface->smtlib2Interface());
}
m_context.clear();
m_context.setAssertionAccumulation(false);
m_variableUsage.setFunctionInlining(false);
+3
View File
@@ -208,6 +208,9 @@ private:
/// ErrorReporter that comes from CompilerStack.
langutil::ErrorReporter& m_outerErrorReporter;
/// SMT solvers that are chosen at runtime.
smt::SMTSolverChoice m_enabledSolvers;
};
}
+12
View File
@@ -46,3 +46,15 @@ vector<string> ModelChecker::unhandledQueries()
{
return m_bmc.unhandledQueries() + m_chc.unhandledQueries();
}
smt::SMTSolverChoice ModelChecker::availableSolvers()
{
smt::SMTSolverChoice available = smt::SMTSolverChoice::None();
#ifdef HAVE_Z3
available.z3 = true;
#endif
#ifdef HAVE_CVC4
available.cvc4 = true;
#endif
return available;
}
+3
View File
@@ -59,6 +59,9 @@ public:
/// the constructor.
std::vector<std::string> unhandledQueries();
/// @returns SMT solvers that are available via the C++ API.
static smt::SMTSolverChoice availableSolvers();
private:
/// Bounded Model Checker engine.
BMC m_bmc;