diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-04 21:19:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-04 21:19:39 +0300 |
commit | 577d6bfdb483452b2a9434ba3a1d7031094b0cbd (patch) | |
tree | 1dac74f6e858db7c896e033062a125ac2048aacd /mesonbuild/mtest.py | |
parent | 019a627f047667ea04574cebb9a174156b2a7a67 (diff) | |
parent | adae6b56de5d8dac7b2eddbb3b9924e440a28fd6 (diff) | |
download | meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.zip meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.tar.gz meson-577d6bfdb483452b2a9434ba3a1d7031094b0cbd.tar.bz2 |
Merge pull request #4204 from xclaesse/unify-cmd-line
Use a single ArgumentParser for all subcommands
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 8d9a585..78f2252 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -60,8 +60,7 @@ def determine_worker_count(): num_workers = 1 return num_workers -def buildparser(): - parser = argparse.ArgumentParser(prog='meson test') +def add_arguments(parser): parser.add_argument('--repeat', default=1, dest='repeat', type=int, help='Number of times to run the tests.') parser.add_argument('--no-rebuild', default=False, action='store_true', @@ -102,7 +101,6 @@ def buildparser(): help='Arguments to pass to the specified test(s) or all tests') parser.add_argument('args', nargs='*', help='Optional list of tests to run') - return parser def returncode_to_status(retcode): @@ -737,9 +735,7 @@ def rebuild_all(wd): return True -def run(args): - options = buildparser().parse_args(args) - +def run(options): if options.benchmark: options.num_processes = 1 @@ -784,3 +780,9 @@ def run(args): else: print(e) return 1 + +def run_with_args(args): + parser = argparse.ArgumentParser(prog='meson test') + add_arguments(parser) + options = parser.parse_args(args) + return run(options) |