
import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool):
    def executable(self):
        return util.find_executable("deagle")

    def name(self):
        return "Deagle"

    def version(self, executable):
        return self._version_from_tool(executable)

    def cmdline(self, executable, options, tasks, propertyfile, rlimits):
        options = options + ["--32", "--no-unwinding-assertions", "--closure"]
        return [executable] + options + tasks

    def determine_result(self, returncode, returnsignal, output, isTimeout):

        status = result.RESULT_UNKNOWN
        stroutput = str(output)

        if isTimeout:
            status = "TIMEOUT"
        elif "SUCCESSFUL" in stroutput:
            status = result.RESULT_TRUE_PROP
        elif "FAILED" in stroutput:
            status = result.RESULT_FALSE_REACH
        elif "UNKNOWN" in stroutput:
            status = result.RESULT_UNKNOWN
        else:
            status = result.RESULT_UNKNOWN

        return status


import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool2):
    def executable(self, tool_locator):
        return tool_locator.find_executable("deagle")

    def name(self):
        return "Deagle"

    def version(self, executable):
        return self._version_from_tool(executable)

    def get_data_model(self, task):
        if isinstance(task.options, dict) and task.options.get("language") == "C":
            data_model = task.options.get("data_model")
            if data_model == "LP64":
                return ["--64"]
        return ["--32"] # default

    def cmdline(self, executable, options, task, rlimits):
        return [executable] + options + self.get_data_model(task) + list(task.input_files_or_identifier)

    def determine_result(self, run):
        status = result.RESULT_UNKNOWN

        output = run.output
        stroutput = str(output)

        if "SUCCESSFUL" in stroutput:
            status = result.RESULT_TRUE_PROP
        elif "FAILED" in stroutput:
            status = result.RESULT_FALSE_REACH
        else:
            status = result.RESULT_UNKNOWN

        return status

Move --closure and --no-unwinding-assertions to bench-defs; rewrite choices between --32 and --64
Move --closure and --no-unwinding-assertions to bench-defs; rewrite choices between --32 and --64

  
  import benchexec.result as result
  import benchexec.util as util
  import benchexec.tools.template
  
  
- class Tool(benchexec.tools.template.BaseTool):
+ class Tool(benchexec.tools.template.BaseTool2):
-     def executable(self):
+     def executable(self, tool_locator):
-         return util.find_executable("deagle")
+         return tool_locator.find_executable("deagle")
  
      def name(self):
          return "Deagle"
  
      def version(self, executable):
          return self._version_from_tool(executable)
  
-     def cmdline(self, executable, options, tasks, propertyfile, rlimits):
-         options = options + ["--32", "--no-unwinding-assertions", "--closure"]
-         return [executable] + options + tasks
+     def get_data_model(self, task):
+         if isinstance(task.options, dict) and task.options.get("language") == "C":
+             data_model = task.options.get("data_model")
+             if data_model == "LP64":
+                 return ["--64"]
+         return ["--32"] # default
  
-     def determine_result(self, returncode, returnsignal, output, isTimeout):
+     def cmdline(self, executable, options, task, rlimits):
+         return [executable] + options + self.get_data_model(task) + list(task.input_files_or_identifier)
  
+     def determine_result(self, run):
          status = result.RESULT_UNKNOWN
+ 
+         output = run.output
          stroutput = str(output)
  
-         if isTimeout:
-             status = "TIMEOUT"
-         elif "SUCCESSFUL" in stroutput:
+         if "SUCCESSFUL" in stroutput:
              status = result.RESULT_TRUE_PROP
          elif "FAILED" in stroutput:
              status = result.RESULT_FALSE_REACH
-         elif "UNKNOWN" in stroutput:
-             status = result.RESULT_UNKNOWN
          else:
              status = result.RESULT_UNKNOWN
  
          return status
  
Move --closure and --no-unwinding-assertions to bench-defs; rewrite choices between --32 and --64
## Code Before:

import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool):
    def executable(self):
        return util.find_executable("deagle")

    def name(self):
        return "Deagle"

    def version(self, executable):
        return self._version_from_tool(executable)

    def cmdline(self, executable, options, tasks, propertyfile, rlimits):
        options = options + ["--32", "--no-unwinding-assertions", "--closure"]
        return [executable] + options + tasks

    def determine_result(self, returncode, returnsignal, output, isTimeout):

        status = result.RESULT_UNKNOWN
        stroutput = str(output)

        if isTimeout:
            status = "TIMEOUT"
        elif "SUCCESSFUL" in stroutput:
            status = result.RESULT_TRUE_PROP
        elif "FAILED" in stroutput:
            status = result.RESULT_FALSE_REACH
        elif "UNKNOWN" in stroutput:
            status = result.RESULT_UNKNOWN
        else:
            status = result.RESULT_UNKNOWN

        return status

## Instruction:
Move --closure and --no-unwinding-assertions to bench-defs; rewrite choices between --32 and --64
## Code After:

import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool2):
    def executable(self, tool_locator):
        return tool_locator.find_executable("deagle")

    def name(self):
        return "Deagle"

    def version(self, executable):
        return self._version_from_tool(executable)

    def get_data_model(self, task):
        if isinstance(task.options, dict) and task.options.get("language") == "C":
            data_model = task.options.get("data_model")
            if data_model == "LP64":
                return ["--64"]
        return ["--32"] # default

    def cmdline(self, executable, options, task, rlimits):
        return [executable] + options + self.get_data_model(task) + list(task.input_files_or_identifier)

    def determine_result(self, run):
        status = result.RESULT_UNKNOWN

        output = run.output
        stroutput = str(output)

        if "SUCCESSFUL" in stroutput:
            status = result.RESULT_TRUE_PROP
        elif "FAILED" in stroutput:
            status = result.RESULT_FALSE_REACH
        else:
            status = result.RESULT_UNKNOWN

        return status
