Skip to content

Commit f5df11e

Browse files
authored
Add version check for goto-synthesizer in regression scripts (rust-lang#2292)
1 parent be4e578 commit f5df11e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

scripts/check-cbmc-version.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
EXIT_CODE_FAIL = 2
1515

1616

17-
def cbmc_version():
18-
cmd = ["cbmc", "--version"]
17+
def get_version(tool_str):
18+
cmd = [tool_str, "--version"]
1919
try:
2020
version = subprocess.run(cmd, stdout=PIPE, stderr=PIPE, check=True,
2121
universal_newlines=True)
@@ -26,7 +26,7 @@ def cbmc_version():
2626

2727
match = re.match("([0-9]+).([0-9]+).([0-9]+)", version.stdout)
2828
if not match:
29-
print(f"Can't parse cbmc version string: '{version.stdout.strip()}'")
29+
print(f"Can't parse " + tool_str + " version string: '{version.stdout.strip()}'")
3030
sys.exit(EXIT_CODE_FAIL)
3131

3232
return match.groups()
@@ -43,15 +43,23 @@ def main():
4343
parser.add_argument('--patch')
4444
args = parser.parse_args()
4545

46-
current_version = complete_version(*cbmc_version())
46+
current_cbmc_version = complete_version(*get_version("cbmc"))
47+
current_synthesizer_version = complete_version(*get_version("goto-synthesizer"))
4748
desired_version = complete_version(args.major, args.minor, args.patch)
4849

49-
if desired_version > current_version:
50-
version_string = '.'.join([str(num) for num in current_version])
50+
if desired_version > current_cbmc_version:
51+
version_string = '.'.join([str(num) for num in current_cbmc_version])
5152
desired_version_string = '.'.join([str(num) for num in desired_version])
5253
print(f'ERROR: CBMC version is {version_string}, expected at least {desired_version_string}')
5354
sys.exit(EXIT_CODE_MISMATCH)
5455

56+
if current_cbmc_version != current_synthesizer_version:
57+
version_string = '.'.join([str(num) for num in current_synthesizer_version])
58+
cbmc_version_string = '.'.join([str(num) for num in current_cbmc_version])
59+
print(
60+
f'ERROR: goto-synthesizer version is {version_string}, non consistent with CBMC version {cbmc_version_string}')
61+
sys.exit(EXIT_CODE_MISMATCH)
62+
5563

5664
if __name__ == "__main__":
5765
main()

0 commit comments

Comments
 (0)