14
14
EXIT_CODE_FAIL = 2
15
15
16
16
17
- def cbmc_version ( ):
18
- cmd = ["cbmc" , "--version" ]
17
+ def get_version ( tool_str ):
18
+ cmd = [tool_str , "--version" ]
19
19
try :
20
20
version = subprocess .run (cmd , stdout = PIPE , stderr = PIPE , check = True ,
21
21
universal_newlines = True )
@@ -26,7 +26,7 @@ def cbmc_version():
26
26
27
27
match = re .match ("([0-9]+).([0-9]+).([0-9]+)" , version .stdout )
28
28
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()}'" )
30
30
sys .exit (EXIT_CODE_FAIL )
31
31
32
32
return match .groups ()
@@ -43,15 +43,23 @@ def main():
43
43
parser .add_argument ('--patch' )
44
44
args = parser .parse_args ()
45
45
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" ))
47
48
desired_version = complete_version (args .major , args .minor , args .patch )
48
49
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 ])
51
52
desired_version_string = '.' .join ([str (num ) for num in desired_version ])
52
53
print (f'ERROR: CBMC version is { version_string } , expected at least { desired_version_string } ' )
53
54
sys .exit (EXIT_CODE_MISMATCH )
54
55
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
+
55
63
56
64
if __name__ == "__main__" :
57
65
main ()
0 commit comments