-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a GitHub Action that runs the CBMC proofs in this repository upon pushes and pull requests
- Loading branch information
1 parent
55a8257
commit e5862bd
Showing
3 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: MIT-0 | ||
|
||
|
||
import logging | ||
import pathlib | ||
import shutil | ||
import subprocess | ||
|
||
|
||
_TOOLS = [ | ||
"cadical", | ||
"cbmc", | ||
"cbmc-viewer", | ||
"cbmc-starter-kit-update", | ||
"kissat", | ||
"litani", | ||
] | ||
|
||
|
||
def _format_versions(table): | ||
lines = [ | ||
"<table>", | ||
'<tr><td colspan="2" style="font-weight: bold">Tool Versions</td></tr>', | ||
] | ||
for tool, version in table.items(): | ||
if version: | ||
v_str = f'<code><pre style="margin: 0">{version}</pre></code>' | ||
else: | ||
v_str = '<em>not found</em>' | ||
lines.append( | ||
f'<tr><td style="font-weight: bold; padding-right: 1em; ' | ||
f'text-align: right;">{tool}:</td>' | ||
f'<td>{v_str}</td></tr>') | ||
lines.append("</table>") | ||
return "\n".join(lines) | ||
|
||
|
||
def _get_tool_versions(): | ||
ret = {} | ||
for tool in _TOOLS: | ||
err = f"Could not determine version of {tool}: " | ||
ret[tool] = None | ||
if not shutil.which(tool): | ||
logging.error("%s'%s' not found on $PATH", err, tool) | ||
continue | ||
cmd = [tool, "--version"] | ||
proc = subprocess.Popen(cmd, text=True, stdout=subprocess.PIPE) | ||
try: | ||
out, _ = proc.communicate(timeout=10) | ||
except subprocess.TimeoutExpired: | ||
logging.error("%s'%s --version' timed out", err, tool) | ||
continue | ||
if proc.returncode: | ||
logging.error( | ||
"%s'%s --version' returned %s", err, tool, str(proc.returncode)) | ||
continue | ||
ret[tool] = out.strip() | ||
return ret | ||
|
||
|
||
def main(): | ||
exe_name = pathlib.Path(__file__).name | ||
logging.basicConfig(format=f"{exe_name}: %(message)s") | ||
|
||
table = _get_tool_versions() | ||
out = _format_versions(table) | ||
print(out) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters