diff options
author | Pino Toscano <pino@kde.org> | 2022-11-17 19:09:47 +0100 |
---|---|---|
committer | Pino Toscano <pino@kde.org> | 2022-11-17 19:09:47 +0100 |
commit | ab8993c9e10e09cb24210f76bb5e67f01bb37a9e (patch) | |
tree | 78642023e2512be15d4b25fe55976bd97375cd4f | |
parent | 6f8b80912ca68021332b790be4d1ff3a5e063f5a (diff) |
tests: add -j/--jobs option for run_tests.py
This way it is possible to customize the number of parallel jobs to
spawn for the tests, instead of unconditionally using all available
CPUs. This can be helpful to run the tests without overloading the
system.
The default is still the number of available CPUs, so there is no
behaviour change by default.
-rwxr-xr-x | tests/run_tests.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py index bf4967d1..ea03ab4c 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -443,6 +443,8 @@ parser.add_argument("--dump-ast", action='store_true', help='Dump a unit-test AST to file') parser.add_argument( "--exclude", help='Comma separated list of checks to ignore') +parser.add_argument("-j", "--jobs", type=int, default=multiprocessing.cpu_count(), + help='Parallel jobs to run (defaults to %(default)s)') parser.add_argument("check_names", nargs='*', help="The name of the check whose unit-tests will be run. Defaults to running all checks.") args = parser.parse_args() @@ -460,7 +462,7 @@ _verbose = args.verbose _no_standalone = args.no_standalone _no_fixits = args.no_fixits _only_standalone = args.only_standalone -_num_threads = multiprocessing.cpu_count() +_num_threads = args.jobs _lock = threading.Lock() _was_successful = True _qt5_installation = find_qt_installation( |