1313
1414parser = ArgumentParser (description = 'Checks all small TLA+ models in the tlaplus/examples repo using TLC.' )
1515parser .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 )
1617parser .add_argument ('--tlapm_lib_path' , help = 'Path to the TLA+ proof manager module directory; .tla files should be in this directory' , required = True )
1718parser .add_argument ('--community_modules_jar_path' , help = 'Path to the CommunityModules-deps.jar file' , required = True )
1819parser .add_argument ('--manifest_path' , help = 'Path to the tlaplus/examples manifest.json file' , required = True )
1920parser .add_argument ('--skip' , nargs = '+' , help = 'Space-separated list of models to skip checking' , required = False , default = [])
2021parser .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' )
2123args = parser .parse_args ()
2224
23- logging .basicConfig (level = logging .INFO )
25+ logging .basicConfig (level = logging . DEBUG if args . verbose else logging .INFO )
2426
2527tools_jar_path = normpath (args .tools_jar_path )
28+ apalache_path = normpath (args .apalache_path )
2629tlapm_lib_path = normpath (args .tlapm_lib_path )
2730community_jar_path = normpath (args .community_modules_jar_path )
2831manifest_path = normpath (args .manifest_path )
2932examples_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
3235
3336def check_model (module_path , model , expected_runtime ):
3437 module_path = tla_utils .from_cwd (examples_root , module_path )
@@ -38,6 +41,7 @@ def check_model(module_path, model, expected_runtime):
3841 start_time = timer ()
3942 tlc_result = tla_utils .check_model (
4043 tools_jar_path ,
44+ apalache_path ,
4145 module_path ,
4246 model_path ,
4347 tlapm_lib_path ,
@@ -46,10 +50,10 @@ def check_model(module_path, model, expected_runtime):
4650 hard_timeout_in_seconds
4751 )
4852 end_time = timer ()
53+ output = ' ' .join (tlc_result .args ) + '\n ' + tlc_result .stdout
4954 match tlc_result :
5055 case CompletedProcess ():
5156 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
5357 expected_result = model ['result' ]
5458 actual_result = tla_utils .resolve_tlc_exit_code (tlc_result .returncode )
5559 if expected_result != actual_result :
@@ -67,10 +71,11 @@ def check_model(module_path, model, expected_runtime):
6771 logging .error (f"(distinct/total/depth); expected: { tla_utils .get_state_count_info (model )} , actual: { state_count_info } " )
6872 logging .error (output )
6973 return False
74+ logging .debug (output )
7075 return True
7176 case TimeoutExpired ():
7277 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 )
7479 return False
7580 case _:
7681 logging .error (f'Unhandled TLC result type { type (tlc_result )} : { tlc_result } ' )
@@ -85,8 +90,8 @@ def check_model(module_path, model, expected_runtime):
8590 for module in spec ['modules' ]
8691 for model in module ['models' ]
8792 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 )
9095 ],
9196 key = lambda m : m [2 ],
9297 reverse = True
0 commit comments