summaryrefslogtreecommitdiff
path: root/scripts/test/shared.py
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2023-12-11 17:40:22 -0800
committerGitHub <noreply@github.com>2023-12-11 17:40:22 -0800
commit9e07c8266edcc77624748032ae1186953f6242df (patch)
tree58c27e64fb2dad131fba1f15a59f242f17962e42 /scripts/test/shared.py
parentcfb2a6e4ae7d1aefa53963b9249abadb6f756784 (diff)
downloadbinaryen-9e07c8266edcc77624748032ae1186953f6242df.tar.gz
binaryen-9e07c8266edcc77624748032ae1186953f6242df.tar.bz2
binaryen-9e07c8266edcc77624748032ae1186953f6242df.zip
[test] Make get_tests return only files (#6164)
Currently `get_tests` returns files and directories, especially when the extension is not given. This makes `get_tests` return a directory like `test/wasm2js/` as a test. `wasm2js.py`'s `check_for_stale_files` errors out when there are files within `test/wasm2js/` whose basenames don't match any files within any of `test/`, `test/spec/`, `test/wasm2js/`. https://github.com/WebAssembly/binaryen/blob/1d615b38dd4152494d2f4d3520c8b1d917624a30/scripts/test/wasm2js.py#L33-L46 `wasm2js.wast.asserts` is apparently a special case for asserts test: https://github.com/WebAssembly/binaryen/blob/1d615b38dd4152494d2f4d3520c8b1d917624a30/scripts/test/wasm2js.py#L28 and this doesn't seem to have the matching `wast` tests in the three test directories. But it just happened to not error out because `get_tests` returns directory names too and one of them was `wasm2js` (`test/wasm2js/` directory). This makes `get_tests` return only files, and make files in `assert_tests` not error out additionally.
Diffstat (limited to 'scripts/test/shared.py')
-rw-r--r--scripts/test/shared.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/test/shared.py b/scripts/test/shared.py
index 441545db3..8fdf2375c 100644
--- a/scripts/test/shared.py
+++ b/scripts/test/shared.py
@@ -386,6 +386,7 @@ def get_tests(test_dir, extensions=[], recursive=False):
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)
+ tests = [item for item in tests if os.path.isfile(item)]
return sorted(tests)