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

Sam James <[email protected]> Thu, 06 Aug 2026 19:04:35 +0100
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo
Message-ID <[email protected]>
Adhemerval Zanella <[email protected]> writes:

> 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.

Reviewed-by: Sam James <[email protected]>

> ---
>  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
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp0zLMbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkEAS
AQCxUi0lLRRmXw3q57zLpz9Sp8HW7KqgVcstBN7W6mYFCQEA2er11Nkxe3d+vFyW
GsjmjKvuyeFihzOl58YrfcbrTw8=
=Pqua
-----END PGP SIGNATURE-----