Added compatibility to old Map2check version
This tool-info can handle newer versions of Map2Check, but is compatible even with the older versions of Map2Check.
@@ -28,7 +28,14 @@ class Tool(benchexec.tools.template.BaseTool):
This class serves as tool adaptor for Map2Check (https://github.com/hbgit/Map2Check)
"""
- REQUIRED_PATHS = [
+ REQUIRED_PATHS_6 = [
+ "__init__.py",
+ "map2check.py",
+ "map2check-wrapper.sh",
+ "modules"
+ ]
+
+ REQUIRED_PATHS_7_1 = [
"__init__.py",
"map2check",
"map2check-wrapper.py",
@@ -37,11 +44,32 @@ class Tool(benchexec.tools.template.BaseTool):
def executable(self):
#Relative path to map2check wrapper
+ if self._get_version() == 6:
+ return Util.find_executable('map2check-wrapper.sh')
+ elif self._get_version() > 6:
return Util.find_executable('map2check-wrapper.py')
+
def program_files(self, executable):
executableDir = os.path.dirname(executable)
- return [executableDir]
+
+ if self._get_version() == 6:
+ paths = REQUIRED_PATHS_6
+ elif self._get_version() > 6:
+ paths = REQUIRED_PATHS_7_1
+
+ return [executableDir] + paths
+
+ def _get_version(self):
+ """
+ Determine the version based on map2check-wrapper.sh file
+ """
+ exe_v6 = Util.find_executable('map2check-wrapper.sh', exitOnError=False)
+ if exe_v6:
+ return 6
+ else:
+ return 7
+
def working_directory(self, executable):
executableDir = os.path.dirname(executable)
@@ -57,14 +85,19 @@ class Tool(benchexec.tools.template.BaseTool):
assert len(sourcefiles) == 1, "only one sourcefile supported"
assert propertyfile, "property file required"
sourcefile = sourcefiles[0]
+ if self._get_version() == 6:
+ return [executable] + options + ['-c', propertyfile, sourcefile]
+ elif self._get_version() > 6:
return [executable] + options + ['-p', propertyfile, sourcefile]
+
def determine_result(self, returncode, returnsignal, output, isTimeout):
if not output:
return result.RESULT_UNKNOWN
output = output[-1].strip()
status = result.RESULT_UNKNOWN
+ if self._get_version() > 6:
if output.endswith('TRUE'):
status = result.RESULT_TRUE_PROP
elif 'FALSE' in output:
@@ -85,4 +118,21 @@ class Tool(benchexec.tools.template.BaseTool):
else:
status = 'ERROR'
+ elif self._get_version() == 6:
+ if output.endswith('TRUE'):
+ status = result.RESULT_TRUE_PROP
+ elif 'FALSE' in output:
+ if "FALSE(valid-memtrack)" in output:
+ status = result.RESULT_FALSE_MEMTRACK
+ elif "FALSE(valid-deref)" in output:
+ status = result.RESULT_FALSE_DEREF
+ elif "FALSE(valid-free)" in output:
+ status = result.RESULT_FALSE_FREE
+ elif output.endswith('UNKNOWN'):
+ status = result.RESULT_UNKNOWN
+ elif isTimeout:
+ status = 'TIMEOUT'
+ else:
+ status = 'ERROR'
+
return status
