How to use the benchexec.tools.template function in BenchExec

To help you get started, we’ve selected a few BenchExec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sosy-lab / cpachecker / BenchExec / benchexec / tools / wolverine.py View on Github external
import subprocess

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

class Tool(benchexec.tools.template.BaseTool):

    def executable(self):
        return util.find_executable('wolverine')


    def version(self, executable):
        return subprocess.Popen([executable, '--version'],
                                stdout=subprocess.PIPE).communicate()[0].split()[1].strip()


    def name(self):
        return 'Wolverine'


    def determine_result(self, returncode, returnsignal, output, isTimeout):
        output = '\n'.join(output)
github sosy-lab / benchexec / benchexec / tools / nitwit.py View on Github external
See the License for the specific language governing permissions and
limitations under the License.
"""

# prepare for Python 3
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import os

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


class Tool(benchexec.tools.template.BaseTool):
    """
    Tool info for the NITWIT Validator, an interpreter-based violation witness validator.
    URL: https://github.com/moves-rwth/nitwit-validator
    """

    REQUIRED_PATHS = []
    BIN_DIR = "bin"

    def executable(self):
        executable = util.find_executable("nitwit.sh")
        bin_path = os.path.join(os.path.dirname(executable), self.BIN_DIR)
        if (
            not os.path.isdir(bin_path)
            or not os.path.isfile(os.path.join(bin_path, "nitwit32"))
            or not os.path.isfile(os.path.join(bin_path, "nitwit64"))
        ):
github sosy-lab / benchexec / benchexec / tools / smtlib2.py View on Github external
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer 
#
# SPDX-License-Identifier: Apache-2.0

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


class Smtlib2Tool(benchexec.tools.template.BaseTool):
    """
    Abstract base class for tool infos for SMTLib2-compatible solvers.
    These tools share a common output format, which is implemented here.
    """

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

        if returnsignal == 0 and returncode == 0:
            status = None
            for line in output:
                line = line.strip()
                if line == "unsat":
                    status = result.RESULT_FALSE_PROP
                elif line == "sat":
                    status = result.RESULT_TRUE_PROP
                elif not status and line.startswith("(error "):
github sosy-lab / cpachecker / BenchExec / benchexec / tools / cpachecker.py View on Github external
import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template
from benchexec.model import SOFTTIMELIMIT

REQUIRED_PATHS = [
                  "lib/java/runtime",
                  "lib/*.jar",
                  "lib/native/x86_64-linux",
                  "scripts",
                  "cpachecker.jar",
                  "config",
                  ]

class Tool(benchexec.tools.template.BaseTool):
    """
    Tool wrapper for CPAchecker.
    It has additional features such as building CPAchecker before running it
    if executed within a source checkout.
    It also supports extracting data from the statistics output of CPAchecker
    for adding it to the result tables.
    """

    def executable(self):
        executable = util.find_executable('cpa.sh', 'scripts/cpa.sh')
        executableDir = os.path.join(os.path.dirname(executable), os.path.pardir)
        if os.path.isdir(os.path.join(executableDir, 'src')):
            self._buildCPAchecker(executableDir)
        if not os.path.isfile(os.path.join(executableDir, "cpachecker.jar")):
            logging.warning("Required JAR file for CPAchecker not found in {0}.".format(executableDir))
        return executable
github sosy-lab / benchexec / benchexec / tools / fairfuzz.py View on Github external
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template
import benchexec.model


class Tool(benchexec.tools.template.BaseTool):
    """
    Tool info for FairFuzz (https://https://github.com/carolemieux/afl-rb/tree/testcomp).
    """

    REQUIRED_PATHS = ["bin", "helper"]

    def executable(self):
        return util.find_executable("bin/fairfuzz-svtestcomp")

    def program_files(self, executable):
        return self._program_files_from_executable(
            executable, self.REQUIRED_PATHS, parent_dir=True
        )

    def version(self, executable):
        stdout = self._version_from_tool(executable)
github sosy-lab / benchexec / benchexec / tools / viap.py View on Github external
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer 
#
# SPDX-License-Identifier: Apache-2.0

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


class Tool(benchexec.tools.template.BaseTool):

    REQUIRED_PATHS = [
        "viap_tool.py",
        "viap_svcomp.py",
        "config.properties",
        "SyntaxFilter.py",
        "graphclass.py",
        "commandclass.py",
        "packages",
    ]

    def executable(self):
        return util.find_executable("viap_tool.py")

    def version(self, executable):
        stdout = self._version_from_tool(executable, "-version")
github sosy-lab / benchexec / benchexec / tools / brick.py View on Github external
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer 
#
# SPDX-License-Identifier: Apache-2.0

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


class Tool(benchexec.tools.template.BaseTool):
    """
    Tool info for BRICK
    https://github.com/brick-tool-dev/brick-tool
    """

    REQUIRED_PATHS = ["bin", "lib"]

    def executable(self):
        return util.find_executable("bin/brick")

    def name(self):
        return "BRICK"

    def cmdline(self, executable, options, tasks, propertyfile, rlimits):
        return [executable] + options + tasks
github sosy-lab / cpachecker / BenchExec / benchexec / tools / threader.py View on Github external
import subprocess
import os
import benchexec.util as util
import benchexec.tools.template
import benchexec.result as result

class Tool(benchexec.tools.template.BaseTool):
    """
    This class serves as tool adaptor for Threader (http://www.esbmc.org/)
    """

    def executable(self):
        return util.find_executable('threader.sh')


    def program_files(self, executable):
        executableDir = os.path.dirname(executable)
        return [executableDir]


    def working_directory(self, executable):
        executableDir = os.path.dirname(executable)
        return executableDir
github sosy-lab / benchexec / benchexec / tools / cseq.py View on Github external
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer 
#
# SPDX-License-Identifier: Apache-2.0

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


class CSeqTool(benchexec.tools.template.BaseTool):
    """
    Abstract tool info for CSeq-based tools (http://users.ecs.soton.ac.uk/gp4/cseq/cseq.html).
    """

    def version(self, executable):
        output = self._version_from_tool(executable, arg="--version")
        first_line = output.splitlines()[0]
        return first_line.strip()

    def cmdline(self, executable, options, tasks, propertyfile=None, rlimits={}):
        """
        Compose the command line to execute from the name of the executable,
        the user-specified options, and the inputfile to analyze.
        This method can get overridden, if, for example, some options should
        be enabled or if the order of arguments must be changed.
        All paths passed to this method (executable, tasks, and propertyfile)
github sosy-lab / benchexec / benchexec / tools / spf.py View on Github external
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer 
#
# SPDX-License-Identifier: Apache-2.0

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


class Tool(benchexec.tools.template.BaseTool):
    """
    Tool info for JPF with symbolic extension (SPF)
    (https://github.com/symbolicpathfinder).
    """

    REQUIRED_PATHS = [
        "jpf-core/bin/jpf",
        "jpf-core/build",
        "jpf-core/jpf.properties",
        "jpf-symbc/lib",
        "jpf-symbc/build",
        "jpf-symbc/jpf.properties",
        "jpf-sv-comp",
    ]

    def executable(self):