13
13
14
14
parser = ArgumentParser (description = 'Checks all small TLA+ models in the tlaplus/examples repo using TLC.' )
15
15
parser .add_argument ('--tools_jar_path' , help = 'Path to the tla2tools.jar file' , required = True )
16
+ parser .add_argument ('--apalache_path' , help = 'Path to the Apalache directory' , required = True )
16
17
parser .add_argument ('--tlapm_lib_path' , help = 'Path to the TLA+ proof manager module directory; .tla files should be in this directory' , required = True )
17
18
parser .add_argument ('--community_modules_jar_path' , help = 'Path to the CommunityModules-deps.jar file' , required = True )
18
19
parser .add_argument ('--manifest_path' , help = 'Path to the tlaplus/examples manifest.json file' , required = True )
19
20
parser .add_argument ('--skip' , nargs = '+' , help = 'Space-separated list of models to skip checking' , required = False , default = [])
20
21
parser .add_argument ('--only' , nargs = '+' , help = 'If provided, only check models in this space-separated list' , required = False , default = [])
22
+ parser .add_argument ('--verbose' , help = 'Set logging output level to debug' , action = 'store_true' )
21
23
args = parser .parse_args ()
22
24
23
- logging .basicConfig (level = logging .INFO )
25
+ logging .basicConfig (level = logging . DEBUG if args . verbose else logging .INFO )
24
26
25
27
tools_jar_path = normpath (args .tools_jar_path )
28
+ apalache_path = normpath (args .apalache_path )
26
29
tlapm_lib_path = normpath (args .tlapm_lib_path )
27
30
community_jar_path = normpath (args .community_modules_jar_path )
28
31
manifest_path = normpath (args .manifest_path )
29
32
examples_root = dirname (manifest_path )
30
- skip_models = [ normpath ( path ) for path in args .skip ]
31
- only_models = [ normpath ( path ) for path in args .only ]
33
+ skip_models = args .skip
34
+ only_models = args .only
32
35
33
36
def check_model (module_path , model , expected_runtime ):
34
37
module_path = tla_utils .from_cwd (examples_root , module_path )
@@ -38,6 +41,7 @@ def check_model(module_path, model, expected_runtime):
38
41
start_time = timer ()
39
42
tlc_result = tla_utils .check_model (
40
43
tools_jar_path ,
44
+ apalache_path ,
41
45
module_path ,
42
46
model_path ,
43
47
tlapm_lib_path ,
@@ -46,10 +50,10 @@ def check_model(module_path, model, expected_runtime):
46
50
hard_timeout_in_seconds
47
51
)
48
52
end_time = timer ()
53
+ output = ' ' .join (tlc_result .args ) + '\n ' + tlc_result .stdout
49
54
match tlc_result :
50
55
case CompletedProcess ():
51
56
logging .info (f'{ model_path } in { end_time - start_time :.1f} s vs. { expected_runtime .seconds } s expected' )
52
- output = ' ' .join (tlc_result .args ) + '\n ' + tlc_result .stdout
53
57
expected_result = model ['result' ]
54
58
actual_result = tla_utils .resolve_tlc_exit_code (tlc_result .returncode )
55
59
if expected_result != actual_result :
@@ -67,10 +71,11 @@ def check_model(module_path, model, expected_runtime):
67
71
logging .error (f"(distinct/total/depth); expected: { tla_utils .get_state_count_info (model )} , actual: { state_count_info } " )
68
72
logging .error (output )
69
73
return False
74
+ logging .debug (output )
70
75
return True
71
76
case TimeoutExpired ():
72
77
logging .error (f'{ model_path } hit hard timeout of { hard_timeout_in_seconds } seconds' )
73
- logging .error (tlc_result . output . decode ( 'utf-8' ) )
78
+ logging .error (output )
74
79
return False
75
80
case _:
76
81
logging .error (f'Unhandled TLC result type { type (tlc_result )} : { tlc_result } ' )
@@ -85,8 +90,8 @@ def check_model(module_path, model, expected_runtime):
85
90
for module in spec ['modules' ]
86
91
for model in module ['models' ]
87
92
if model ['size' ] == 'small'
88
- and normpath ( model ['path' ]) not in skip_models
89
- and (only_models == [] or normpath ( model ['path' ]) in only_models )
93
+ and model ['path' ] not in skip_models
94
+ and (only_models == [] or model ['path' ] in only_models )
90
95
],
91
96
key = lambda m : m [2 ],
92
97
reverse = True
0 commit comments