# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0

import benchexec.tools.cpachecker as cpachecker


class Tool(cpachecker.Tool):
    """Tool info for PeSCo."""

    REQUIRED_PATHS = list(cpachecker.Tool.REQUIRED_PATHS) + ["resources"]

    def name(self):
        return "PeSCo"

@@ -272,16 +272,105 @@
 hecker%0A%0A
+from benchexec.tools.template import ToolNotFoundException, UnsupportedFeatureException%0A%0A
 %0Aclass T
@@ -441,16 +441,19 @@
 ED_PATHS
+_v1
  = list(
@@ -499,16 +499,2093 @@
 ources%22%5D
+%0A    REQUIRED_PATHS_v2 = %5B%5D%0A%0A    def executable(self, tool_locator):%0A        try:%0A            executable = tool_locator.find_executable(%22pesco%22, subdir=%22bin%22)%0A            self._version = 2%0A            self.REQUIRED_PATHS = self.REQUIRED_PATHS_v2%0A        except ToolNotFoundException:%0A            self.REQUIRED_PATHS = self.REQUIRED_PATHS_v1%0A            executable = super().executable(tool_locator)%0A            self._version = 1%0A%0A        return executable%0A%0A    def version(self, executable):%0A        if self._version == 1: return super().version(executable)%0A        version = self._version_from_tool(executable, %22--version%22, line_prefix=%22PeSCo%22)%0A        %0A        pesco_version, *cpa_version = version.split(%22 %22)%0A        return %22+%22.join(%5Bpesco_version, cpa_version%5B1%5D%5D)%0A%0A    def _additional_options(self, existing_options, task, rlimits):%0A        options = %5B%5D%0A        if rlimits.cputime and %22--timelimit%22 not in existing_options:%0A            options += %5B%22--timelimit%22, str(rlimits.cputime)%5D%0A%0A        if task.property_file:%0A            options += %5B%22--spec%22, task.property_file%5D%0A%0A        if isinstance(task.options, dict) and task.options.get(%22language%22) == %22C%22:%0A            data_model = task.options.get(%22data_model%22)%0A            if data_model:%0A                data_model_option = %7B%22ILP32%22, %22LP64%22%7D%0A                if data_model in data_model_option:%0A                    if %22--data_model%22 not in existing_options:%0A                        options += %5B%22--data_model%22, data_model%5D%0A                else:%0A                    raise UnsupportedFeatureException(%0A                        f%22Unsupported data_model '%7Bdata_model%7D' defined for task '%7Btask%7D'%22%0A                    )%0A%0A        return options%0A%0A    def cmdline(self, executable, options, task, rlimits):%0A        if self._version == 1: return super().cmdline(executable, options, task, rlimits)%0A%0A        additional_options = self._additional_options(options, task, rlimits)%0A%0A        return (%0A            %5Bexecutable%5D%0A            + options%0A            + additional_options%0A            + list(task.input_files_or_identifier)%0A        )
 %0A%0A    de

Update tool info for PeSCo 2.0