Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def determine_result(self, returncode, returnsignal, output, isTimeout):
# parse output
status = result.RESULT_UNKNOWN
for line in output:
if "UNSAFE" in line:
status = result.RESULT_FALSE_PROP
elif "SAFE" in line:
status = result.RESULT_TRUE_PROP
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
status = ""
if returnsignal == 0 and ((returncode == 0) or (returncode == 10)):
if "VERIFICATION FAILED (ReachSafety)\n" in output:
status = result.RESULT_FALSE_REACH
elif "VERIFICATION FAILED (NoOverflow)\n" in output:
status = result.RESULT_FALSE_OVERFLOW
elif "VERIFICATION SUCCESSFUL\n" in output:
status = result.RESULT_TRUE_PROP
else:
status = result.RESULT_UNKNOWN
else:
status = result.RESULT_ERROR
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
status = result.RESULT_UNKNOWN
stroutput = str(output)
if isTimeout:
status = "TIMEOUT"
elif "TRUE" in stroutput:
status = result.RESULT_TRUE_PROP
elif "FALSE(valid-deref)" in stroutput:
status = result.RESULT_FALSE_DEREF
elif "FALSE(no-overflow)" in stroutput:
status = result.RESULT_FALSE_OVERFLOW
elif "FALSE" in stroutput:
status = result.RESULT_FALSE_REACH
elif "UNKNOWN" in stroutput:
status = result.RESULT_UNKNOWN
else:
status = result.RESULT_UNKNOWN
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
if isTimeout:
return "timeout"
if output is None:
return "error (no output)"
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
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
def determine_result(self, returncode, returnsignal, output, isTimeout):
lines = " ".join(output)
if "COVER(error-call)" in lines:
return result.RESULT_DONE
elif "COVER(branches)" in lines:
return result.RESULT_DONE
elif "VERIFUZZ_VERIFICATION_SUCCESSFUL" in lines:
return result.RESULT_TRUE_PROP
elif "VERIFUZZ_VERIFICATION_FAILED" in lines:
return result.RESULT_FALSE_REACH
elif "FALSE(unreach-call)" in lines:
return result.RESULT_FALSE_REACH
elif "FALSE(no-overflow)" in lines:
return result.RESULT_FALSE_OVERFLOW
elif "FALSE(termination)" in lines:
return result.RESULT_FALSE_TERMINATION
elif "FALSE(valid-deref)" in lines:
return result.RESULT_FALSE_DEREF
elif "FALSE(valid-free)" in lines:
return result.RESULT_FALSE_FREE
elif "FALSE(valid-memtrack)" in lines:
return result.RESULT_FALSE_MEMTRACK
elif "NOT SUPPORTED" in lines or "VERIFUZZ_UNKNOWN" in lines:
return result.RESULT_UNKNOWN
def determine_result(self, returncode, returnsignal, output, isTimeout):
status = result.RESULT_ERROR
if returnsignal == 0 and ((returncode == 0) or (returncode == 10)) and output:
result_str = output[-1].strip()
if result_str == "TRUE":
status = result.RESULT_TRUE_PROP
elif result_str == "FALSE":
status = result.RESULT_FALSE_PROP
elif "UNKNOWN\n" in output:
status = result.RESULT_UNKNOWN
elif returncode == 64 and "Usage error!\n" in output:
status = "INVALID ARGUMENTS"
elif returncode == 6 and "Out of memory\n" in output:
status = "OUT OF MEMORY"
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
# parse output
status = result.RESULT_UNKNOWN
for line in output:
if "UNSAFE" in line:
status = result.RESULT_FALSE_PROP
elif "SAFE" in line:
status = result.RESULT_TRUE_PROP
return status
def determine_result(self, returncode, returnsignal, output, isTimeout):
"""
Returns a BenchExec result status based on the output of SMACK
"""
splitout = "\n".join(output)
if "SMACK found no errors" in splitout:
return result.RESULT_TRUE_PROP
errmsg = re.search(r"SMACK found an error(:\s+([^\.]+))?\.", splitout)
if errmsg:
errtype = errmsg.group(2)
if errtype:
if "invalid pointer dereference" == errtype:
return result.RESULT_FALSE_DEREF
elif "invalid memory deallocation" == errtype:
return result.RESULT_FALSE_FREE
elif "memory leak" == errtype:
return result.RESULT_FALSE_MEMTRACK
elif "memory cleanup" == errtype:
return result.RESULT_FALSE_MEMCLEANUP
elif "integer overflow" == errtype:
return result.RESULT_FALSE_OVERFLOW
else:
return result.RESULT_FALSE_REACH
def determine_result(self, returncode, returnsignal, output, isTimeout):
return result.RESULT_TRUE_PROP if random() < 0.5 else result.RESULT_FALSE_REACH