updated TI for map2check
# SPDX-License-Identifier: Apache-2.0
import os
-import benchexec.util as util
import benchexec.tools.template
import benchexec.result as result
+from benchexec.tools.template import ToolNotFoundException
-class Tool(benchexec.tools.template.BaseTool):
+class Tool(benchexec.tools.template.BaseTool2):
"""
This class serves as tool adaptor for Map2Check (https://github.com/hbgit/Map2Check)
"""
@@ -25,12 +25,15 @@ class Tool(benchexec.tools.template.BaseTool):
REQUIRED_PATHS_7_1 = ["map2check", "map2check-wrapper.py", "bin", "include", "lib"]
- def executable(self):
+ def executable(self, tool_locator):
+ # This is used in _get_version
+ self._tool_locator = tool_locator
+
# Relative path to map2check wrapper
if self._get_version() == 6:
- return util.find_executable("map2check-wrapper.sh")
+ return tool_locator.find_executable("map2check-wrapper.sh")
elif self._get_version() > 6:
- return util.find_executable("map2check-wrapper.py")
+ return tool_locator.find_executable("map2check-wrapper.py")
assert False, "Unexpected version " + self._get_version()
def program_files(self, executable):
@@ -48,10 +51,10 @@ class Tool(benchexec.tools.template.BaseTool):
"""
Determine the version based on map2check-wrapper.sh file
"""
- exe_v6 = util.find_executable("map2check-wrapper.sh", exitOnError=False)
- if exe_v6:
+ try:
+ self._tool_locator.find_executable("map2check-wrapper.sh")
return 6
- else:
+ except ToolNotFoundException:
return 7
def working_directory(self, executable):
@@ -64,17 +67,21 @@ class Tool(benchexec.tools.template.BaseTool):
def name(self):
return "Map2Check"
- def cmdline(self, executable, options, sourcefiles, propertyfile, rlimits):
+ def cmdline(self, executable, options, task, rlimits):
+ sourcefiles = list(task.input_files_or_identifier)
+
assert len(sourcefiles) == 1, "only one sourcefile supported"
- assert propertyfile, "property file required"
+ assert task.property_file, "property file required"
+
sourcefile = sourcefiles[0]
if self._get_version() == 6:
- return [executable] + options + ["-c", propertyfile, sourcefile]
+ return [executable] + options + ["-c", task.property_file, sourcefile]
elif self._get_version() > 6:
- return [executable] + options + ["-p", propertyfile, sourcefile]
+ return [executable] + options + ["-p", task.property_file, sourcefile]
assert False, "Unexpected version " + self._get_version()
- def determine_result(self, returncode, returnsignal, output, isTimeout):
+ def determine_result(self, run):
+ output = run.output
if not output:
return result.RESULT_UNKNOWN
output = output[-1].strip()
@@ -98,7 +105,7 @@ class Tool(benchexec.tools.template.BaseTool):
status = result.RESULT_FALSE_REACH
elif output.endswith("UNKNOWN"):
status = result.RESULT_UNKNOWN
- elif isTimeout:
+ elif run.was_timeout:
status = "TIMEOUT"
else:
status = "ERROR"
@@ -115,7 +122,7 @@ class Tool(benchexec.tools.template.BaseTool):
status = result.RESULT_FALSE_FREE
elif output.endswith("UNKNOWN"):
status = result.RESULT_UNKNOWN
- elif isTimeout:
+ elif run.was_timeout:
status = "TIMEOUT"
else:
status = "ERROR"
