summaryrefslogtreecommitdiff
path: root/scripts/test
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-01-21 19:34:57 -0500
committerGitHub <noreply@github.com>2021-01-21 16:34:57 -0800
commit7a83bc744fff43349e6612263f11bce1fe8dbf34 (patch)
tree87bd8d4e3c1c3bea6e883f08848539e47f3f62f0 /scripts/test
parent3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d (diff)
downloadbinaryen-7a83bc744fff43349e6612263f11bce1fe8dbf34.tar.gz
binaryen-7a83bc744fff43349e6612263f11bce1fe8dbf34.tar.bz2
binaryen-7a83bc744fff43349e6612263f11bce1fe8dbf34.zip
Introduce a script for updating lit tests (#3503)
And demonstrate its capabilities by porting all tests of the optimize-instructions pass to use lit and FileCheck.
Diffstat (limited to 'scripts/test')
-rw-r--r--scripts/test/shared.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/test/shared.py b/scripts/test/shared.py
index 174967b42..f782bb849 100644
--- a/scripts/test/shared.py
+++ b/scripts/test/shared.py
@@ -366,15 +366,16 @@ def get_test_dir(name):
return os.path.join(options.binaryen_test, name)
-def get_tests(test_dir, extensions=[]):
+def get_tests(test_dir, extensions=[], recursive=False):
"""Returns the list of test files in a given directory. 'extensions' is a
list of file extensions. If 'extensions' is empty, returns all files.
"""
tests = []
+ star = '**/*' if recursive else '*'
if not extensions:
- tests += glob.glob(os.path.join(test_dir, '*'))
+ tests += glob.glob(os.path.join(test_dir, star), recursive=True)
for ext in extensions:
- tests += glob.glob(os.path.join(test_dir, '*' + ext))
+ tests += glob.glob(os.path.join(test_dir, star + ext), recursive=True)
if options.test_name_filter:
tests = fnmatch.filter(tests, options.test_name_filter)
return sorted(tests)