Re: [PATCH v2 5/6] Run check-installed-headers concurrently for each header
Sam James <[email protected]>
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Organization | Gentoo |
| Message-ID | <[email protected]> |
Adhemerval Zanella <[email protected]> writes: > The check-installed-headers-c/-cxx tests ran one script invocation per > subdirectory over all of its installed headers, performing about 80 > compiler invocations per header serially. > > Give each header its own intermediate target so the compiler > invocations parallelize under the make jobserver, recording the > per-header script exit status next to the output. The .out target > concatenates the per-header outputs in the original $(headers) order > and fails if any recorded status is non-zero, so both the .out contents > (verified byte-identical for all 76 files) and the tests.sum results > are unchanged. > > Results on a x86_64 machine [1] from a make check with run-built-tests=no > show neutral results, and on aarch64 machine [2] it improves from 241.574s > to 182.405. > > [1] Ryzen 5900x, 12c/24t, gcc 16.1.1, binutils 2.26, and GNU make 4.3 > [2] N1, 80c, gcc 15.1.1, binutils 2.25, GNU make 4.3 Reviewed-by: Sam James <[email protected]> > --- > Makefile | 37 ++++++++++++++++++++++++++----------- > Rules | 38 +++++++++++++++++++++++++++----------- > 2 files changed, 53 insertions(+), 22 deletions(-) > > diff --git a/Makefile b/Makefile > index 79dbe0f40d3..5f2293dfd7d 100644 > --- a/Makefile > +++ b/Makefile > @@ -684,26 +684,41 @@ $(objpfx)check-local-headers.out: scripts/check-local-headers.sh > $(evaluate-test) > > ifneq "$(headers)" "" > -# Special test of all the installed headers in this directory. > +# Special test of all the installed headers in this directory. See > +# Rules for the per-header split rationale. > tests-special += $(objpfx)check-installed-headers-c.out > libof-check-installed-headers-c := testsuite > -$(objpfx)check-installed-headers-c.out: \ > ++cih-c-iouts := $(patsubst %,$(objpfx)check-installed-headers-c/%.iout,\ > + $(headers)) > +$(+cih-c-iouts): $(objpfx)check-installed-headers-c/%.iout: \ > scripts/check-installed-headers.sh $(headers) > - $(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \ > - "$(CC) $(test-config-cflags-finput-charset-ascii) \ > - $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ > - $(headers) > $@; \ > + $(make-target-directory) > + ($(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \ > + "$(CC) $(test-config-cflags-finput-charset-ascii) \ > + $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ > + $*; echo $$? > $@-ret) > $@T; \ > + mv -f $@T $@ > +$(objpfx)check-installed-headers-c.out: $(+cih-c-iouts) > + cat $^ > $@; \ > + ! grep -qv '^0$$' $(+cih-c-iouts:%=%-ret); \ > $(evaluate-test) This is clever :) > > ifneq "$(CXX)" "" > tests-special += $(objpfx)check-installed-headers-cxx.out > libof-check-installed-headers-cxx := testsuite > -$(objpfx)check-installed-headers-cxx.out: \ > ++cih-cxx-iouts := $(patsubst %,$(objpfx)check-installed-headers-cxx/%.iout,\ > + $(headers)) > +$(+cih-cxx-iouts): $(objpfx)check-installed-headers-cxx/%.iout: \ > scripts/check-installed-headers.sh $(headers) > - $(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \ > - "$(CXX) $(test-config-cxxflags-finput-charset-ascii) \ > - $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ > - $(headers) > $@; \ > + $(make-target-directory) > + ($(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \ > + "$(CXX) $(test-config-cxxflags-finput-charset-ascii) \ > + $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ > + $*; echo $$? > $@-ret) > $@T; \ > + mv -f $@T $@ > +$(objpfx)check-installed-headers-cxx.out: $(+cih-cxx-iouts) > + cat $^ > $@; \ > + ! grep -qv '^0$$' $(+cih-cxx-iouts:%=%-ret); \ > $(evaluate-test) > endif # $(CXX) > > diff --git a/Rules b/Rules > index 385246f07df..a74043e6059 100644 > --- a/Rules > +++ b/Rules > @@ -80,15 +80,24 @@ common-generated += dummy.o dummy.c > > ifneq "$(headers)" "" > # Test that all of the headers installed by this directory can be compiled > -# in isolation. > +# in isolation. Each header gets its own intermediate target so that the > +# it can run concurrently under -j; the .out target concatenates the per-header > +# results in the original $(headers) order. > tests-special += $(objpfx)check-installed-headers-c.out > libof-check-installed-headers-c := testsuite > -$(objpfx)check-installed-headers-c.out: \ > ++cih-c-iouts := $(patsubst %,$(objpfx)check-installed-headers-c/%.iout,\ > + $(headers)) > +$(+cih-c-iouts): $(objpfx)check-installed-headers-c/%.iout: \ > $(..)scripts/check-installed-headers.sh $(headers) > - $(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \ > - "$(CC) $(test-config-cflags-finput-charset-ascii) \ > - $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ > - $(headers) > $@; \ > + $(make-target-directory) > + ($(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \ > + "$(CC) $(test-config-cflags-finput-charset-ascii) \ > + $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ > + $*; echo $$? > $@-ret) > $@T; \ > + mv -f $@T $@ > +$(objpfx)check-installed-headers-c.out: $(+cih-c-iouts) > + cat $^ > $@; \ > + ! grep -qv '^0$$' $(+cih-c-iouts:%=%-ret); \ > $(evaluate-test) > > ifneq "$(CXX)" "" > @@ -96,12 +105,19 @@ ifneq "$(CXX)" "" > # in isolation as C++. > tests-special += $(objpfx)check-installed-headers-cxx.out > libof-check-installed-headers-cxx := testsuite > -$(objpfx)check-installed-headers-cxx.out: \ > ++cih-cxx-iouts := $(patsubst %,$(objpfx)check-installed-headers-cxx/%.iout,\ > + $(headers)) > +$(+cih-cxx-iouts): $(objpfx)check-installed-headers-cxx/%.iout: \ > $(..)scripts/check-installed-headers.sh $(headers) > - $(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \ > - "$(CXX) $(test-config-cxxflags-finput-charset-ascii) \ > - $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ > - $(headers) > $@; \ > + $(make-target-directory) > + ($(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \ > + "$(CXX) $(test-config-cxxflags-finput-charset-ascii) \ > + $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ > + $*; echo $$? > $@-ret) > $@T; \ > + mv -f $@T $@ > +$(objpfx)check-installed-headers-cxx.out: $(+cih-cxx-iouts) > + cat $^ > $@; \ > + ! grep -qv '^0$$' $(+cih-cxx-iouts:%=%-ret); \ > $(evaluate-test) > endif # $(CXX)
signature.asc
(application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE----- iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmpHl5MbFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkG3C AQCY+7rboJrrcizf90+EN6P56azynGE7AYY0Fyzo2DqN+AEA7I+sjVUvUYVBImIO Zg7x6iUOa+IlZ1SiDdqGT5i/5AI= =YyiQ -----END PGP SIGNATURE-----