Skip to content

Commit

Permalink
Merge pull request #1133 from Po-Chun-Chien/add-moxi-tools
Browse files Browse the repository at this point in the history
Add tool-info modules for MoXI model checkers
  • Loading branch information
PhilippWendler authored Dec 6, 2024
2 parents 4f1b2ac + e04800a commit a3af136
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
56 changes: 56 additions & 0 deletions benchexec/tools/moxi-mc-flow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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.result as result
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool2):
"""
Tool info for MoXI-MC-Flow
"""

REQUIRED_PATHS = [
"deps/",
"src/",
"json-schema/",
"sortcheck.py",
"translate.py",
]

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

def name(self):
return "MoXI-MC-Flow"

def project_url(self):
return "https://github.com/ModelChecker/moxi-mc-flow"

def cmdline(self, executable, options, task, rlimits):
if rlimits.cputime and "--timeout" not in options:
# The `--timeout` parameter must be passed to the tool
# to prevent it from using its default value,
# which could be shorter than the limit set by BenchExec
# and cause early termination.
# Moreover, in practice the tool sometimes terminates itself prematurely
# even when the exact time limit is passed.
# To prevent this and ensure the tool utilizes the full time limit,
# a factor of 2 is applied to the timeout value.
options += ["--timeout", str(rlimits.cputime * 2)]
return ["python3", executable, task.single_input_file, *options]

def determine_result(self, run):
"""
@return: verification result obtained from MoXI-MC-Flow
"""
for line in run.output[::-1]:
if line.startswith("unsat"):
return result.RESULT_TRUE_PROP
if line.startswith("sat"):
return result.RESULT_FALSE_PROP
return result.RESULT_ERROR
46 changes: 46 additions & 0 deletions benchexec/tools/moxichecker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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.result as result
import benchexec.tools.template


class Tool(benchexec.tools.template.BaseTool2):
"""
Tool info for MoXIchecker
"""

REQUIRED_PATHS = ["moxichecker/", "lib/"]

def executable(self, tool_locator):
return tool_locator.find_executable("moxichecker", subdir="bin")

def name(self):
return "MoXIchecker"

def project_url(self):
return "https://gitlab.com/sosy-lab/software/moxichecker"

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

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

def cmdline(self, executable, options, task, rlimits):
return [executable, *options, task.single_input_file]

def determine_result(self, run):
for line in run.output[::-1]:
if line.startswith("[INFO] Model-checking result:"):
if "UNREACHABLE" in line:
return result.RESULT_TRUE_PROP
if "REACHABLE" in line:
return result.RESULT_FALSE_PROP
return result.RESULT_ERROR

0 comments on commit a3af136

Please sign in to comment.