35 using namespace SVFUtil;
49 testsValidation(slice);
61 validateSuccessTests(slice,fun);
62 validateExpectedFailureTests(slice,fun);
72 if(fun->
getName() ==
"SAFEMALLOC")
77 else if(fun->
getName() ==
"DOUBLEFREEMALLOC")
82 else if(fun->
getName() ==
"DOUBLEFREEMALLOCFN" || fun->
getName() ==
"SAFEMALLOCFP")
88 writeWrnMsg(
"\t can not validate, check function not found, please put it at the right place!!");
96 outs() <<
sucMsg(
"\t SUCCESS :") << funName <<
" check <src id:" << source->
getId()
97 <<
", cs id:" << (getSrcCSID(source))->valueOnlyToString() <<
"> at ("
104 <<
", cs id:" << (getSrcCSID(source))->valueOnlyToString() <<
"> at ("
107 assert(
false &&
"test case failed!");
116 bool expectedFailure =
false;
118 if(fun->
getName() ==
"DOUBLEFREEMALLOCFN")
121 expectedFailure =
true;
123 else if(fun->
getName() ==
"SAFEMALLOCFP")
126 expectedFailure =
true;
128 else if(fun->
getName() ==
"SAFEMALLOC" || fun->
getName() ==
"DOUBLEFREEMALLOC")
134 writeWrnMsg(
"\t can not validate, check function not found, please put it at the right place!!");
142 outs() <<
sucMsg(
"\t EXPECTED-FAILURE :") << funName <<
" check <src id:" << source->
getId()
143 <<
", cs id:" << (getSrcCSID(source))->valueOnlyToString() <<
"> at ("
150 <<
" check <src id:" << source->
getId()
151 <<
", cs id:" << (getSrcCSID(source))->valueOnlyToString() <<
"> at ("
154 assert(
false &&
"test case failed!");
const SVFFunction * getCalledFunction() const
const std::string getSourceLoc() const override
void testsValidation(ProgSlice *slice)
Validate test cases for regression test purpose.
void validateSuccessTests(ProgSlice *slice, const SVFFunction *fun)
void validateExpectedFailureTests(ProgSlice *slice, const SVFFunction *fun)
void reportBug(ProgSlice *slice) override
Report file/close bugs.
std::vector< SVFBugEvent > EventStack
static const Option< bool > ValidateTests
void evalFinalCond2Event(GenericBug::EventStack &eventStack) const
Add final condition to eventStack.
bool isSatisfiableForPairs()
const SVFGNode * getSource() const
root and sink operations
std::string evalFinalCond() const
Evaluate final condition.
NodeID getId() const
Get ID.
const std::string & getName() const
virtual const SVFFunction * getFun() const
Get the function of this SVFGNode.
std::string sucMsg(const std::string &msg)
Returns successful message by converting a string into green string output.
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & errs()
Overwrite llvm::errs()
std::ostream & outs()
Overwrite llvm::outs()