[glibc] Makerules: add 'make check-parallel' to run tests without serialization
Adhemerval Zanella via Glibc-cvs <[email protected]> Fri, 3 Jul 2026 23:34:20 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2b13da5e0eb77b843b93ad40273b3b8ce4742b2c commit 2b13da5e0eb77b843b93ad40273b3b8ce4742b2c Author: Adhemerval Zanella <[email protected]> Date: Mon Jun 15 14:22:38 2026 -0300 Makerules: add 'make check-parallel' to run tests without serialization The default 'make check' serializes the timing-sensitive test runs: the threading (nptl, or htl on Hurd) and realtime (rt) subdirectories run with .NOTPARALLEL and are ordered after the rest of the test run, so they are not perturbed by competing machine load. Add a check-parallel (and xcheck-parallel) variant for when that is not wanted -- an idle machine, or a run where the extra throughput is worth the risk of flakiness in the timing-sensitive tests (check the libc-alpha discussion [1] for more context why this approach was proposed). A new serialize-tests flag (default yes, defined in Makeconfig) gates both the per-subdirectory .NOTPARALLEL and the top-level run-time ordering; check-parallel just runs the suite with serialize-tests=no, so every test program builds and runs at full concurrency in a single pass. 'make check' and its default behavior are unchanged. [1] https://inbox.sourceware.org/libc-alpha/[email protected]/ Reviewed-by: Sam James <[email protected]> Diff: --- Makeconfig | 8 ++++++++ Makefile | 3 +++ Makerules | 13 +++++++++++++ htl/Makefile | 2 +- nptl/Makefile | 5 +++-- rt/Makefile | 5 +++-- 6 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Makeconfig b/Makeconfig index 8fe7217dd7..6cd590cf21 100644 --- a/Makeconfig +++ b/Makeconfig @@ -782,6 +782,14 @@ run-built-tests = yes endif endif +# Whether the timing-sensitive test runs are serialized: each is run with +# .NOTPARALLEL and, at the top level, ordered after the rest of the test run. +# This is the default; 'make check-parallel' clears it to run every test +# concurrently. +ifndef serialize-tests +serialize-tests = yes +endif + # Whether to build the static math tests ifndef build-math-static-tests build-math-static-tests = no diff --git a/Makefile b/Makefile index b421dbbafb..54de425e9e 100644 --- a/Makefile +++ b/Makefile @@ -594,7 +594,9 @@ $(objpfx)testroot.pristine/install.stamp: | others # 'make subdir/tests' is left alone. And it only orders the test run # (run-built-tests=yes); the "build the tests" pass (run-built-tests=no) # is left fully parallel, so every test program still builds concurrently. +# serialize-tests=no ('make check-parallel') drops the ordering entirely. ifeq ($(run-built-tests),yes) +ifeq (yes,$(serialize-tests)) ifneq (,$(filter tests xtests check xcheck,$(MAKECMDGOALS))) +late-test-subdirs := $(filter nptl htl,$(subdirs)) $(filter rt,$(subdirs)) +test-run-prev := \ @@ -604,6 +606,7 @@ $(foreach d,$(+late-test-subdirs),\ $(eval +test-run-prev += $(d)/tests)) endif endif +endif ifeq (yes,$(build-shared)) # The top-level libc.so and linkobj/libc_pic.a rules list these diff --git a/Makerules b/Makerules index 38a01d38be..6bef57ece9 100644 --- a/Makerules +++ b/Makerules @@ -1214,6 +1214,19 @@ check: tests xcheck: xtests endif +# 'make check-parallel' runs the whole suite with maximum concurrency: +# serialize-tests=no drops the per-subdirectory .NOTPARALLEL and the run-time +# ordering, so every test builds and runs in parallel. A single pass suffices +# (there is no .NOTPARALLEL to work around, so the test programs already build +# concurrently). +# This is faster on an idle machine, at the cost of possible flakiness in the +# timing-sensitive tests under the heavier load. +.PHONY: check-parallel xcheck-parallel +check-parallel: + $(MAKE) serialize-tests=no tests +xcheck-parallel: + $(MAKE) serialize-tests=no xtests + # Also handle test inputs in sysdeps. vpath %.input $(sysdirs) diff --git a/htl/Makefile b/htl/Makefile index 31e8ffd8e1..8078a7ade1 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -259,7 +259,7 @@ $(addprefix $(objpfx),$(tests) $(test-srcs)): $(srcdir)/libpthread_syms.a $(objp endif # Like rt, these tests prefer to be run serially. -ifeq ($(run-built-tests),yes) +ifeq (yes-yes,$(run-built-tests)-$(serialize-tests)) ifneq ($(filter %tests,$(MAKECMDGOALS)),) .NOTPARALLEL: endif diff --git a/nptl/Makefile b/nptl/Makefile index 02862d1c04..97a0fb7f65 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -738,8 +738,9 @@ tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so tst-setuid1-static-ENV = \ LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss -# The tests here better do not run in parallel. -ifeq ($(run-built-tests),yes) +# The tests here better do not run in parallel, unless serialize-tests is +# cleared (make check-parallel). +ifeq (yes-yes,$(run-built-tests)-$(serialize-tests)) ifneq ($(filter %tests,$(MAKECMDGOALS)),) .NOTPARALLEL: endif diff --git a/rt/Makefile b/rt/Makefile index 24e43a8759..f39e9674e5 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -111,8 +111,9 @@ $(objpfx)librt.so: $(shared-thread-library) tst-mqueue7-ARGS = -- $(host-test-program-cmd) # The timer and message-queue tests here are timing-sensitive and better -# do not run in parallel. -ifeq ($(run-built-tests),yes) +# do not run in parallel, unless serialize-tests is cleared (make +# check-parallel). +ifeq (yes-yes,$(run-built-tests)-$(serialize-tests)) ifneq ($(filter %tests,$(MAKECMDGOALS)),) .NOTPARALLEL: endif