Message ID | 20211108154211.167829-3-hjl.tools@gmail.com |
---|---|
State | New |
Headers | show |
Series | Update Makefile fragments for DSO sorting tests | expand |
On 08/11/2021 12:42, H.J. Lu via Libc-alpha wrote: > Generate Makefile fragment for DSO sorting tests at configure time. > > This partially fixes BZ #28550. I am not sure if configure.ac is the right place to generate the Makefile fragment required for tests. Can we use 'avoid-generated' instead? diff --git a/elf/Makefile b/elf/Makefile index a311c3e23c..8556105a20 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ $(objpfx)tst-unused-dep-cmp.out endif +ifndef avoid-generated # DSO sorting tests: # The dso-ordering-test.py script generates testcase source files in $(objpfx), # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a @@ -507,6 +508,7 @@ ifeq (yes,$(have-tunables)) $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) endif +endif check-abi: $(objpfx)check-abi-ld.out tests-special += $(objpfx)check-abi-ld.out > --- > configure | 11 +++++++++++ > configure.ac | 12 ++++++++++++ > elf/Makefile | 22 +++++----------------- > 3 files changed, 28 insertions(+), 17 deletions(-) > > diff --git a/configure b/configure > index 2f9adca064..91993da3b9 100755 > --- a/configure > +++ b/configure > @@ -8484,3 +8484,14 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then > $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} > fi > > + > +if test "$have_tunables" = yes; then > + test -d elf || mkdir elf > + objdir=`pwd` > + rm -f elf/dso-sort-tests.mk > + (for d in dso-sort-tests-1.def dso-sort-tests-2.def > + do > + $PYTHON $srcdir/scripts/dso-ordering-test.py \ > + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ > + done) > elf/dso-sort-tests.mk > +fi > diff --git a/configure.ac b/configure.ac > index 7eb4239359..faf70b930c 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1901,3 +1901,15 @@ echo "$config_vars" >> config.make;; > esac > test -d bits || mkdir bits]],[[config_vars='$config_vars']]) > AC_OUTPUT > + > +dnl Generate Makefile fragments for DSO sorting tests. > +if test "$have_tunables" = yes; then > + test -d elf || mkdir elf > + objdir=`pwd` > + rm -f elf/dso-sort-tests.mk > + (for d in dso-sort-tests-1.def dso-sort-tests-2.def > + do > + $PYTHON $srcdir/scripts/dso-ordering-test.py \ > + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ > + done) > elf/dso-sort-tests.mk > +fi > diff --git a/elf/Makefile b/elf/Makefile > index 41c19668c3..6995ccaa0f 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -366,6 +366,11 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ > tst-auxvalmod \ > tst-dlmopen-gethostbyname-mod tst-ro-dynamic-mod \ > > +ifeq (yes,$(have-tunables)) > +# Include Makefile fragments for DSO sorting tests. > +include $(objpfx)dso-sort-tests.mk > +endif > + > # Most modules build with _ISOMAC defined, but those filtered out > # depend on internal headers. > modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\ > @@ -486,23 +491,6 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ > $(objpfx)tst-unused-dep-cmp.out > endif > > -# DSO sorting tests: > -# The dso-ordering-test.py script generates testcase source files in $(objpfx), > -# creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a > -# Makefile fragment to be included. > -define include_dsosort_tests > -$(objpfx)$(1).generated-makefile: $(1) > - $(PYTHON) $(..)scripts/dso-ordering-test.py \ > - --description-file $$< --objpfx $(objpfx) --output-makefile $$@ > -include $(objpfx)$(1).generated-makefile > -endef > - > -# Generate from each testcase description file > -ifeq (yes,$(have-tunables)) > -$(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) > -$(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) > -endif > - > check-abi: $(objpfx)check-abi-ld.out > tests-special += $(objpfx)check-abi-ld.out > update-abi: update-abi-ld >
On Mon, Nov 15, 2021 at 10:59 AM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > > > On 08/11/2021 12:42, H.J. Lu via Libc-alpha wrote: > > Generate Makefile fragment for DSO sorting tests at configure time. > > > > This partially fixes BZ #28550. > > I am not sure if configure.ac is the right place to generate the Makefile > fragment required for tests. Can we use 'avoid-generated' instead? > > > diff --git a/elf/Makefile b/elf/Makefile > index a311c3e23c..8556105a20 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ > $(objpfx)tst-unused-dep-cmp.out > endif > > +ifndef avoid-generated > # DSO sorting tests: > # The dso-ordering-test.py script generates testcase source files in $(objpfx), > # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a > @@ -507,6 +508,7 @@ ifeq (yes,$(have-tunables)) > $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) > $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) > endif > +endif It doesn't work. "make check -j28" on a machine with 112 cores failed: /export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/dso-sort-tests-1.def.generated-makefile:938: warning: ignoring old recipe for target '/export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-dso-ordering9-dir/tst-dso-ordering9_25-bacde-b.so' ... make[3]: *** [Makefile:483: elf/tests] Error 2 I couldn't find the exact error message in a very long make log file. > check-abi: $(objpfx)check-abi-ld.out > tests-special += $(objpfx)check-abi-ld.out > > > > --- > > configure | 11 +++++++++++ > > configure.ac | 12 ++++++++++++ > > elf/Makefile | 22 +++++----------------- > > 3 files changed, 28 insertions(+), 17 deletions(-) > > > > diff --git a/configure b/configure > > index 2f9adca064..91993da3b9 100755 > > --- a/configure > > +++ b/configure > > @@ -8484,3 +8484,14 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then > > $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} > > fi > > > > + > > +if test "$have_tunables" = yes; then > > + test -d elf || mkdir elf > > + objdir=`pwd` > > + rm -f elf/dso-sort-tests.mk > > + (for d in dso-sort-tests-1.def dso-sort-tests-2.def > > + do > > + $PYTHON $srcdir/scripts/dso-ordering-test.py \ > > + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ > > + done) > elf/dso-sort-tests.mk > > +fi > > diff --git a/configure.ac b/configure.ac > > index 7eb4239359..faf70b930c 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -1901,3 +1901,15 @@ echo "$config_vars" >> config.make;; > > esac > > test -d bits || mkdir bits]],[[config_vars='$config_vars']]) > > AC_OUTPUT > > + > > +dnl Generate Makefile fragments for DSO sorting tests. > > +if test "$have_tunables" = yes; then > > + test -d elf || mkdir elf > > + objdir=`pwd` > > + rm -f elf/dso-sort-tests.mk > > + (for d in dso-sort-tests-1.def dso-sort-tests-2.def > > + do > > + $PYTHON $srcdir/scripts/dso-ordering-test.py \ > > + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ > > + done) > elf/dso-sort-tests.mk > > +fi > > diff --git a/elf/Makefile b/elf/Makefile > > index 41c19668c3..6995ccaa0f 100644 > > --- a/elf/Makefile > > +++ b/elf/Makefile > > @@ -366,6 +366,11 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ > > tst-auxvalmod \ > > tst-dlmopen-gethostbyname-mod tst-ro-dynamic-mod \ > > > > +ifeq (yes,$(have-tunables)) > > +# Include Makefile fragments for DSO sorting tests. > > +include $(objpfx)dso-sort-tests.mk > > +endif > > + > > # Most modules build with _ISOMAC defined, but those filtered out > > # depend on internal headers. > > modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\ > > @@ -486,23 +491,6 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ > > $(objpfx)tst-unused-dep-cmp.out > > endif > > > > -# DSO sorting tests: > > -# The dso-ordering-test.py script generates testcase source files in $(objpfx), > > -# creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a > > -# Makefile fragment to be included. > > -define include_dsosort_tests > > -$(objpfx)$(1).generated-makefile: $(1) > > - $(PYTHON) $(..)scripts/dso-ordering-test.py \ > > - --description-file $$< --objpfx $(objpfx) --output-makefile $$@ > > -include $(objpfx)$(1).generated-makefile > > -endef > > - > > -# Generate from each testcase description file > > -ifeq (yes,$(have-tunables)) > > -$(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) > > -$(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) > > -endif > > - > > check-abi: $(objpfx)check-abi-ld.out > > tests-special += $(objpfx)check-abi-ld.out > > update-abi: update-abi-ld > > -- H.J.
On 15/11/2021 16:51, H.J. Lu wrote: > On Mon, Nov 15, 2021 at 10:59 AM Adhemerval Zanella > <adhemerval.zanella@linaro.org> wrote: >> >> >> >> On 08/11/2021 12:42, H.J. Lu via Libc-alpha wrote: >>> Generate Makefile fragment for DSO sorting tests at configure time. >>> >>> This partially fixes BZ #28550. >> >> I am not sure if configure.ac is the right place to generate the Makefile >> fragment required for tests. Can we use 'avoid-generated' instead? >> >> >> diff --git a/elf/Makefile b/elf/Makefile >> index a311c3e23c..8556105a20 100644 >> --- a/elf/Makefile >> +++ b/elf/Makefile >> @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ >> $(objpfx)tst-unused-dep-cmp.out >> endif >> >> +ifndef avoid-generated >> # DSO sorting tests: >> # The dso-ordering-test.py script generates testcase source files in $(objpfx), >> # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a >> @@ -507,6 +508,7 @@ ifeq (yes,$(have-tunables)) >> $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) >> $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) >> endif >> +endif > > It doesn't work. "make check -j28" on a machine with 112 cores failed: > > /export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/dso-sort-tests-1.def.generated-makefile:938: > warning: ignoring old recipe for target > '/export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-dso-ordering9-dir/tst-dso-ordering9_25-bacde-b.so' > ... > make[3]: *** [Makefile:483: elf/tests] Error 2 > > I couldn't find the exact error message in a very long make log file. This is usual way to create other auto-generated Makefile fragments, such as sysd-sycalls and time64-compat.mk. Maybe the below helps (I forgot to use '-include' and add the fragments on postclean-generated). diff --git a/elf/Makefile b/elf/Makefile index a311c3e23c..0e6d7ffb51 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ $(objpfx)tst-unused-dep-cmp.out endif +ifndef avoid-generated # DSO sorting tests: # The dso-ordering-test.py script generates testcase source files in $(objpfx), # creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a @@ -499,7 +500,7 @@ define include_dsosort_tests $(objpfx)$(1).generated-makefile: $(1) $(PYTHON) $(..)scripts/dso-ordering-test.py \ --description-file $$< --objpfx $(objpfx) --output-makefile $$@ -include $(objpfx)$(1).generated-makefile +-include $(objpfx)$(1).generated-makefile endef # Generate from each testcase description file @@ -507,6 +508,10 @@ ifeq (yes,$(have-tunables)) $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) endif +endif + +postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \ + $(objpfx)/dso-sort-tests-2.generated-makefile check-abi: $(objpfx)check-abi-ld.out tests-special += $(objpfx)check-abi-ld.out
diff --git a/configure b/configure index 2f9adca064..91993da3b9 100755 --- a/configure +++ b/configure @@ -8484,3 +8484,14 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + +if test "$have_tunables" = yes; then + test -d elf || mkdir elf + objdir=`pwd` + rm -f elf/dso-sort-tests.mk + (for d in dso-sort-tests-1.def dso-sort-tests-2.def + do + $PYTHON $srcdir/scripts/dso-ordering-test.py \ + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ + done) > elf/dso-sort-tests.mk +fi diff --git a/configure.ac b/configure.ac index 7eb4239359..faf70b930c 100644 --- a/configure.ac +++ b/configure.ac @@ -1901,3 +1901,15 @@ echo "$config_vars" >> config.make;; esac test -d bits || mkdir bits]],[[config_vars='$config_vars']]) AC_OUTPUT + +dnl Generate Makefile fragments for DSO sorting tests. +if test "$have_tunables" = yes; then + test -d elf || mkdir elf + objdir=`pwd` + rm -f elf/dso-sort-tests.mk + (for d in dso-sort-tests-1.def dso-sort-tests-2.def + do + $PYTHON $srcdir/scripts/dso-ordering-test.py \ + --description-file $srcdir/elf/$d --objpfx $objdir/elf/ + done) > elf/dso-sort-tests.mk +fi diff --git a/elf/Makefile b/elf/Makefile index 41c19668c3..6995ccaa0f 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -366,6 +366,11 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ tst-auxvalmod \ tst-dlmopen-gethostbyname-mod tst-ro-dynamic-mod \ +ifeq (yes,$(have-tunables)) +# Include Makefile fragments for DSO sorting tests. +include $(objpfx)dso-sort-tests.mk +endif + # Most modules build with _ISOMAC defined, but those filtered out # depend on internal headers. modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\ @@ -486,23 +491,6 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ $(objpfx)tst-unused-dep-cmp.out endif -# DSO sorting tests: -# The dso-ordering-test.py script generates testcase source files in $(objpfx), -# creating a $(objpfx)<testcase-name>-dir for each testcase, and creates a -# Makefile fragment to be included. -define include_dsosort_tests -$(objpfx)$(1).generated-makefile: $(1) - $(PYTHON) $(..)scripts/dso-ordering-test.py \ - --description-file $$< --objpfx $(objpfx) --output-makefile $$@ -include $(objpfx)$(1).generated-makefile -endef - -# Generate from each testcase description file -ifeq (yes,$(have-tunables)) -$(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) -$(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) -endif - check-abi: $(objpfx)check-abi-ld.out tests-special += $(objpfx)check-abi-ld.out update-abi: update-abi-ld