From 97c12f6d37a1ef5796a541b25d729b0d5a1bb5f1 Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Fri, 26 Dec 2025 23:36:33 +0000 Subject: [PATCH] Make lit tests work with filter argument --- check.py | 4 ++-- scripts/test/support.py | 3 +++ test/lit/lit.cfg.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/check.py b/check.py index 0578bda7da0..a3c9509971a 100755 --- a/check.py +++ b/check.py @@ -382,9 +382,9 @@ def run_unittest(): def run_lit(): def run(): lit_script = os.path.join(shared.options.binaryen_bin, 'binaryen-lit') - lit_tests = os.path.join(shared.options.binaryen_root, 'test', 'lit') + lit_tests = shared.get_tests(shared.get_test_dir('lit'), extensions=support.LIT_TEST_SUFFIXES, recursive=True) # lit expects to be run as its own executable - cmd = [sys.executable, lit_script, lit_tests, '-vv'] + cmd = [sys.executable, lit_script, '-vv'] + lit_tests result = subprocess.run(cmd) if result.returncode != 0: shared.num_failures += 1 diff --git a/scripts/test/support.py b/scripts/test/support.py index a8926d8c658..c53c472d1c8 100644 --- a/scripts/test/support.py +++ b/scripts/test/support.py @@ -174,6 +174,9 @@ def to_end(j): return ret +LIT_TEST_SUFFIXES = frozenset({'.wat', '.wast', '.test'}) + + # write a split wast from split_wast. the wast may be binary if the original # file was binary def write_wast(filename, wast, asserts=[]): diff --git a/test/lit/lit.cfg.py b/test/lit/lit.cfg.py index be80ea4fc98..1af9f3a17c5 100644 --- a/test/lit/lit.cfg.py +++ b/test/lit/lit.cfg.py @@ -2,10 +2,13 @@ import sys import lit.formats +sys.path.append(config.binaryen_src_root) +from scripts.test.support import LIT_TEST_SUFFIXES + config.name = "Binaryen lit tests" config.test_format = lit.formats.ShTest() -config.suffixes = ['.wat', '.wast', '.test'] +config.suffixes = LIT_TEST_SUFFIXES config.test_source_root = os.path.dirname(__file__) config.test_exec_root = os.path.join(config.binaryen_build_root, 'out', 'test')