Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Parse the output of the tool and extract the verification result.
This method always needs to be overridden.
If the tool gave a result, this method needs to return one of the
benchexec.result.RESULT_* strings.
Otherwise an arbitrary string can be returned that will be shown to the user
and should give some indication of the failure reason
(e.g., "CRASH", "OUT_OF_MEMORY", etc.).
"""
for line in reversed(output):
if line.startswith("ERROR:"):
if "timeout" in line.lower():
return "TIMEOUT"
else:
return "ERROR ({0})".format(returncode)
elif line.startswith("Result: FALSE"):
return result.RESULT_FALSE_REACH
elif line.startswith("Result: TRUE"):
return result.RESULT_TRUE_PROP
elif line.startswith("Result: DONE"):
return result.RESULT_DONE
elif line.startswith("Result: ERROR"):
# matches ERROR and ERROR followed by some reason in parantheses
# e.g., "ERROR (TRUE)" or "ERROR(TRUE)"
return re.search(r"ERROR(\s*\(.*\))?", line).group(0)
return result.RESULT_UNKNOWN
Parse the output of the tool and extract the verification result.
This method always needs to be overridden.
If the tool gave a result, this method needs to return one of the
benchexec.result.RESULT_* strings.
Otherwise an arbitrary string can be returned that will be shown to the user
and should give some indication of the failure reason
(e.g., "CRASH", "OUT_OF_MEMORY", etc.).
"""
for line in reversed(output):
if line.startswith("ERROR:"):
if "timeout" in line.lower():
return "TIMEOUT"
else:
return "ERROR ({0})".format(returncode)
elif line.startswith("Result:") and "FALSE" in line:
return result.RESULT_FALSE_REACH
elif line.startswith("Result:") and "TRUE" in line:
return result.RESULT_TRUE_PROP
elif line.startswith("Result") and "DONE" in line:
return result.RESULT_DONE
return result.RESULT_UNKNOWN
def determine_result(self, returncode, returnsignal, output, isTimeOut):
try:
for line in output:
if line.startswith("No bug found"):
return result.RESULT_TRUE_PROP
elif line.startswith("Bug found:"):
return result.RESULT_FALSE_REACH
return result.RESULT_UNKNOWN
except Exception:
return result.RESULT_UNKNOWN
def determine_result(self, returncode, returnsignal, output, isTimeout):
if "TRUE\n" in output:
status = result.RESULT_TRUE_PROP
elif "FALSE\n" in output:
status = result.RESULT_FALSE_REACH
else:
status = result.RESULT_UNKNOWN
return status
elif msg:
status = "ERROR ({0})".format(msg)
else:
status = "ERROR"
else:
status = "INVALID OUTPUT"
elif status == "FAILURE":
assert returncode == 10
reason = tree.find("goto_trace").find("failure").findtext("reason")
if not reason:
reason = tree.find("goto_trace").find("failure").get("reason")
if "unwinding assertion" in reason:
status = result.RESULT_UNKNOWN
else:
status = result.RESULT_FALSE_REACH
elif status == "SUCCESS":
assert returncode == 0
if "--unwinding-assertions" in self.options:
status = result.RESULT_TRUE_PROP
else:
status = result.RESULT_UNKNOWN
except Exception:
if isTimeout:
# in this case an exception is expected as the XML is invalid
status = "TIMEOUT"
elif "Minisat::OutOfMemoryException" in output:
status = "OUT OF MEMORY"
else:
status = "INVALID OUTPUT"
def determine_result(self, returncode, returnsignal, output, isTimeout):
lines = " ".join(output)
if "consequence_unsafe" in lines:
return result.RESULT_FALSE_REACH
elif "consequence_safe" in lines:
return result.RESULT_TRUE_PROP
elif "consequence_unknown" in lines:
return result.RESULT_UNKNOWN
else:
return result.RESULT_ERROR
def determine_result(self, returncode, returnsignal, output, isTimeout):
"""
Returns a BenchExec result status based on the output of SMACK
"""
splitout = "\n".join(output)
if re.search(r'SMACK found no errors.', splitout):
return result.RESULT_TRUE_PROP
elif re.search(r'SMACK found an error.*', splitout):
return result.RESULT_FALSE_REACH
else:
return result.RESULT_UNKNOWN
def determine_result(self, returncode, returnsignal, output, isTimeout):
output = "\n".join(output)
if "VERIFICATION SUCCESSFUL" in output:
assert returncode == 0
status = result.RESULT_TRUE_PROP
elif "VERIFICATION FAILED" in output:
assert returncode == 10
status = result.RESULT_FALSE_REACH
elif returnsignal == 9:
status = "TIMEOUT"
elif returnsignal == 6 or (returncode == 6 and "Out of memory" in output):
status = "OUT OF MEMORY"
elif returncode == 6 and "PARSING ERROR" in output:
status = "PARSING ERROR"
else:
status = "FAILURE"
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
status = result.RESULT_UNKNOWN
for line in output:
if line.startswith("Verification result:("):
line = line[21:].strip()
if line.startswith("TRUE"):
status = result.RESULT_TRUE_PROP
elif line.startswith("FALSE"):
status = result.RESULT_FALSE_REACH
else:
status = result.RESULT_UNKNOWN
return status
for line in output:
line = line.strip()
if line == "TRUE":
return result.RESULT_TRUE_PROP
elif line == "UNKNOWN":
return result.RESULT_UNKNOWN
elif line.startswith("FALSE (valid-deref)"):
return result.RESULT_FALSE_DEREF
elif line.startswith("FALSE (valid-free)"):
return result.RESULT_FALSE_FREE
elif line.startswith("FALSE (valid-memtrack)"):
return result.RESULT_FALSE_MEMTRACK
elif line.startswith("FALSE (overflow)"):
return result.RESULT_FALSE_OVERFLOW
elif line.startswith("FALSE"):
return result.RESULT_FALSE_REACH
return result.RESULT_ERROR