build: run the test suite in parallel
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 build: run the test suite in parallel
From: Luiz Augusto von Dentz <[email protected]>
Both the unit tests and the functional tests were running serially, which makes "make check" unnecessarily slow.
The automake test harness spawns the individual tests from a sub-make, so adding -j to AM_MAKEFLAGS for the check-TESTS/recheck targets is enough to parallelize the unit tests.
The functional tests are parallelized with pytest-xdist. The loadgroup scheduler is required since pytest-bluezenv marks the tests sharing a host/VM setup with an xdist_group, so that they are kept on the same worker instead of each worker re-creating the same setup.
The number of concurrent tests defaults to nproc and can be overridden with CHECK_JOBS, e.g. "make CHECK_JOBS=1 check" for a serial run.
--- Makefile.am | 11 +++++++++++ test/functional/requirements.txt | 1 + 2 files changed, 12 insertions(+)
Makefile.am +11 -0
@@ -859,8 +859,19 @@ endif TESTS = $(unit_tests) AM_TESTS_ENVIRONMENT = MALLOC_CHECK_=3 MALLOC_PERTURB_=69 +# Number of tests to run concurrently, override with e.g. CHECK_JOBS=1 to get +# a serial run. +CHECK_JOBS ?= $(shell nproc 2>/dev/null || echo 4) + +# The automake test harness spawns the individual tests from a sub-make, so +# passing -j to it is enough to run the unit tests in parallel. +check-TESTS recheck: AM_MAKEFLAGS += -j$(CHECK_JOBS) + +# The functional tests are parallelized by pytest-xdist, loadgroup is required +# since pytest-bluezenv groups the tests sharing a host/VM setup together. check-functional: all python3 -m pytest "$(srcdir)/test/functional" -v \ + -n $(CHECK_JOBS) --dist loadgroup \ -m "not tester" \ --kernel="$(FUNCTIONAL_TESTING_KERNEL)" \ --bluez-build-dir="$(top_builddir)" \
test/functional/requirements.txt +1 -0
@@ -1,3 +1,4 @@ pytest>=8 +pytest-xdist pytest-bluezenv==0.1.9 black
Signature · 1 line
2.55.0
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 10 lines · On Thu, 10 Sep 2026 12:44:12 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
Both the unit tests and the functional tests were running serially, which makes "make check" unnecessarily slow.
The automake test harness spawns the individual tests from a sub-make, so adding -j to
AM_MAKEFLAGSfor the check-TESTS/recheck targets is enough to parallelize the unit tests.[...]
Here is the summary with links:
- [BlueZ,v1] build: run the test suite in parallel
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ed279b3516ee
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html