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/lhutsr3khz7.fsf@oldenburg.str.redhat.com/

Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella
2026-07-03 13:01:13 -03:00
parent 19e158b7f0
commit 2b13da5e0e
6 changed files with 31 additions and 5 deletions
+8
View File
@@ -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
+3
View File
@@ -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
+13
View File
@@ -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)
+1 -1
View File
@@ -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
+3 -2
View File
@@ -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
+3 -2
View File
@@ -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