aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@gmail.com>2021-05-01 13:31:37 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2021-05-02 22:27:40 +0300
commit9bbf2dd07c1adbb3fd129d1fac824c369d3286cf (patch)
treec753e4d9605624f0ca9dfbcc796fbb9871342ad9 /run_project_tests.py
parent1ca8fa31ea22df14bf78c90af5ca0b881165ac41 (diff)
downloadmeson-9bbf2dd07c1adbb3fd129d1fac824c369d3286cf.zip
meson-9bbf2dd07c1adbb3fd129d1fac824c369d3286cf.tar.gz
meson-9bbf2dd07c1adbb3fd129d1fac824c369d3286cf.tar.bz2
Add validation for --only in `run_project_tests.py`
This now gives a clear error rather than silently passes for unrecognized categories, like: python run_project_tests.py --only nonexisting or python run_project_tests.py --only objc # should be 'objective c'
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 2883e7e..fcb8716 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -999,7 +999,7 @@ def detect_tests_to_run(only: T.Dict[str, T.List[str]], use_tmp: bool) -> T.List
self.category = category # category name
self.subdir = subdir # subdirectory
self.skip = skip # skip condition
- self.stdout_mandatory = stdout_mandatory # expected stdout is mandatory for tests in this categroy
+ self.stdout_mandatory = stdout_mandatory # expected stdout is mandatory for tests in this category
all_tests = [
TestCategory('cmake', 'cmake', not shutil.which('cmake') or (os.environ.get('compiler') == 'msvc2015' and under_ci)),
@@ -1036,6 +1036,8 @@ def detect_tests_to_run(only: T.Dict[str, T.List[str]], use_tmp: bool) -> T.List
assert categories == ALL_TESTS, 'argparse("--only", choices=ALL_TESTS) need to be updated to match all_tests categories'
if only:
+ for key in only.keys():
+ assert key in categories, 'key `{}` is not a recognized category'.format(key)
all_tests = [t for t in all_tests if t.category in only.keys()]
gathered_tests = [(t.category, gather_tests(Path('test cases', t.subdir), t.stdout_mandatory, only[t.category]), t.skip) for t in all_tests]