[PATCH v2 3/6] Makefile: Only print the test summary in the second pass of 'make check'

Adhemerval Zanella <[email protected]> Thu, 6 Aug 2026 14:07:57 -0300
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
The build-only first pass of the two-pass 'make check' still runs the
static checks (abi, conformtest, installed headers, etc.), and the
top-level tests recipe merged and summarized their results.

An unexpected FAIL there (e.g. check-abi) aborted 'check' before the
second pass ran any built test, and even a clean run printed a misleading
partial summary.

Pass tests-summary=no in the first pass to skip the merge and summary;
the .test-result files persist, so the second pass folds those results
into the one complete summary at the end, restoring the single-pass
reporting behavior.
---
 Makefile  |  7 +++++++
 Makerules | 11 +++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a6aabca6911..b9fac6f47c6 100644
--- a/Makefile
+++ b/Makefile
@@ -869,7 +869,11 @@ endif
 	touch $(objpfx)testroot.pristine/install.stamp
 
 tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
+# The build-only first pass of the two-pass 'make check' (see Makerules)
+# passes tests-summary=no: the merge and summary are left to the second
+# pass, which folds in this pass's $(tests-special) results.
 tests: $(tests-special)
+ifneq ($(tests-summary),no)
 	$(..)scripts/merge-test-results.sh -s $(objpfx) "" \
 	  $(sort $(tests-special-notdir:.out=)) \
 	  > $(objpfx)subdir-tests.sum
@@ -877,11 +881,14 @@ tests: $(tests-special)
 	  $(sort $(subdirs) .) \
 	  > $(objpfx)tests.sum
 	$(call summarize-tests,tests.sum)
+endif
 xtests:
+ifneq ($(tests-summary),no)
 	$(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
 	  $(sort $(subdirs)) \
 	  > $(objpfx)xtests.sum
 	$(call summarize-tests,xtests.sum, for extra tests)
+endif
 
 # The realclean target is just like distclean for the parent, but we want
 # the subdirs to know the difference in case they care.
diff --git a/Makerules b/Makerules
index dfe66b7fa6c..5f65f3ab9ee 100644
--- a/Makerules
+++ b/Makerules
@@ -1211,6 +1211,13 @@ ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -D_GNU_SOURCE \
 # therefore builds the test programs (run-built-tests=no, recursion fully
 # parallel) and then runs them (run-built-tests=yes).  'make tests' and a
 # subdirectory's own 'check' stay single-pass.
+# The first pass still runs the static checks ($(tests-special): abi,
+# conformtest, installed headers, ...), so tests-summary=no makes it skip
+# the results merge and summary: an unexpected FAIL there would otherwise
+# abort 'check' before the second pass runs any built test, and even a
+# clean run would print a misleading partial summary.  The .test-result
+# files persist, so the second pass folds those results into the one
+# complete summary at the end.
 check-twopass :=
 ifndef subdir
 ifeq (yes,$(run-built-tests))
@@ -1219,10 +1226,10 @@ endif
 endif
 ifeq (yes,$(check-twopass))
 check:
-	$(MAKE) run-built-tests=no  tests
+	$(MAKE) run-built-tests=no  tests-summary=no tests
 	$(MAKE) run-built-tests=yes tests
 xcheck:
-	$(MAKE) run-built-tests=no  xtests
+	$(MAKE) run-built-tests=no  tests-summary=no xtests
 	$(MAKE) run-built-tests=yes xtests
 else
 check: tests
-- 
2.53.0