'meson test' has two ways to set how many tests to run in parallel:
* the command line --num-processes option
* the environment variable MESON_TESTTHREADS
If both are given, then it prefers the command line option over
the environment variable.
This is an unfortunate order of precedence, because it's frequently
handy to be able to override the default by setting an environment
variable at the top level of a build or CI invocation. Fortunately,
we can flip the order for our purposes, because we always invoke
'meson test' indirectly.
We currently invoke 'meson test' passing it a --num-processes
argument based on whatever the '-j' option to make was. Adjust the
logic in mtest2make so that if MESON_TESTTHREADS is set then we
honour that, and don't override it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
scripts/mtest2make.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index eb01a05ddbd..6de0044134c 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -32,7 +32,11 @@ def names(self, base):
ifneq ($(SPEED), quick)
.mtestargs += --setup $(SPEED)
endif
+# If the user set MESON_TESTTHREADS then don't override that preference by
+# passing --num-processes to 'meson test'
+ifeq ($(MESON_TESTTHREADS),)
.mtestargs += $(subst -j,--num-processes , $(filter-out -j, $(lastword -j1 $(filter -j%, $(MAKEFLAGS)))))
+endif
.check.mtestargs = $(MTESTARGS) $(.mtestargs) $(if $(V),--verbose,--print-errorlogs)
.bench.mtestargs = $(MTESTARGS) $(.mtestargs) --benchmark --verbose''')
--
2.34.1