From 7a83bc744fff43349e6612263f11bce1fe8dbf34 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Thu, 21 Jan 2021 19:34:57 -0500 Subject: 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. --- scripts/test/shared.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'scripts/test') 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) -- cgit v1.2.3