diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-11-30 18:52:35 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-12-07 21:21:25 +0200 |
commit | 8be727885553e4086ab9cdc1b725a8a83b589e76 (patch) | |
tree | 0a25e24bb5b89307471a27cf3aa445e803df45ab | |
parent | 06cc98ab542bacd0d06c88d9ebcfb271ba6d17d9 (diff) | |
download | meson-8be727885553e4086ab9cdc1b725a8a83b589e76.tar.gz |
run_project_tests: argparse(choices) for --only name check
-rwxr-xr-x | run_project_tests.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index 61ce5aaab..b48b881e1 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2012-2016 The Meson development team +# Copyright 2012-2019 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,6 +47,12 @@ from run_tests import get_backend_commands, get_backend_args_for_dir, Backend from run_tests import ensure_backend_detects_changes from run_tests import guess_backend +ALL_TESTS = ['cmake', 'common', 'warning-meson', 'failing-meson', 'failing-build', 'failing-test', + 'kconfig', 'platform-osx', 'platform-windows', 'platform-linux', + 'java', 'C#', 'vala', 'rust', 'd', 'objective c', 'objective c++', + 'fortran', 'swift', 'cuda', 'python3', 'python', 'fpga', 'frameworks', 'nasm', 'wasm' + ] + class BuildStep(Enum): configure = 1 @@ -638,8 +644,10 @@ def detect_tests_to_run(only: typing.List[str]) -> typing.List[typing.Tuple[str, tests to run """ - skip_fortran = not(shutil.which('gfortran') or shutil.which('flang') or - shutil.which('pgfortran') or shutil.which('ifort')) + skip_fortran = not(shutil.which('gfortran') or + shutil.which('flang') or + shutil.which('pgfortran') or + shutil.which('ifort')) # Name, subdirectory, skip condition. all_tests = [ @@ -673,8 +681,9 @@ def detect_tests_to_run(only: typing.List[str]) -> typing.List[typing.Tuple[str, ('wasm', 'wasm', shutil.which('emcc') is None or backend is not Backend.ninja), ] + names = [t[0] for t in all_tests] + assert names == ALL_TESTS, 'argparse("--only", choices=ALL_TESTS) need to be updated to match all_tests names' if only: - names = [t[0] for t in all_tests] ind = [names.index(o) for o in only] all_tests = [all_tests[i] for i in ind] gathered_tests = [(name, gather_tests(Path('test cases', subdir)), skip) for name, subdir, skip in all_tests] @@ -939,13 +948,12 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description="Run the test suite of Meson.") parser.add_argument('extra_args', nargs='*', help='arguments that are passed directly to Meson (remember to have -- before these).') - parser.add_argument('--backend', default=None, dest='backend', - choices=backendlist) + parser.add_argument('--backend', dest='backend', choices=backendlist) parser.add_argument('--failfast', action='store_true', help='Stop running if test case fails') parser.add_argument('--no-unittests', action='store_true', help='Not used, only here to simplify run_tests.py') - parser.add_argument('--only', help='name of test(s) to run', nargs='+') + parser.add_argument('--only', help='name of test(s) to run', nargs='+', choices=ALL_TESTS) options = parser.parse_args() setup_commands(options.backend) |