Skip to content

Commit dc9f7e0

Browse files
Merge pull request #1157 from Po-Chun-Chien/pono-get-version
Getting version from Pono
2 parents 2c3b5f3 + 826ef03 commit dc9f7e0

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

benchexec/tools/pono.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def name(self):
2323
def project_url(self):
2424
return "https://github.com/stanford-centaur/pono"
2525

26+
def version(self, executable):
27+
return self._version_from_tool(executable, expected_exitcode=2)
28+
2629
def cmdline(self, executable, options, task, rlimits):
2730
return [executable] + options + [task.single_input_file]
2831

@@ -35,4 +38,6 @@ def determine_result(self, run):
3538
return result.RESULT_TRUE_PROP
3639
if line.startswith("sat"):
3740
return result.RESULT_FALSE_PROP
41+
if line.startswith("unknown"):
42+
return result.RESULT_UNKNOWN
3843
return result.RESULT_ERROR

benchexec/tools/template.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def _version_from_tool(
140140
use_stderr=False,
141141
ignore_stderr=False,
142142
line_prefix=None,
143+
*,
144+
expected_exitcode=0,
143145
):
144146
"""
145147
Get version of a tool by executing it with argument "--version"
@@ -148,6 +150,7 @@ def _version_from_tool(
148150
@param arg: an argument to pass to the tool to let it print its version
149151
@param use_stderr: True if the tool prints version on stderr, False for stdout
150152
@param line_prefix: if given, search line with this prefix and return only the rest of this line
153+
@param expected_exitcode: the expected exit code after running the version-retrieval command
151154
@return a (possibly empty) string of output of the tool
152155
"""
153156
try:
@@ -170,7 +173,7 @@ def _version_from_tool(
170173
process.stderr,
171174
)
172175
return ""
173-
if process.returncode:
176+
if process.returncode != expected_exitcode:
174177
logging.warning(
175178
"Cannot determine %s version, exit code %s",
176179
executable,

0 commit comments

Comments
 (0)