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