#!/usr/bin/env python3 """BenchExec tool-info module for fold SV-COMP runs.""" # pyright: reportMissingImports=false from __future__ import annotations from pathlib import Path import benchexec.tools.template # type: ignore[import-not-found] RUNNER = Path(__file__).resolve().parents[1] / "run_svcomp.py" class Tool(benchexec.tools.template.BaseTool2): def executable(self, tool_locator): return tool_locator.find_executable("python3") def name(self): return "fold" def cmdline(self, executable, options, task, rlimits): return [ executable, str(RUNNER), "--benchexec-task", task.single_input_file, *options, ] def determine_result(self, run): output = "\n".join(run.output) marker = "SVCOMP_RESULT=" for line in reversed(output.splitlines()): if not line.startswith(marker): continue verdict = line[len(marker):].strip() if verdict: return verdict if run.was_timeout: return "TIMEOUT" return "ERROR"