Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle validation tasks inside CPAchecker #1078

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
36 changes: 30 additions & 6 deletions benchexec/tools/cpachecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,40 @@ def option_present(option):
f"Unsupported data_model '{data_model}' defined for task '{task}'"
)

if isinstance(task.options, dict) and "witness" in task.options.keys():
if not option_present("witness"):
possible_witness_files = list(
filter(
lambda x: x.endswith(task.options.get("witness")),
task.input_files_or_empty,
)
PhilippWendler marked this conversation as resolved.
Show resolved Hide resolved
)
assert (
len(possible_witness_files) == 1
), f"Expected exactly one witness file, but found {len(possible_witness_files)}: {possible_witness_files}"
PhilippWendler marked this conversation as resolved.
Show resolved Hide resolved
options += [f"{prefix}witness", possible_witness_files[0]]
else:
raise benchexec.tools.template.UnsupportedFeatureException(
"You are passing a witness as both an option and through the task definition. "
"Please remove one of them."
)

return options

def _get_input_files(self, task):
if "witness" in task.options.keys():
return list(
filter(
lambda x: not x.endswith(task.options.get("witness")),
task.input_files_or_identifier,
)
)
return list(task.input_files_or_identifier)

def cmdline(self, executable, options, task, rlimits):
additional_options = self._get_additional_options(options, task, rlimits)
return (
[executable]
+ options
+ additional_options
+ list(task.input_files_or_identifier)
)
input_files = self._get_input_files(task)
marian-lingsch marked this conversation as resolved.
Show resolved Hide resolved
return [executable] + options + additional_options + input_files

def determine_result(self, run):
"""
Expand Down