From 0c561cd7a3695ae58eafde5da5f209c883ec793b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Stefanesco?= Date: Thu, 13 Feb 2025 23:06:56 +0000 Subject: [PATCH] Lean: print name of failing test --- test/lean/run_tests.py | 10 +++++----- test/sailtest.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/lean/run_tests.py b/test/lean/run_tests.py index 65287d583..6e42d46eb 100755 --- a/test/lean/run_tests.py +++ b/test/lean/run_tests.py @@ -53,14 +53,14 @@ def test_lean(subdir: str, allowed_list = None, runnable: bool = False): '--splice', 'coq-print.splice' ] if runnable else [ ]) - step('\'{}\' {} {} --lean --lean-output-dir {}'.format(sail, extra_flags, filename, basename)) + step('\'{}\' {} {} --lean --lean-output-dir {}'.format(sail, extra_flags, filename, basename), name=filename) if runnable: - step(f'lake exe run > expected 2> err_status', cwd=f'{basename}/out') + step(f'lake exe run > expected 2> err_status', cwd=f'{basename}/out', name=filename) else: # NOTE: lake --dir does not behave the same as cd $dir && lake build... - step('lake build', cwd=f'{basename}/out') + step('lake build', cwd=f'{basename}/out', name=filename) - status = step_with_status(f'diff {basename}/out/Out.lean {basename}.expected.lean') + status = step_with_status(f'diff {basename}/out/Out.lean {basename}.expected.lean', name=filename) if status != 0: if update_expected: print(f'Overriding file {basename}.expected.lean') @@ -69,7 +69,7 @@ def test_lean(subdir: str, allowed_list = None, runnable: bool = False): sys.exit(1) if runnable: - status = step_with_status(f'diff {basename}/out/expected {basename}.expect') + status = step_with_status(f'diff {basename}/out/expected {basename}.expect', name=filename) if status != 0: sys.exit(1) step('rm -r {}'.format(basename)) diff --git a/test/sailtest.py b/test/sailtest.py index 01dc4280b..af99be483 100644 --- a/test/sailtest.py +++ b/test/sailtest.py @@ -114,7 +114,7 @@ def project_chunks(filenames, cores): ys.append(list(chunk)) return ys -def step_with_status(string, expected_status=0, cwd=None): +def step_with_status(string, expected_status=0, cwd=None, name=""): p = subprocess.Popen(string, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, cwd=cwd) out, err = p.communicate() status = p.wait() @@ -122,7 +122,7 @@ def step_with_status(string, expected_status=0, cwd=None): if is_compact(): compact_char(color.FAIL, 'X') else: - print("{}Failed{}: {}".format(color.FAIL, color.END, string)) + print("{}Failed{}: {} {}".format(color.FAIL, color.END, name, string)) if not args.hide_error_output: print('{}stdout{}:'.format(color.NOTICE, color.END)) print(out.decode('utf-8')) @@ -130,8 +130,8 @@ def step_with_status(string, expected_status=0, cwd=None): print(err.decode('utf-8')) return status -def step(string, expected_status=0, cwd=None): - if step_with_status(string, expected_status=expected_status, cwd=cwd) != expected_status: +def step(string, expected_status=0, cwd=None, name=""): + if step_with_status(string, expected_status=expected_status, cwd=cwd, name=name) != expected_status: sys.exit(1) def banner(string):