[PATCH] Add --enable-dynamic-test configure option
Carlos O'Donell
carlos@systemhalted.org
Thu Dec 20 19:50:00 GMT 2012
On 12/08/2012 06:36 PM, H.J. Lu wrote:
> On Thu, Oct 11, 2012 at 03:20:12PM -0700, Roland McGrath wrote:
>>> I have the following lines in configparms:
>>>
>>> ifdef LT
>>> config-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)$(rtld-installed-name) \
>>> -Wl,-rpath=$(rpath-link)$(patsubst %,:%,$(sysdep-library-path))
>>> endif
>>>
>>> So I can say "make LT=1" to rebuild a test program with the hardcoded
>>> build paths.
>>
>> Right, this is exactly the kind of thing I was suggesting. I suggested a
>> configure option or makefile variable just to get the magic easily encoded
>> somewhere so people don't have to copy magic boilerplate.
>>
>
> Hi,
>
> Here is the updated patch to add --enable-dynamic-test. When
> --enable-dynamic-test is used to configure glibc build, we set
> PT_INTERP and DT_RPATH in dynamic tests to newly built glibc so that
> they can run directly if not cross compiling.
>
>
> H.J.
> ---
> Makeconfig | 61 ++++++++++++----
> Makefile | 2 +-
> Makerules | 8 +--
> Rules | 23 ++++--
> catgets/Makefile | 2 +-
> catgets/test-gencat.sh | 4 +-
> config.make.in | 1 +
> configure | 13 ++++
> configure.in | 7 ++
> elf/Makefile | 36 +++++-----
> grp/Makefile | 2 +-
> grp/tst_fgetgrent.sh | 10 +--
> iconvdata/Makefile | 2 +-
> iconvdata/tst-table.sh | 6 +-
> iconvdata/tst-tables.sh | 4 +-
> intl/Makefile | 10 +--
> intl/tst-gettext.sh | 4 +-
> intl/tst-gettext2.sh | 4 +-
> intl/tst-gettext4.sh | 4 +-
> intl/tst-gettext6.sh | 4 +-
> intl/tst-translit.sh | 4 +-
> io/Makefile | 2 +-
> libio/Makefile | 2 +-
> libio/test-freopen.sh | 4 +-
> localedata/Makefile | 19 ++---
> localedata/bug-setlocale1.c | 14 +---
> localedata/sort-test.sh | 6 +-
> localedata/tst-fmon.sh | 5 +-
> localedata/tst-mbswcs.sh | 12 ++--
> localedata/tst-numeric.sh | 4 +-
> localedata/tst-trans.sh | 3 +-
> malloc/Makefile | 2 +-
> malloc/tst-mtrace.sh | 4 +-
> nptl/Makefile | 12 ++--
> nptl/tst-tls6.sh | 6 +-
> posix/Makefile | 16 +++--
> posix/globtest.sh | 101 +++++++++++++-------------
> posix/tst-exec-static.c | 1 +
> posix/tst-exec.c | 20 +++---
> posix/tst-spawn-static.c | 1 +
> posix/tst-spawn.c | 51 ++++++++-----
> posix/wordexp-tst.sh | 22 +++---
> rt/Makefile | 2 +-
> stdio-common/Makefile | 6 +-
> stdio-common/tst-printf.sh | 4 +-
> stdio-common/tst-unbputc.sh | 4 +-
> stdlib/Makefile | 2 +-
> stdlib/tst-fmtmsg.sh | 4 +-
> string/Makefile | 2 +-
> 50 files changed, 480 insertions(+), 232 deletions(-)
> create mode 100644 ChangeLog.dynamic-test
> create mode 100644 posix/tst-exec-static.c
> create mode 100644 posix/tst-spawn-static.c
>
> 2012-12-08 H.J. Lu <hongjiu.lu@intel.com>
>
> * Makeconfig (+link-pie-before-libc): New.
> (+link-pie-after-libc): Likewise.
> (+link-pie-tests): Likewise.
> (+link-pie): Rewritten.
> (link-before-libc): Remove $(config-LDFLAGS).
> (+link): Add $(rtld-LDFLAGS) after $(+link-before-libc).
> (+link-tests): Add $(rtld-tests-LDFLAGS) after $(+link-before-libc).
> (config-LDFLAGS): Renamed to ...
> (rtld-LDFLAGS): This.
> (rtld-tests-LDFLAGS): New macro.
> (link-libc-rpath-link): Likewise.
> (link-libc-tests-rpath-link): Likewise.
> (link-libc-before-gnulib): Remove -Wl,-rpath-link=$(rpath-link).
> (link-libc): Prepand $(link-libc-rpath-link).
> (link-libc-tests): Prepand $(link-libc-tests-rpath-link).
> (test-program-prefix): New macro.
> (test-via-rtld-prefix): Likewise.
> (test-program-cmd): Likewise.
> (host-test-program-cmd): Likewise.
> * Makefile ($(common-objpfx)testrun.sh): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * Makerules ($(LINK.o)): Replace $(config-LDFLAGS) with
> $(rtld-LDFLAGS).
> ($(common-objpfx)shlib.lds): Likewise.
> (build-module-helper): Likewise.
> ($(common-objpfx)format.lds): Likewise.
> * Rules (binaries-pie-tests): New.
> (binaries-pie-notests): Likewise.
> (binaries-pie): Rewritten.
> ($(addprefix $(objpfx),$(binaries-pie))): Renamed to ...
> ($(addprefix $(objpfx),$(binaries-pie-notests))): This.
> ($(addprefix $(objpfx),$(binaries-pie-tests))): New.
> (make-test-out): Replace $(host-built-program-cmd) with
> $(host-test-program-cmd).
> * config.make.in (build-dynamic-test): New variable.
> * configure.in (--enable-dynamic-test): New configure option.
> (dynamic_test): New AC_SUBST.
> * configure: Regenerated.
> * catgets/Makefile ($(objpfx)test-gencat.out): Replace
> $(built-program-cmd) with $(test-program-cmd).
> * catgets/test-gencat.sh (run_program_cmd): Renamed to ...
> (test_program_cmd): This.
> * elf/Makefile ($(objpfx)order.out): Run test directly with
> LD_LIBRARY_PATH set to $(objpfx), using $(test-wrapper-env).
> ($(objpfx)order2.out): Likewise.
> ($(objpfx)tst-initorder.out): Likewise.
> ($(objpfx)tst-initorder2.out): Likewise.
> ($(objpfx)tst-array1.out): Replace $(built-program-cmd) with
> $(test-program-cmd).
> ($(objpfx)tst-array1-static.out): Likewise.
> ($(objpfx)tst-array2.out): Likewise.
> ($(objpfx)tst-array3.out): Likewise.
> ($(objpfx)tst-array4.out): Likewise.
> ($(objpfx)tst-array5.out): Likewise.
> ($(objpfx)tst-array5-static.out): Likewise.
> (tst-stackguard1-ARGS): Replace $(built-program-cmd) with
> $(test-program-cmd).
> * grp/Makefile ($(objpfx)tst_fgetgrent.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * grp/tst_fgetgrent.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * iconvdata/Makefile ($(objpfx)tst-tables.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * iconvdata/tst-table.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * iconvdata/tst-tables.sh: Likewise.
> * intl/Makefile ($(objpfx)tst-gettext.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> ($(objpfx)tst-translit.out): Likewise.
> ($(objpfx)tst-gettext2.out): Likewise.
> ($(objpfx)tst-gettext4.out): Likewise.
> ($(objpfx)tst-gettext6.out): Likewise.
> * intl/tst-gettext.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * intl/tst-gettext2.sh: Likewise.
> * intl/tst-gettext4.sh Likewise.
> * intl/tst-gettext6.sh: Likewise.
> * intl/tst-translit.sh: Likewise.
> * io/Makefile ($(objpfx)ftwtest.out): Replace $(run-program-cmd)
> with $(test-program-cmd).
> * libio/Makefile ($(objpfx)test-freopen.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * libio/test-freopen.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * localedata/Makefile ($(objpfx)sort-test.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> ($(objpfx)tst-numeric.out): Likewise.
> ($(objpfx)tst-mbswcs.out): Likewise.
> ($(objpfx)tst-fmon.out): Add $(test-program-prefix).
> ($(objpfx)tst-trans.out): Likewise.
> ($(objpfx)tst-rpmatch.out): Replace $(built-program-cmd) with
> $(test-program-cmd).
> ($(objpfx)tst-ctype.out): Likewise.
> ($(objpfx)tst-wctype.out): Likewise.
> ($(objpfx)tst-langinfo.out): Likewise.
> * localedata/bug-setlocale1.c (do_test): Don't call execve with
> ld.so.
> * localedata/sort-test.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * localedata/tst-mbswcs.sh: Likewise.
> * localedata/tst-numeric.sh: Likewise.
> * localedata/tst-wctype.sh: Likewise.
> * localedata/tst-fmon.sh (test_program_prefix): New. Replace
> ${run_program_prefix} with ${test_program_prefix} when running.
> tst-fmon.
> * localedata/tst-trans.sh: (test_program_prefix): New. Replace
> ${run_program_prefix} with ${test_program_prefix} when running
> tst-trans.
> * malloc/Makefile ($(objpfx)tst-mtrace.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * malloc/tst-mtrace.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * posix/Makefile (tests-static): New.
> (tests): Add $(tests-static).
> ($(objpfx)globtest.out): Replace $(run-via-rtld-prefix) and
> $(test-wrapper) with $(test-program-prefix) and
> $(test-via-rtld-prefix).
> ($(objpfx)wordexp-tst.out): Replace $(run-program-prefix) with
> $(test-program-prefix).
> (tst-exec-ARGS): Replace $(host-built-program-cmd) with
> $(host-test-program-cmd).
> (tst-spawn-ARGS): Likewise.
> (tst-exec-static-ARGS): New.
> (tst-spawn-static-ARGS): Likewise.
> ($(objpfx)tst-rxspencer-mem): Replace $(run-program-prefix) with
> $(test-program-prefix).
> * posix/globtest.sh (un_via_rtld_prefix): Renamed to ...
> (test_via_rtld_prefix): This.
> (test_wrapper): Renamed to ...
> (test_program_prefix): This.
> (run_program_prefix): Replaced by test_program_prefix.
> * posix/tst-exec-static.c: New file.
> * posix/tst-spawn-static.c: Likewise.
> * posix/tst-exec.c: Support run directly.
> * posix/tst-spawn.c: Likewise.
> * posix/wordexp-tst.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * rt/Makefile (tst-mqueue7-ARGS): Replace $(host-built-program-cmd)
> with $(host-test-program-cmd).
> * stdio-common/Makefile ($(objpfx)tst-unbputc.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> ($(objpfx)tst-printf.out): Likewise.
> ($(objpfx)tst-setvbuf1.out): Replace $(built-program-cmd) with
> $(test-program-cmd).
> * stdio-common/tst-printf.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * stdio-common/tst-unbputc.sh: Likewise.
> * stdlib/Makefile ($(objpfx)tst-fmtmsg.out): Replace
> $(run-program-prefix) with $(test-program-prefix).
> * stdlib/tst-fmtmsg.sh (run_program_prefix): Renamed to ...
> (test_program_prefix): This.
> * string/Makefile ($(objpfx)tst-svc.out): Replace
> $(built-program-cmd) with $(test-program-cmd).
>
> nptl/
>
> 2012-12-08 H.J. Lu <hongjiu.lu@intel.com>
>
> * Makefile (tst-cancel7-ARGS: Replace $(host-built-program-cmd)
> with $(host-test-program-cmd).
> (tst-exec4-ARGS): Likewise.
> (tst-stackguard1-ARGS): Likewise.
> ($(objpfx)tst-tls6.out): Don't pass $(elf-objpfx) to tst-tls6.sh.
> Replace $(rtld-installed-name) with $(test-via-rtld-prefix).
> * tst-tls6.sh (elf_objpfx): Removed.
> (rtld_installed_name): Renamed to ...
> (test_via_rtld_prefix): This.
> (tst_tls5): Prepend ${test_via_rtld_prefix}.
Reviewed. Looks OK for 2.18. I like the new options.
Honestly, I wish we had a kernel KConfig interface to all of our
options. That way we could have associated help while we configure all
knobs :-)
The duplicate code in some of the tests is a bit ugly e.g. when you have
to switch based on the number of arguments, but I don't see an easy way
to make that less ugly and it's just a test.
In summary: Please finish up the bike-shed about the name of the option
and I think you're ready (barring any other reviews).
Cheers,
Carlos.
More information about the Libc-alpha
mailing list