Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] build: run the test suite in parallel
@ 2026-09-10 16:44 Luiz Augusto von Dentz
  2026-09-10 17:30 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2026-09-10 16:44 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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.

Assisted-by: Claude:claude-opus-5
---
 Makefile.am                      | 11 +++++++++++
 test/functional/requirements.txt |  1 +
 2 files changed, 12 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 3840bdbab17c..7164700ae896 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)" \
diff --git a/test/functional/requirements.txt b/test/functional/requirements.txt
index b8a1d99ee4d8..078c3fc6b656 100644
--- a/test/functional/requirements.txt
+++ b/test/functional/requirements.txt
@@ -1,3 +1,4 @@
 pytest>=8
+pytest-xdist
 pytest-bluezenv==0.1.9
 black
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-10 17:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 16:44 [PATCH BlueZ v1] build: run the test suite in parallel Luiz Augusto von Dentz
2026-09-10 17:30 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox