Skip to content

Commit

Permalink
Don't use JVM assertions by default in scripts
Browse files Browse the repository at this point in the history
Expose --enable_assertions flag

Signed-off-by: Andrew Helwer <ahelwer@pm.me>
  • Loading branch information
ahelwer committed Feb 17, 2025
1 parent cfb8a57 commit 3dfe008
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/check_small_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
parser.add_argument('--skip', nargs='+', help='Space-separated list of models to skip checking', required=False, default=[])
parser.add_argument('--only', nargs='+', help='If provided, only check models in this space-separated list', required=False, default=[])
parser.add_argument('--verbose', help='Set logging output level to debug', action='store_true')
parser.add_argument('--enable_assertions', help='Enable Java assertions (pass -enableassertions to JVM)', action='store_true')
args = parser.parse_args()

logging.basicConfig(level = logging.DEBUG if args.verbose else logging.INFO)
Expand All @@ -32,6 +33,7 @@
examples_root = dirname(manifest_path)
skip_models = args.skip
only_models = args.only
enable_assertions = args.enable_assertions

def check_model(module, model, expected_runtime):
module_path = tla_utils.from_cwd(examples_root, module['path'])
Expand All @@ -49,6 +51,7 @@ def check_model(module, model, expected_runtime):
model['mode'],
module['features'],
model['features'],
enable_assertions,
hard_timeout_in_seconds
)
end_time = timer()
Expand Down
28 changes: 14 additions & 14 deletions .github/scripts/parse_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
parser.add_argument('--skip', nargs='+', help='Space-separated list of .tla modules to skip parsing', required=False, default=[])
parser.add_argument('--only', nargs='+', help='If provided, only parse models in this space-separated list', required=False, default=[])
parser.add_argument('--verbose', help='Set logging output level to debug', action='store_true')
parser.add_argument('--enable_assertions', help='Enable Java assertions (pass -enableassertions to JVM)', action='store_true')
args = parser.parse_args()

logging.basicConfig(level = logging.DEBUG if args.verbose else logging.INFO)
Expand All @@ -31,27 +32,26 @@
examples_root = dirname(manifest_path)
skip_modules = args.skip
only_modules = args.only
enable_assertions = args.enable_assertions

def parse_module(path):
"""
Parse the given module using SANY.
"""
logging.info(path)
# Jar paths must go first
search_paths = pathsep.join([
tools_jar_path,
apalache_jar_path,
dirname(path),
community_modules,
tlaps_modules
])
sany = subprocess.run([
'java',
'-cp', search_paths,
'tla2sany.SANY',
'-error-codes',
path
],
jvm_parameters = [
'-cp', pathsep.join([
tools_jar_path,
apalache_jar_path,
dirname(path),
community_modules,
tlaps_modules
])
] + (['-enableassertions'] if enable_assertions else [])
sany_parameters = ['-error-codes', path]
sany = subprocess.run(
['java'] + jvm_parameters + ['tla2sany.SANY'] + sany_parameters,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/smoke_test_large_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
parser.add_argument('--skip', nargs='+', help='Space-separated list of models to skip checking', required=False, default=[])
parser.add_argument('--only', nargs='+', help='If provided, only check models in this space-separated list', required=False, default=[])
parser.add_argument('--verbose', help='Set logging output level to debug', action='store_true')
parser.add_argument('--enable_assertions', help='Enable Java assertions (pass -enableassertions to JVM)', action='store_true')
args = parser.parse_args()

tools_jar_path = normpath(args.tools_jar_path)
Expand All @@ -30,6 +31,7 @@
examples_root = dirname(manifest_path)
skip_models = args.skip
only_models = args.only
enable_assertions = args.enable_assertions

def check_model(module, model):
module_path = tla_utils.from_cwd(examples_root, module['path'])
Expand All @@ -46,6 +48,7 @@ def check_model(module, model):
model['mode'],
module['features'],
model['features'],
enable_assertions,
smoke_test_timeout_in_seconds
)
match tlc_result:
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/tla_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def check_model(
mode,
module_features,
model_features,
enable_assertions,
hard_timeout_in_seconds
):
"""
Expand All @@ -149,8 +150,7 @@ def check_model(
)
return apalache
else:
jvm_parameters = [
'-enableassertions',
jvm_parameters = (['-enableassertions'] if enable_assertions else []) + [
'-Dtlc2.TLC.ide=Github',
'-Dutil.ExecutionStatisticsCollector.id=abcdef60f238424fa70d124d0c77ffff',
'-XX:+UseParallelGC',
Expand Down

0 comments on commit 3dfe008

Please # to comment.