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


class Tool(benchexec.tools.template.BaseTool2):
    """
    Tool info for the witness checker (witnesslint)
    (https://github.com/sosy-lab/sv-witnesses)
    """

    def executable(self, tool_locator):
        return tool_locator.find_executable("witnesslint.py")

    def name(self):
        return "witnesslint"

    def determine_result(self, run):
        if run.exit_code.value == 0:
            return result.RESULT_TRUE_PROP
        else:
            return result.RESULT_FALSE_PROP


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


class Tool(benchexec.tools.template.BaseTool2):
    """
    Tool info for the witness checker (witnesslint)
    (https://github.com/sosy-lab/sv-witnesses)
    """

    def executable(self, tool_locator):
        return tool_locator.find_executable("witnesslint.py")

    def name(self):
        return "witnesslint"

    def version(self, executable):
        version_string = self._version_from_tool(executable)
        return version_string.partition("version")[2].strip().split(" ")[0]

    def determine_result(self, run):
        if run.exit_code.value == 0:
            return result.RESULT_TRUE_PROP
        elif run.exit_code.value == 1:
            return result.RESULT_FALSE_PROP
        else:
            return result.RESULT_ERROR

Add version and distinguish linter error from faulty witness.
Add version and distinguish linter error from faulty witness.

  
  import benchexec.result as result
  import benchexec.tools.template
  
  
  class Tool(benchexec.tools.template.BaseTool2):
      """
      Tool info for the witness checker (witnesslint)
      (https://github.com/sosy-lab/sv-witnesses)
      """
  
      def executable(self, tool_locator):
          return tool_locator.find_executable("witnesslint.py")
  
      def name(self):
          return "witnesslint"
  
+     def version(self, executable):
+         version_string = self._version_from_tool(executable)
+         return version_string.partition("version")[2].strip().split(" ")[0]
+ 
      def determine_result(self, run):
          if run.exit_code.value == 0:
              return result.RESULT_TRUE_PROP
+         elif run.exit_code.value == 1:
+             return result.RESULT_FALSE_PROP
          else:
-             return result.RESULT_FALSE_PROP
+             return result.RESULT_ERROR
  
Add version and distinguish linter error from faulty witness.
## Code Before:

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


class Tool(benchexec.tools.template.BaseTool2):
    """
    Tool info for the witness checker (witnesslint)
    (https://github.com/sosy-lab/sv-witnesses)
    """

    def executable(self, tool_locator):
        return tool_locator.find_executable("witnesslint.py")

    def name(self):
        return "witnesslint"

    def determine_result(self, run):
        if run.exit_code.value == 0:
            return result.RESULT_TRUE_PROP
        else:
            return result.RESULT_FALSE_PROP

## Instruction:
Add version and distinguish linter error from faulty witness.
## Code After:

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


class Tool(benchexec.tools.template.BaseTool2):
    """
    Tool info for the witness checker (witnesslint)
    (https://github.com/sosy-lab/sv-witnesses)
    """

    def executable(self, tool_locator):
        return tool_locator.find_executable("witnesslint.py")

    def name(self):
        return "witnesslint"

    def version(self, executable):
        version_string = self._version_from_tool(executable)
        return version_string.partition("version")[2].strip().split(" ")[0]

    def determine_result(self, run):
        if run.exit_code.value == 0:
            return result.RESULT_TRUE_PROP
        elif run.exit_code.value == 1:
            return result.RESULT_FALSE_PROP
        else:
            return result.RESULT_ERROR
