diff options
author | jimb <jimb@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2007-02-06 00:34:17 +0000 |
---|---|---|
committer | jimb <jimb@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2007-02-06 00:34:17 +0000 |
commit | 7b429583feca5de495025499509b1ae21ac21ad1 (patch) | |
tree | d7171eb01a658e014cf367b1dc9947342390a9fa /libc | |
parent | fbeabbdc554f256444af02146bec6b76541c75a8 (diff) | |
download | eglibc2-7b429583feca5de495025499509b1ae21ac21ad1.tar.gz |
Add support for cross-testing.
Remove Make conditionals that disable running tests or generating
test input files when cross-compiling.
* Rules: Disable conditionals.
* stdlib/Makefile: Same.
* libio/Makefile: Same.
* intl/Makefile: Same.
* iconvdata/Makefile: Same.
* localedata/Makefile: Same.
* catgets/Makefile: Same.
* misc/Makefile: Same.
* posix/Makefile: Same.
* string/Makefile: Same.
* stdio-common/Makefile: Same.
* resolv/Makefile: Same.
* iconv/Makefile: Same.
* grp/Makefile: Same.
* elf/Makefile: Same.
* malloc/Makefile: Same.
* io/Makefile: Same.
Where tests run binaries, have them use cross-test-wrapper, if
set.
* Makeconfig (run-program-prefix): Split this into two pieces:
(run-via-rtld-prefix): Prefix to run something via the dynamic linker.
(run-program-prefix): Prefix to run something via the
cross-testing wrapper and the dynamic linker.
(built-program-command): Run the rule's second dependency, using the
cross-test-wrapper and dynamic linker.
(local-built-program-cmd): Like built-program-command, but don't
use cross-test-wrapper.
* intl/Makefile: Pass cross-test-wrapper to scripts.
* intl/tst-codeset.sh, intl/tst-gettext.sh, intl/tst-gettext2.sh:
* intl/tst-gettext3.sh, intl/tst-translit.sh: Expect and use wrapper.
* iconvdata/Makefile: Pass cross-test-wrapper to scripts.
* iconvdata/run-iconv-test.sh, iconvdata/tst-table.sh:
* iconvdata/tst-tables.sh: Expect and use wrapper.
* posix/Makefile: Pass cross-test-wrapper to scripts. Pass
local-built-program-command to tests which run subprograms.
* posix/tst-getconf.sh, posix/globtest.sh:
* posix/workexp-tst.sh: Expect and use wrapper.
* grp/Makefile: Pass cross-test-wrapper to scripts.
* grp/tst-fgetgrent.sh: Expect and use wrapper.
* elf/Makefile: Pass cross-test-wrapper to scripts. Use
cross-test-wrapper to run binaries. Pass
local-built-program-command to tests which run subprograms.
* elf/tst-pathopt.sh: Expect and use wrapper.
* malloc/Makefile: Pass cross-test-wrapper to scripts.
* malloc/tst-mtrace.sh: Expect and use wrapper.
* io/Makefile: Pass cross-test-wrapper to scripts.
* io/ftwtest-sh: Expect and use wrapper.
* nptl/Makefile: Pass cross-test-wrapper to scripts. Pass
local-built-program-command to tests which run subprograms.
* nptl/tst-tls6.sh: Expect and use wrapper.
* rt/makefile (tst-mqueue7-ARGS): Pass local-built-program-command.
Make sure cross-testing wrappers don't steal input from test
script loops.
* iconvdata/run-iconv-test.sh: Use non-stdin file descriptor for
while loop input.
* iconvdata/tst-tables.sh: Redirect loop body input from /dev/null.
* localedata/tst-rpmatch.sh, localedata/tst-fmon.sh: Same.
* localedata/tst-numeric.sh: Same.
* posix/tst-getconf.sh: Same.
* localedata/tst-wctype.sh: Take the command to run as an
argument, as passed by the Makefile, not run_program_prefix.
* io/Makefile ($(objpfx)/ftwtest.out): If cross-testing, use build
tree for temporary directory.
* localedata/Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use
cross-localedef program, if specified.
* scripts/cross-test-ssh.sh: New file: sample cross-test wrapper.
git-svn-id: svn://svn.eglibc.org/trunk@1386 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
42 files changed, 449 insertions, 151 deletions
diff --git a/libc/ChangeLog.eglibc b/libc/ChangeLog.eglibc index 0eeaccd48..39bddd675 100644 --- a/libc/ChangeLog.eglibc +++ b/libc/ChangeLog.eglibc @@ -1,3 +1,83 @@ +2007-02-05 Jim Blandy <jimb@codesourcery.com> + + Add support for cross-testing. + + Remove Make conditionals that disable running tests or generating + test input files when cross-compiling. + * Rules: Disable conditionals. + * stdlib/Makefile: Same. + * libio/Makefile: Same. + * intl/Makefile: Same. + * iconvdata/Makefile: Same. + * localedata/Makefile: Same. + * catgets/Makefile: Same. + * misc/Makefile: Same. + * posix/Makefile: Same. + * string/Makefile: Same. + * stdio-common/Makefile: Same. + * resolv/Makefile: Same. + * iconv/Makefile: Same. + * grp/Makefile: Same. + * elf/Makefile: Same. + * malloc/Makefile: Same. + * io/Makefile: Same. + + Where tests run binaries, have them use cross-test-wrapper, if + set. + * Makeconfig (run-program-prefix): Split this into two pieces: + (run-via-rtld-prefix): Prefix to run something via the dynamic linker. + (run-program-prefix): Prefix to run something via the + cross-testing wrapper and the dynamic linker. + (built-program-command): Run the rule's second dependency, using the + cross-test-wrapper and dynamic linker. + (local-built-program-cmd): Like built-program-command, but don't + use cross-test-wrapper. + * intl/Makefile: Pass cross-test-wrapper to scripts. + * intl/tst-codeset.sh, intl/tst-gettext.sh, intl/tst-gettext2.sh: + * intl/tst-gettext3.sh, intl/tst-translit.sh: Expect and use wrapper. + * iconvdata/Makefile: Pass cross-test-wrapper to scripts. + * iconvdata/run-iconv-test.sh, iconvdata/tst-table.sh: + * iconvdata/tst-tables.sh: Expect and use wrapper. + * posix/Makefile: Pass cross-test-wrapper to scripts. Pass + local-built-program-command to tests which run subprograms. + * posix/tst-getconf.sh, posix/globtest.sh: + * posix/workexp-tst.sh: Expect and use wrapper. + * grp/Makefile: Pass cross-test-wrapper to scripts. + * grp/tst-fgetgrent.sh: Expect and use wrapper. + * elf/Makefile: Pass cross-test-wrapper to scripts. Use + cross-test-wrapper to run binaries. Pass + local-built-program-command to tests which run subprograms. + * elf/tst-pathopt.sh: Expect and use wrapper. + * malloc/Makefile: Pass cross-test-wrapper to scripts. + * malloc/tst-mtrace.sh: Expect and use wrapper. + * io/Makefile: Pass cross-test-wrapper to scripts. + * io/ftwtest-sh: Expect and use wrapper. + * nptl/Makefile: Pass cross-test-wrapper to scripts. Pass + local-built-program-command to tests which run subprograms. + * nptl/tst-tls6.sh: Expect and use wrapper. + * rt/makefile (tst-mqueue7-ARGS): Pass local-built-program-command. + + Make sure cross-testing wrappers don't steal input from test + script loops. + + * iconvdata/run-iconv-test.sh: Use non-stdin file descriptor for + while loop input. + * iconvdata/tst-tables.sh: Redirect loop body input from /dev/null. + * localedata/tst-rpmatch.sh, localedata/tst-fmon.sh: Same. + * localedata/tst-numeric.sh: Same. + * posix/tst-getconf.sh: Same. + + * localedata/tst-wctype.sh: Take the command to run as an + argument, as passed by the Makefile, not run_program_prefix. + + * io/Makefile ($(objpfx)/ftwtest.out): If cross-testing, use build + tree for temporary directory. + + * localedata/Makefile ($(addprefix $(objpfx),$(CTYPE_FILES))): Use + cross-localedef program, if specified. + + * scripts/cross-test-ssh.sh: New file: sample cross-test wrapper. + 2007-02-02 Jim Blandy <jimb@codesourcery.com> Use the host nm in NPTL tests. diff --git a/libc/Makeconfig b/libc/Makeconfig index 349f94d9a..4683b8593 100644 --- a/libc/Makeconfig +++ b/libc/Makeconfig @@ -551,17 +551,23 @@ sysdep-library-path = \ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\ $(filter -Wl$(comma)-rpath-link=%,\ $(sysdep-LDFLAGS))))) -run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\ - $(tests-static) $(xtests-static)),, \ - $(elf-objpfx)$(rtld-installed-name) \ - --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))) +# Never use $(run-via-rtld-prefix) for the statically-linked %-bp test +# programs, or for tests listed in tests-static or xtests-static. +run-via-rtld-prefix = \ + $(if $(strip $(filter $(notdir $(built-program-file)), \ + $(tests-static) $(xtests-static)) \ + $(filter %-bp,$(built-program-file))),, \ + $(elf-objpfx)$(rtld-installed-name) \ + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))) else -run-program-prefix = +run-via-rtld-prefix = endif -# Never use $(run-program-prefix) for the statically-linked %-bp test programs -built-program-cmd = $(patsubst %,$(run-program-prefix),\ - $(filter-out %-bp,$(built-program-file))) \ - $(built-program-file) +run-program-prefix = $(cross-test-wrapper) $(run-via-rtld-prefix) +built-program-cmd = $(cross-test-wrapper) $(run-via-rtld-prefix) $(built-program-file) + +# Same as built-program-cmd, but without the cross-test-wrapper. Used +# to run programs from the test machine, as in nptl/tst-cancel7. +local-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file) ifndef LD LD := ld -X diff --git a/libc/Rules b/libc/Rules index 5ace24cee..434b8a230 100644 --- a/libc/Rules +++ b/libc/Rules @@ -91,17 +91,17 @@ others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs)) else others: $(addprefix $(objpfx),$(extra-objs)) endif -ifeq ($(cross-compiling),yes) -tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) -xtests: tests -else +# eglibc: ifeq ($(cross-compiling),yes) +# eglibc: tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) +# eglibc: xtests: tests +# eglibc: else ifeq ($(build-bounded),yes) tests-bp.out = $(tests:%=$(objpfx)%-bp.out) xtests-bp.out = $(xtests:%=$(objpfx)%-bp.out) endif tests: $(tests:%=$(objpfx)%.out) $(tests-bp.out) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-bp.out) -endif +# eglibc: endif ifeq ($(build-programs),yes) binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs) diff --git a/libc/catgets/Makefile b/libc/catgets/Makefile index 660bed136..10c6303a4 100644 --- a/libc/catgets/Makefile +++ b/libc/catgets/Makefile @@ -55,7 +55,7 @@ generated-dirs = de tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de -ifneq ($(cross-compiling),yes) +# eglibc: ifneq ($(cross-compiling),yes) tests: $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \ $(objpfx)test-gencat.out # This test just checks whether the program produces any error or not. @@ -85,4 +85,4 @@ $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \ $(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \ $(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@ -endif +# eglibc: endif diff --git a/libc/elf/Makefile b/libc/elf/Makefile index afebaec1e..cd3b26c23 100644 --- a/libc/elf/Makefile +++ b/libc/elf/Makefile @@ -395,9 +395,9 @@ test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names)))) generated += $(addsuffix .so,$(strip $(modules-names))) ifeq (yes,$(build-shared)) -ifeq ($(cross-compiling),no) +# eglibc: ifeq ($(cross-compiling),no) tests: $(objpfx)tst-pathopt.out -endif +# eglibc: endif endif $(objpfx)testobj1.so: $(libdl) @@ -575,6 +575,7 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so) $(objpfx)order.out: $(objpfx)order + $(cross-test-wrapper) \ $(elf-objpfx)$(rtld-installed-name) \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ $(objpfx)order > $@ @@ -636,7 +637,7 @@ $(objpfx)lateglobal.out: $(objpfx)ltglobmod1.so $(objpfx)ltglobmod2.so $(objpfx)tst-pathopt: $(libdl) $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \ $(objpfx)pathoptobj.so - $(SHELL) -e $< $(common-objpfx) + $(SHELL) -e $< $(common-objpfx) "$(cross-test-wrapper)" $(objpfx)initfirst: $(libdl) $(objpfx)initfirst.out: $(objpfx)firstobj.so @@ -798,6 +799,7 @@ ifeq (yesyes,$(have-fpie)$(build-shared)) CFLAGS-tst-pie1.c += -fpie $(objpfx)tst-pie1.out: $(objpfx)tst-pie1 + $(cross-test-wrapper) \ $(elf-objpfx)$(rtld-installed-name) \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ $< > $@ @@ -893,6 +895,7 @@ $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so $(objpfx)order2: $(libdl) $(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \ $(objpfx)order2mod2.so + $(cross-test-wrapper) \ $(elf-objpfx)$(rtld-installed-name) \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ $(objpfx)order2 > $@ @@ -902,7 +905,7 @@ $(objpfx)order2mod4.so: $(objpfx)order2mod3.so $(objpfx)order2mod2.so: $(objpfx)order2mod3.so order2mod2.so-no-z-defs = yes -tst-stackguard1-ARGS = --command "$(built-program-cmd) --child" +tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child" tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child" $(objpfx)tst-leaks1: $(libdl) diff --git a/libc/elf/tst-pathopt.sh b/libc/elf/tst-pathopt.sh index 0fe504e1a..c52ec264e 100755 --- a/libc/elf/tst-pathopt.sh +++ b/libc/elf/tst-pathopt.sh @@ -20,7 +20,7 @@ # 02111-1307 USA. common_objpfx=$1 -run_program_prefix=$2 +cross_test_wrapper="$2" test -e ${common_objpfx}elf/will-be-empty && rm -fr ${common_objpfx}elf/will-be-empty @@ -31,7 +31,8 @@ cp ${common_objpfx}elf/pathoptobj.so ${common_objpfx}elf/for-renamed/renamed.so LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \ LC_ALL=C LD_LIBRARY_PATH=${common_objpfx}elf/will-be-empty:${common_objpfx}elf/for-renamed:${common_objpfx}.:${common_objpfx}dlfcn \ - ${common_objpfx}elf/ld.so ${common_objpfx}elf/tst-pathopt \ + ${cross_test_wrapper} ${common_objpfx}elf/ld.so \ + ${common_objpfx}elf/tst-pathopt \ > ${common_objpfx}elf/tst-pathopt.out exit $? diff --git a/libc/grp/Makefile b/libc/grp/Makefile index e6ca864a4..1bdf28a87 100644 --- a/libc/grp/Makefile +++ b/libc/grp/Makefile @@ -59,13 +59,13 @@ CFLAGS-getgrgid.c = -fexceptions endif -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) # tst_fgetgrent currently only works with shared libraries ifeq (yes,$(build-shared)) tests: $(objpfx)tst_fgetgrent.out $(objpfx)tst_fgetgrent.out: tst_fgetgrent.sh $(objpfx)tst_fgetgrent $(SHELL) -e tst_fgetgrent.sh $(common-objpfx) $(elf-objpfx) \ - $(rtld-installed-name) + $(rtld-installed-name) "$(cross-test-wrapper)" endif -endif +# eglibc: endif diff --git a/libc/grp/tst_fgetgrent.sh b/libc/grp/tst_fgetgrent.sh index 4f7f46021..18bdc1c20 100644 --- a/libc/grp/tst_fgetgrent.sh +++ b/libc/grp/tst_fgetgrent.sh @@ -22,21 +22,26 @@ common_objpfx=$1; shift elf_objpfx=$1; shift rtld_installed_name=$1; shift +cross_test_wrapper="$1"; shift testout=${common_objpfx}/grp/tst_fgetgrent.out library_path=${common_objpfx} result=0 +${cross_test_wrapper} \ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ ${common_objpfx}grp/tst_fgetgrent 0 > ${testout} || result=1 +${cross_test_wrapper} \ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ ${common_objpfx}grp/tst_fgetgrent 1 >> ${testout} || result=1 +${cross_test_wrapper} \ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ ${common_objpfx}grp/tst_fgetgrent 2 >> ${testout} || result=1 +${cross_test_wrapper} \ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ ${common_objpfx}grp/tst_fgetgrent 3 >> ${testout} || result=1 diff --git a/libc/iconv/Makefile b/libc/iconv/Makefile index 40c7cbcdd..f2a81253b 100644 --- a/libc/iconv/Makefile +++ b/libc/iconv/Makefile @@ -79,9 +79,9 @@ $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force) $(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o) $(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o) -ifneq ($(cross-compiling),yes) +# eglibc: ifneq ($(cross-compiling),yes) xtests: test-iconvconfig -endif +# eglibc: endif .PHONY: test-iconvconfig test-iconvconfig: /dev/null $(objpfx)iconvconfig diff --git a/libc/iconvdata/Makefile b/libc/iconvdata/Makefile index 8b49367bd..6a4975996 100644 --- a/libc/iconvdata/Makefile +++ b/libc/iconvdata/Makefile @@ -317,7 +317,7 @@ $(addprefix $(inst_gconvdir)/, $(modules.so)): \ $(do-install-program) $(inst_gconvdir)/gconv-modules: gconv-modules $(+force) $(do-install) -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary # if this libc has more gconv modules than the previously installed one. if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \ @@ -326,22 +326,22 @@ ifeq (no,$(cross-compiling)) $(common-objpfx)iconv/iconvconfig \ $(addprefix --prefix=,$(install_root)); \ fi -else - @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache' -endif +# eglibc: else +# eglibc: @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache' +# eglibc: endif endif # build-shared = yes include ../Rules -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) tests: $(objpfx)iconv-test.out $(objpfx)tst-tables.out ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-loading endif endif -endif +# eglibc: endif tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace $(objpfx)mtrace-tst-loading: $(objpfx)tst-loading.out @@ -362,12 +362,13 @@ $(objpfx)tst-iconv4.out: $(objpfx)gconv-modules \ $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \ $(addprefix $(objpfx),$(modules.so)) \ $(common-objdir)/iconv/iconv_prog TESTS - $(SHELL) -e $< $(common-objdir) > $@ + $(SHELL) -e $< $(common-objdir) '$(cross-test-wrapper)' > $@ $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \ $(addprefix $(objpfx),$(modules.so)) \ $(objpfx)tst-table-from $(objpfx)tst-table-to - $(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ > $@ + $(SHELL) $< $(common-objpfx) $(common-objpfx)iconvdata/ \ + '$(cross-test-wrapper)' > $@ do-tests-clean common-mostlyclean: tst-tables-clean diff --git a/libc/iconvdata/run-iconv-test.sh b/libc/iconvdata/run-iconv-test.sh index 5f6339d2c..d2361c314 100755 --- a/libc/iconvdata/run-iconv-test.sh +++ b/libc/iconvdata/run-iconv-test.sh @@ -21,6 +21,7 @@ # 02111-1307 USA. codir=$1 +cross_test_wrapper="$2" # We use always the same temporary file. temp1=$codir/iconvdata/iconv-test.xxx @@ -39,6 +40,7 @@ LIBPATH=$codir:$codir/iconvdata # How the start the iconv(1) program. ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \ $codir/iconv/iconv_prog' +ICONV="$cross_test_wrapper $ICONV" # Which echo? if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then @@ -49,8 +51,13 @@ fi # We read the file named TESTS. All non-empty lines not starting with # `#' are interpreted as commands. +# Avoid reading from stdin, since the while loop's body inherits that; +# if cross_test_wrapper is a program like ssh that reads its input +# even if the program running on the remote side doesn't, it will +# steal input from the loop. failed=0 -while read from to subset targets; do +exec 5< TESTS +while read from to subset targets <&5; do # Ignore empty and comment lines. if test -z "$subset" || test "$from" = '#'; then continue; fi @@ -141,11 +148,18 @@ while read from to subset targets; do { echo "/FAILED"; failed=1; continue; } echo "/OK" fi -done < TESTS +done +# Close TESTS. +exec 5<&- # We read the file named TESTS2. All non-empty lines not starting with # `#' are interpreted as commands. -while read utf8 from filename; do +# Avoid reading from stdin, since the while loop's body inherits that; +# if cross_test_wrapper is a program like ssh that reads its input +# even if the program running on the remote side doesn't, it will +# steal input from the loop. +exec 5< TESTS2 +while read utf8 from filename <&5; do # Ignore empty and comment lines. if test -z "$filename" || test "$utf8" = '#'; then continue; fi @@ -184,7 +198,8 @@ while read utf8 from filename; do { echo "/FAILED"; failed=1; continue; } echo "OK" -done < TESTS2 +done +exec 5<&- exit $failed # Local Variables: diff --git a/libc/iconvdata/tst-table.sh b/libc/iconvdata/tst-table.sh index 1de711486..6a7612c58 100755 --- a/libc/iconvdata/tst-table.sh +++ b/libc/iconvdata/tst-table.sh @@ -24,8 +24,9 @@ common_objpfx=$1 objpfx=$2 -charset=$3 -charmap=$4 +cross_test_wrapper="$3" +charset=$4 +charmap=$5 GCONV_PATH=${common_objpfx}iconvdata export GCONV_PATH @@ -60,12 +61,12 @@ else fi # iconv in one direction. -${common_objpfx}elf/ld.so --library-path $common_objpfx \ +${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-table-from ${charset} \ > ${objpfx}tst-${charset}.table # iconv in the other direction. -${common_objpfx}elf/ld.so --library-path $common_objpfx \ +${cross_test_wrapper} ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-table-to ${charset} | sort \ > ${objpfx}tst-${charset}.inverse.table diff --git a/libc/iconvdata/tst-tables.sh b/libc/iconvdata/tst-tables.sh index be1e8832a..257dd7284 100755 --- a/libc/iconvdata/tst-tables.sh +++ b/libc/iconvdata/tst-tables.sh @@ -24,6 +24,7 @@ common_objpfx=$1 objpfx=$2 +cross_test_wrapper="$3" status=0 @@ -250,7 +251,10 @@ while read charset charmap; do if test "$charset" = GB18030; then echo "This might take a while" 1>&2; fi case ${charset} in \#*) continue;; esac echo -n "Testing ${charset}" 1>&2 - if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} ${charset} ${charmap}; then + # Redirect input from /dev/null, so that using ssh (which reads its + # input before the remote program needs it) won't consume the rest of the + # charset/charmap table, making the while loop terminate early. + if ${SHELL} tst-table.sh ${common_objpfx} ${objpfx} "${cross_test_wrapper}" ${charset} ${charmap} < /dev/null; then echo 1>&2 else echo "failed: ./tst-table.sh ${common_objpfx} ${objpfx} ${charset} ${charmap}" diff --git a/libc/intl/Makefile b/libc/intl/Makefile index 9da445aa3..dd66f1815 100644 --- a/libc/intl/Makefile +++ b/libc/intl/Makefile @@ -61,7 +61,7 @@ $(objpfx)plural.o: plural.c include ../Rules -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) ifneq ($(strip $(MSGFMT)),:) tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \ @@ -77,21 +77,25 @@ $(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out $(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@ $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ - $(objpfx)tst-gettext.mtrace + $(objpfx)tst-gettext.mtrace '$(cross-test-wrapper)' $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit - $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ + '$(cross-test-wrapper)' $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2 - $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ + '$(cross-test-wrapper)' $(objpfx)tst-codeset.out: tst-codeset.sh $(objpfx)tst-codeset - $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ + '$(cross-test-wrapper)' $(objpfx)tst-gettext3.out: tst-gettext3.sh $(objpfx)tst-gettext3 - $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ \ + '$(cross-test-wrapper)' $(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/ $(objpfx)tst-gettext5.out: tst-gettext5.sh $(objpfx)tst-gettext5 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/ endif -endif +# eglibc: endif $(objpfx)msgs.h: po2test.sed ../po/de.po $(make-target-directory) diff --git a/libc/intl/tst-codeset.sh b/libc/intl/tst-codeset.sh index 8b052168b..632727829 100644 --- a/libc/intl/tst-codeset.sh +++ b/libc/intl/tst-codeset.sh @@ -21,6 +21,7 @@ common_objpfx=$1 objpfx=$2 +cross_test_wrapper=$3 LC_ALL=C export LC_ALL @@ -37,6 +38,7 @@ export GCONV_PATH LOCPATH=${common_objpfx}localedata export LOCPATH +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-codeset > ${objpfx}tst-codeset.out diff --git a/libc/intl/tst-gettext.sh b/libc/intl/tst-gettext.sh index 9d4375bf8..6cbf1c3db 100755 --- a/libc/intl/tst-gettext.sh +++ b/libc/intl/tst-gettext.sh @@ -22,6 +22,7 @@ common_objpfx=$1 objpfx=$2 malloc_trace=$3 +cross_test_wrapper=$4 LC_ALL=C export LC_ALL @@ -53,6 +54,7 @@ export LOCPATH # Now run the test. MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \ +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir diff --git a/libc/intl/tst-gettext2.sh b/libc/intl/tst-gettext2.sh index 68157f8a6..f4526449d 100644 --- a/libc/intl/tst-gettext2.sh +++ b/libc/intl/tst-gettext2.sh @@ -21,6 +21,7 @@ common_objpfx=$1 objpfx=$2 +cross_test_wrapper=$3 LC_ALL=C export LC_ALL @@ -66,6 +67,7 @@ LOCPATH=${objpfx}domaindir export LOCPATH # Now run the test. +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir && cmp ${objpfx}tst-gettext2.out - <<EOF diff --git a/libc/intl/tst-gettext3.sh b/libc/intl/tst-gettext3.sh index 185576886..275479a08 100644 --- a/libc/intl/tst-gettext3.sh +++ b/libc/intl/tst-gettext3.sh @@ -22,6 +22,7 @@ common_objpfx=$1 objpfx=$2 +cross_test_wrapper=$3 LC_ALL=C export LC_ALL @@ -38,6 +39,7 @@ export GCONV_PATH LOCPATH=${common_objpfx}localedata export LOCPATH +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-gettext3 > ${objpfx}tst-gettext3.out diff --git a/libc/intl/tst-translit.sh b/libc/intl/tst-translit.sh index 22826e996..19e9c5df6 100755 --- a/libc/intl/tst-translit.sh +++ b/libc/intl/tst-translit.sh @@ -21,6 +21,7 @@ common_objpfx=$1 objpfx=$2 +cross_test_wrapper=$3 LC_ALL=C export LC_ALL @@ -36,6 +37,7 @@ export GCONV_PATH LOCPATH=${common_objpfx}localedata export LOCPATH +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir diff --git a/libc/io/Makefile b/libc/io/Makefile index 18287b201..011a1c999 100644 --- a/libc/io/Makefile +++ b/libc/io/Makefile @@ -94,10 +94,20 @@ test-stat2-ARGS = Makefile . $(objpfx)test-stat2 tst-statvfs-ARGS = $(objpfx)tst-statvfs tst-statvfs.c /tmp -ifeq ($(cross-compiling),no) +# eglibc: ifeq ($(cross-compiling),no) tests: $(objpfx)ftwtest.out +ifeq ($(cross-compiling),yes) +# EGLIBC's cross-testing support does not require the build and host +# machines to share a /tmp directory, so when cross-testing, construct +# the sample directory tree for these tests in the build tree. +ftwtest-tmpdir = TMPDIR=$(common-objpfx) +endif + $(objpfx)ftwtest.out: $(objpfx)ftwtest + $(ftwtest-tmpdir) \ $(SHELL) -e ftwtest-sh $(shell cd $(common-objpfx). && pwd)/ \ + '$(cross-test-wrapper)' \ $(shell cd $(<D) && pwd)/$(<F) > $@ -endif + +# eglibc: endif diff --git a/libc/io/ftwtest-sh b/libc/io/ftwtest-sh index 6444ece2a..275dd7601 100644 --- a/libc/io/ftwtest-sh +++ b/libc/io/ftwtest-sh @@ -3,6 +3,9 @@ # The common objpfx, used to find libraries and the dynamic loader. objpfx=$1 +# The cross-testing wrapper. +cross_test_wrapper="$2" + # We expect one parameter which is the test program. This must understand # a number options: # --phys use the FTW_PHYS flag @@ -11,7 +14,7 @@ objpfx=$1 # --depth use the FTW_DEPTH flag # --early-exit print file@2 item only and return non-zero from the # callback when it is seen -testprogram=$2 +testprogram=$3 # We cannot test this as root. if test `id | sed "s/uid=\([0-9]*\).*/\1/"` = 0; then @@ -29,6 +32,7 @@ tmp=`echo ${TMPDIR:-/tmp} | sed 's|\(.\)/*$|\1|'` tmpdir=$tmp/ftwtest.d [ -f ${objpfx}elf/ld.so ] && ldso=${objpfx}elf/ld.so +ldso="${cross_test_wrapper:+$cross_test_wrapper }$ldso" trap 'chmod -fR a+x $tmpdir; rm -fr $tmpdir $testout' 1 2 3 15 diff --git a/libc/libio/Makefile b/libc/libio/Makefile index 553fbda74..b0d59bbe8 100644 --- a/libc/libio/Makefile +++ b/libc/libio/Makefile @@ -172,9 +172,9 @@ distribute := iolibio.h libioP.h strfile.h Banner test-freopen.sh \ include ../Rules -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) tests: $(objpfx)test-freopen.out $(objpfx)tst-fopenloc.check -endif +# eglibc: endif $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' \ diff --git a/libc/localedata/Makefile b/libc/localedata/Makefile index adc076d04..f6733160a 100644 --- a/libc/localedata/Makefile +++ b/libc/localedata/Makefile @@ -86,7 +86,7 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog \ # Get $(inst_i18ndir) defined. include ../Makeconfig -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ tst_iswctype tst_iswdigit tst_iswgraph \ tst_iswlower tst_iswprint tst_iswpunct \ @@ -110,7 +110,7 @@ ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-leaks endif endif -endif +# eglibc: endif # Files to install. install-others := $(addprefix $(inst_i18ndir)/, \ @@ -138,7 +138,7 @@ CFLAGS-tst-mbswcs5.c = -Wno-format CFLAGS-tst-trans.c = -Wno-format -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) # We have to generate locales LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \ @@ -157,7 +157,11 @@ generated-dirs += $(LOCALES) $(addprefix $(objpfx),$(CTYPE_FILES)): %: \ gen-locale.sh $(common-objpfx)locale/localedef Makefile \ $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS)) - @$(SHELL) -e gen-locale.sh $(common-objpfx) '$(built-program-cmd)' $@ + @$(SHELL) -e gen-locale.sh $(common-objpfx) \ + '$(if $(cross-localedef), \ + $(cross-localedef), \ + $(built-program-cmd))' \ + $@ $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \ $(addprefix $(objpfx),$(CTYPE_FILES)) @@ -210,7 +214,7 @@ $(objpfx)tst-langinfo.out: tst-langinfo.sh $(objpfx)tst-langinfo \ $(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)' $(objpfx)tst-digits.out: $(objpfx)tst-locale.out $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES)) -endif +# eglibc: endif include SUPPORTED diff --git a/libc/localedata/tst-fmon.sh b/libc/localedata/tst-fmon.sh index d2bd60828..ff250f36d 100755 --- a/libc/localedata/tst-fmon.sh +++ b/libc/localedata/tst-fmon.sh @@ -32,10 +32,13 @@ lang=`sed -e '/^#/d' -e '/^$/d' -e '/^C /d' -e '/^tstfmon/d' -e 's/^\([^ ]*\).*/ for cns in `cd ./tst-fmon-locales && ls tstfmon_*`; do cn=tst-fmon-locales/$cns fn=charmaps/ISO-8859-1 + # If run_program_prefix includes a cross-testing wrapper based on a + # program like ssh, it may steal input from the while loop, so + # redirect its stdin from /dev/null. I18NPATH=. GCONV_PATH=${common_objpfx}iconvdata \ LOCPATH=${common_objpfx}localedata LC_ALL=C LANGUAGE=C \ ${run_program_prefix} ${common_objpfx}locale/localedef \ - --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns + --quiet -i $cn -f $fn ${common_objpfx}localedata/$cns < /dev/null done # Run the tests. @@ -45,10 +48,13 @@ while IFS=" " read locale format value expect; do case "$locale" in '#'*) continue ;; esac if [ -n "$format" ]; then expect=`echo "$expect" | sed 's/^\"\(.*\)\"$/\1/'` + # If run_program_prefix includes a cross-testing wrapper based on a + # program like ssh, it may steal input from the while loop, so + # redirect its stdin from /dev/null. LOCPATH=${common_objpfx}localedata \ GCONV_PATH=${common_objpfx}/iconvdata \ ${run_program_prefix} ${common_objpfx}localedata/tst-fmon \ - "$locale" "$format" "$value" "$expect" || + "$locale" "$format" "$value" "$expect" < /dev/null || errcode=$? fi done < $datafile diff --git a/libc/localedata/tst-numeric.sh b/libc/localedata/tst-numeric.sh index f27eacd07..4e92fe660 100644 --- a/libc/localedata/tst-numeric.sh +++ b/libc/localedata/tst-numeric.sh @@ -30,10 +30,13 @@ errcode=0 while IFS=" " read locale format value expect; do case "$locale" in '#'*) continue ;; esac if [ -n "$format" ]; then + # If run_program_prefix includes a cross-testing wrapper based + # on a program like ssh, it may steal input from the while + # loop, so redirect its stdin from /dev/null. if LOCPATH=${common_objpfx}localedata \ GCONV_PATH=${common_objpfx}/iconvdata \ ${run_program_prefix} ${common_objpfx}localedata/tst-numeric \ - "$locale" "$format" "$value" "$expect" + "$locale" "$format" "$value" "$expect" < /dev/null then echo "Locale: \"${locale}\" Format: \"${format}\"" \ "Value: \"${value}\" Expect: \"${expect}\" passed" diff --git a/libc/localedata/tst-rpmatch.sh b/libc/localedata/tst-rpmatch.sh index 5900c9454..33fdb3d7b 100755 --- a/libc/localedata/tst-rpmatch.sh +++ b/libc/localedata/tst-rpmatch.sh @@ -25,9 +25,12 @@ tst_rpmatch=$2 rc=0 while IFS=\& read locale string result dummy; do if [ "$locale" != "#" ]; then + # If tst_rpmatch includes a cross-testing wrapper based on a + # program like ssh, it may steal input from the while loop, so + # redirect its stdin from /dev/null. LOCPATH=${common_objpfx}localedata \ GCONV_PATH=${common_objpfx}/iconvdata \ - ${tst_rpmatch} $locale $string $result \ + ${tst_rpmatch} $locale $string $result < /dev/null \ || { echo "$locale $string $result FAILED"; exit 1; } fi done <<EOF diff --git a/libc/localedata/tst-wctype.sh b/libc/localedata/tst-wctype.sh index 77312b68c..8a98bc0c2 100755 --- a/libc/localedata/tst-wctype.sh +++ b/libc/localedata/tst-wctype.sh @@ -20,12 +20,11 @@ # 02111-1307 USA. common_objpfx=$1 -run_program_prefix=$2 +tst_wctype=$2 # Run the test program. LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \ -LC_ALL=ja_JP.EUC-JP ${run_program_prefix} \ - ${common_objpfx}localedata/tst-wctype < tst-wctype.input \ +LC_ALL=ja_JP.EUC-JP ${tst_wctype} < tst-wctype.input \ > ${common_objpfx}localedata/tst-wctype.out exit $? diff --git a/libc/malloc/Makefile b/libc/malloc/Makefile index c39eae547..6df857d4c 100644 --- a/libc/malloc/Makefile +++ b/libc/malloc/Makefile @@ -112,15 +112,15 @@ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o lib: $(objpfx)libmcheck.a -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) ifneq ($(PERL),no) tests: $(objpfx)tst-mtrace.out $(objpfx)tst-mtrace.out: tst-mtrace.sh $(objpfx)tst-mtrace - $(SHELL) -e $< $(common-objpfx) -endif + $(SHELL) -e $< $(common-objpfx) '$(cross-test-wrapper)' endif endif +# eglibc: endif tst-mcheck-ENV = MALLOC_CHECK_=3 diff --git a/libc/malloc/tst-mtrace.sh b/libc/malloc/tst-mtrace.sh index 771689a27..137bfe22c 100755 --- a/libc/malloc/tst-mtrace.sh +++ b/libc/malloc/tst-mtrace.sh @@ -20,12 +20,14 @@ # 02111-1307 USA. common_objpfx=$1; shift +cross_test_wrapper="$1"; shift status=0 trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15 MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \ LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \ +${cross_test_wrapper} \ ${common_objpfx}elf/ld.so --library-path $common_objpfx \ ${common_objpfx}malloc/tst-mtrace || status=1 diff --git a/libc/misc/Makefile b/libc/misc/Makefile index 9eac1b627..bb88b6f3b 100644 --- a/libc/misc/Makefile +++ b/libc/misc/Makefile @@ -79,9 +79,9 @@ gpl2lgpl := error.c error.h tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \ tst-error1 tst-pselect tst-insremque tst-mntent2 -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) tests: $(objpfx)tst-error1-mem -endif +# eglibc: endif CFLAGS-tsearch.c = $(uses-callbacks) CFLAGS-lsearch.c = $(uses-callbacks) diff --git a/libc/nptl/Makefile b/libc/nptl/Makefile index 9100b91b7..0ee45c09b 100644 --- a/libc/nptl/Makefile +++ b/libc/nptl/Makefile @@ -434,7 +434,7 @@ CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<) CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<) CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<) -tst-cancel7-ARGS = --command "$(built-program-cmd)" +tst-cancel7-ARGS = --command "$(local-built-program-cmd)" tst-cancelx7-ARGS = $(tst-cancel7-ARGS) tst-umask1-ARGS = $(objpfx)tst-umask1.temp @@ -470,7 +470,7 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(objpfx)tst-tls5 \ $(objpfx)tst-tls5modc.so $(objpfx)tst-tls5modd.so \ $(objpfx)tst-tls5mode.so $(objpfx)tst-tls5modf.so $(SHELL) -e tst-tls6.sh $(common-objpfx) $(elf-objpfx) \ - $(rtld-installed-name) + $(rtld-installed-name) '$(cross-test-wrapper)' endif $(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library) @@ -604,7 +604,7 @@ $(objpfx)tst-cancel-wrappers.out: tst-cancel-wrappers.sh endif # eglibc: endif -tst-exec4-ARGS = $(built-program-cmd) +tst-exec4-ARGS = $(local-built-program-cmd) $(objpfx)tst-execstack: $(libdl) $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so @@ -612,7 +612,7 @@ LDFLAGS-tst-execstack = -Wl,-z,noexecstack $(objpfx)tst-fini1mod.so: $(shared-thread-library) -tst-stackguard1-ARGS = --command "$(built-program-cmd) --child" +tst-stackguard1-ARGS = --command "$(local-built-program-cmd) --child" tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child" # The tests here better do not run in parallel diff --git a/libc/nptl/tst-tls6.sh b/libc/nptl/tst-tls6.sh index 1ae24fc6f..da1cc510a 100755 --- a/libc/nptl/tst-tls6.sh +++ b/libc/nptl/tst-tls6.sh @@ -3,12 +3,14 @@ common_objpfx=$1; shift elf_objpfx=$1; shift rtld_installed_name=$1; shift +cross_test_wrapper=$1; shift logfile=$common_objpfx/nptl/tst-tls6.out # We have to find libc and nptl library_path=${common_objpfx}:${common_objpfx}nptl tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ ${common_objpfx}/nptl/tst-tls5" +tst_tls5="$cross_test_wrapper $tst_tls5" LC_ALL=C export LC_ALL diff --git a/libc/posix/Makefile b/libc/posix/Makefile index 712e7c206..d82bf34ab 100644 --- a/libc/posix/Makefile +++ b/libc/posix/Makefile @@ -121,18 +121,18 @@ otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \ $(resolvobjdir)/libresolv.a) endif -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) # globtest and wordexp-test currently only works with shared libraries ifeq (yes,$(build-shared)) tests: $(objpfx)globtest.out $(objpfx)wordexp-tst.out $(objpfx)globtest.out: globtest.sh $(objpfx)globtest $(SHELL) -e globtest.sh $(common-objpfx) $(elf-objpfx) \ - $(rtld-installed-name) + $(rtld-installed-name) '$(cross-test-wrapper)' $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test $(SHELL) -e wordexp-tst.sh $(common-objpfx) $(elf-objpfx) \ - $(rtld-installed-name) -endif + $(rtld-installed-name) '$(cross-test-wrapper)' endif +# eglibc: endif CFLAGS-regex.c = -Wno-strict-prototypes CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD @@ -171,8 +171,8 @@ CFLAGS-execlp.os = -fomit-frame-pointer tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \ --none random --col --color --colour -tst-exec-ARGS = -- $(built-program-cmd) -tst-spawn-ARGS = -- $(built-program-cmd) +tst-exec-ARGS = -- $(local-built-program-cmd) +tst-spawn-ARGS = -- $(local-built-program-cmd) tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir); pwd` $(objpfx)tst-dir tst-chmod-ARGS = `pwd` tst-vfork3-ARGS = --test-dir=$(objpfx) @@ -216,13 +216,13 @@ endif # Run a test on the header files we use. # XXX Please note that for now we ignore the result of this test. tests: $(objpfx)annexc.out -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \ $(objpfx)bug-regex21-mem $(objpfx)tst-rxspencer-mem \ $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \ $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem xtests: $(objpfx)bug-ga2-mem -endif +# eglibc: endif $(objpfx)annexc.out: $(objpfx)annexc -$(dir $<)$(notdir $<) '$(CC)' \ @@ -270,7 +270,8 @@ $(objpfx)tst-boost-mem: $(objpfx)tst-boost.out $(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@ $(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf - $(SHELL) -e $< $(common-objpfx) $(elf-objpfx) $(rtld-installed-name) + $(SHELL) -e $< $(common-objpfx) $(elf-objpfx) \ + '$(cross-test-wrapper)' $(rtld-installed-name) ifeq (yes,$(build-shared)) $(objpfx)tst-regex: $(common-objpfx)rt/librt.so diff --git a/libc/posix/globtest.sh b/libc/posix/globtest.sh index 09af6f74f..9c1267f9f 100755 --- a/libc/posix/globtest.sh +++ b/libc/posix/globtest.sh @@ -3,6 +3,7 @@ common_objpfx=$1; shift elf_objpfx=$1; shift rtld_installed_name=$1; shift +cross_test_wrapper=$1; shift logfile=$common_objpfx/posix/globtest.out #CMP=cmp @@ -20,6 +21,9 @@ esac # We have to find the libc and the NSS modules. library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod +run_program_prefix="${cross_test_wrapper} \ +${elf_objpfx}${rtld_installed_name} --library-path ${library_path}" + # Since we use `sort' we must make sure to use the same locale everywhere. LC_ALL=C export LC_ALL @@ -62,7 +66,7 @@ rm -f $logfile # Normal test failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -89,7 +93,7 @@ fi # Don't let glob sort it failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -s "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -116,7 +120,7 @@ fi # Mark directories failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -m "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -143,7 +147,7 @@ fi # Find files starting with . failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -p "$testdir" "*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -173,7 +177,7 @@ fi # Test braces failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -186,7 +190,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -200,7 +204,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" "{" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -213,7 +217,7 @@ fi # Test NOCHECK failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "abc" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -226,7 +230,7 @@ fi # Test NOMAGIC without magic characters failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "abc" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -239,7 +243,7 @@ fi # Test NOMAGIC with magic characters failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "abc*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -252,7 +256,7 @@ fi # Test NOMAGIC for subdirs failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -265,7 +269,7 @@ fi # Test subdirs correctly failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -281,7 +285,7 @@ fi # Test subdirs for invalid names failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -294,7 +298,7 @@ fi # Test subdirs with wildcard failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*1_1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -308,7 +312,7 @@ fi # Test subdirs with ? failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*?_?" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -323,7 +327,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/file1_1" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -336,7 +340,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*-/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -348,7 +352,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*-" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -361,7 +365,7 @@ fi # Test subdirs with ? failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/*?_?" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -377,7 +381,7 @@ fi # Test subdirs with [ .. ] failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -393,7 +397,7 @@ fi # Test ']' inside bracket expression failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -407,7 +411,7 @@ fi # Test tilde expansion failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~" | sort >$testout echo ~ | $CMP - $testout >> $logfile || failed=1 @@ -422,7 +426,7 @@ fi # Test tilde expansion with trailing slash failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~/" | sort > $testout # Some shell incorrectly(?) convert ~/ into // if ~ expands to /. @@ -442,7 +446,7 @@ fi # Test tilde expansion with username failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER | sort > $testout eval echo ~$USER | $CMP - $testout >> $logfile || failed=1 @@ -457,7 +461,7 @@ fi # Tilde expansion shouldn't match a file failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -T "$testdir" "~file4" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -470,7 +474,7 @@ fi # Matching \** should only find *file6 failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "\**" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -484,7 +488,7 @@ fi # ... unless NOESCAPE is used, in which case it should entries with a # leading \. failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -e "$testdir" "\**" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -499,7 +503,7 @@ fi # Matching \*file6 should find *file6 failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "\*file6" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -512,7 +516,7 @@ fi # GLOB_BRACE alone failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -525,7 +529,7 @@ fi # GLOB_BRACE and GLOB_NOESCAPE failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -538,7 +542,7 @@ fi # Escaped comma failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -551,7 +555,7 @@ fi # Escaped closing brace failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -564,7 +568,7 @@ fi # Try a recursive failed search failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -e "$testdir" "a*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -577,7 +581,7 @@ fi # ... with GLOB_ERR failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "a*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -590,7 +594,7 @@ fi # Try a recursive search in unreadable directory failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "noread/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -602,7 +606,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "noread*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -620,14 +624,14 @@ if test -z "$user"; then fi if test "$user" != root; then # ... with GLOB_ERR - ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ + ${run_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "noread/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 GLOB_ABORTED EOF - ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ + ${run_program_prefix} \ ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -641,7 +645,7 @@ fi # not run as root # Try multiple patterns (GLOB_APPEND) failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest "$testdir" "file1" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -658,7 +662,7 @@ fi # Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS) failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -676,7 +680,7 @@ fi # Test NOCHECK with non-existing file in subdir. failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 @@ -689,7 +693,7 @@ fi # Test [[:punct:]] not matching leading period. failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \ +${run_program_prefix} \ ${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" | sort > $testout cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 diff --git a/libc/posix/tst-getconf.sh b/libc/posix/tst-getconf.sh index 9630ebf4e..796685b68 100644 --- a/libc/posix/tst-getconf.sh +++ b/libc/posix/tst-getconf.sh @@ -2,14 +2,17 @@ common_objpfx=$1; shift elf_objpfx=$1; shift +cross_test_wrapper=$1; shift if [ $# -eq 0 ]; then # Static case. runit() { + ${cross_test_wrapper} \ "$@" } else rtld_installed_name=$1; shift runit() { + ${cross_test_wrapper} \ ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@" } fi @@ -26,7 +29,10 @@ rm -f $logfile result=0 while read name; do echo -n "getconf $name: " >> $logfile - runit ${common_objpfx}posix/getconf "$name" 2>> $logfile >> $logfile + # Redirect input from /dev/null in case runit consumes input when it + # shouldn't (ssh, say) + runit ${common_objpfx}posix/getconf "$name" \ + < /dev/null 2>> $logfile >> $logfile if test $? -ne 0; then echo "*** $name FAILED" >> $logfile result=1 @@ -204,7 +210,10 @@ EOF while read name; do echo -n "getconf $name /: " >> $logfile - runit ${common_objpfx}posix/getconf "$name" / 2>> $logfile >> $logfile + # Redirect input from /dev/null in case runit consumes input when it + # shouldn't (ssh, say) + runit ${common_objpfx}posix/getconf "$name" / \ + < /dev/null 2>> $logfile >> $logfile if test $? -ne 0; then echo "*** $name FAILED" >> $logfile result=1 diff --git a/libc/posix/wordexp-tst.sh b/libc/posix/wordexp-tst.sh index 9654457f5..c6de4f8fb 100755 --- a/libc/posix/wordexp-tst.sh +++ b/libc/posix/wordexp-tst.sh @@ -7,6 +7,11 @@ common_objpfx=$1; shift elf_objpfx=$1; shift rtld_installed_name=$1; shift +cross_test_wrapper=$1; shift + +run_program_prefix="${cross_test_wrapper} \ +${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx}" + logfile=${common_objpfx}posix/wordexp-tst.out testout=${common_objpfx}posix/wordexp-test-result @@ -20,7 +25,7 @@ IFS=" \ export IFS failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '$*' > ${testout}1 cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1 wordexp returned 0 @@ -32,7 +37,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '${*}' unquoted > ${testout}2 cat <<"EOF" | cmp - ${testout}2 >> $logfile || failed=1 wordexp returned 0 @@ -45,7 +50,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '$@' unquoted > ${testout}3 cat <<"EOF" | cmp - ${testout}3 >> $logfile || failed=1 wordexp returned 0 @@ -58,7 +63,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '"$* quoted"' param > ${testout}4 cat <<"EOF" | cmp - ${testout}4 >> $logfile || failed=1 wordexp returned 0 @@ -70,7 +75,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '"$@ quoted"' param > ${testout}5 cat <<"EOF" | cmp - ${testout}5 >> $logfile || failed=1 wordexp returned 0 @@ -84,7 +89,7 @@ fi # Why? Because bash does it that way.. failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '$#' 2 3 4 5 > ${testout}6 cat <<"EOF" | cmp - ${testout}6 >> $logfile || failed=1 wordexp returned 0 @@ -96,7 +101,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7 cat <<"EOF" | cmp - ${testout}7 >> $logfile || failed=1 wordexp returned 0 @@ -111,7 +116,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '${11}' 2 3 4 5 6 7 8 9 10 11 > ${testout}8 cat <<"EOF" | cmp - ${testout}8 >> $logfile || failed=1 wordexp returned 0 @@ -123,7 +128,7 @@ if test $failed -ne 0; then fi failed=0 -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '"a $@ b"' c d > ${testout}9 cat <<"EOF" | cmp - ${testout}9 >> $logfile || failed=1 wordexp returned 0 @@ -136,7 +141,7 @@ if test $failed -ne 0; then status=1 fi -${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \ +${run_program_prefix} \ ${common_objpfx}posix/wordexp-test '${#@} ${#2} *$**' two 3 4 > ${testout}10 cat <<"EOF" | cmp - ${testout}10 || failed=1 wordexp returned 0 diff --git a/libc/resolv/Makefile b/libc/resolv/Makefile index f6230da8f..217439200 100644 --- a/libc/resolv/Makefile +++ b/libc/resolv/Makefile @@ -101,17 +101,17 @@ $(objpfx)tst-leaks: $(objpfx)libresolv.so tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@ -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-leaks endif -endif +# eglibc: endif tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace $(objpfx)mtrace-tst-leaks2: $(objpfx)tst-leaks2.out $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@ -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) ifneq (no,$(PERL)) xtests: $(objpfx)mtrace-tst-leaks2 endif -endif +# eglibc: endif diff --git a/libc/rt/Makefile b/libc/rt/Makefile index 148ded996..671f6b841 100644 --- a/libc/rt/Makefile +++ b/libc/rt/Makefile @@ -80,7 +80,7 @@ ifeq (yes,$(build-bounded)) $(tests:%=$(objpfx)%-bp): $(objpfx)librt_b.a $(bounded-thread-library) endif -tst-mqueue7-ARGS = -- $(built-program-cmd) +tst-mqueue7-ARGS = -- $(local-built-program-cmd) ifeq (yes,$(build-static-nss)) otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \ diff --git a/libc/scripts/cross-test-ssh.sh b/libc/scripts/cross-test-ssh.sh new file mode 100644 index 000000000..2f0df2dcc --- /dev/null +++ b/libc/scripts/cross-test-ssh.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash +# usage: cross-test-ssh.sh [--ssh SSH] HOST COMMAND ... +# Run with --help flag to get more detailed help. + +progname="$(basename $0)" +env_blacklist='HOME LOGNAME MAIL PATH SHELL SHLVL SSH_CLIENT SSH_CONNECTION USER' + +usage="usage: ${progname} [--ssh SSH] HOST COMMAND ..." +help="Run an EGLIBC test COMMAND on the remote machine HOST, via ssh, +passing environment variables, preserving the current working directory, +and respecting quoting. + +If the '--ssh SSH' flag is present, use SSH as the SSH command, +instead of ordinary 'ssh'. + +To use this to run EGLIBC tests, invoke the tests as follows: + + $ make cross-test-wrapper='ABSPATH/cross-test-ssh.sh HOST' tests + +where ABSPATH is the absolute path to this script, and HOST is the +name of the machine to connect to via ssh. + +HOST and the build machines (on which 'make check' is being run) must +share a filesystem; all files needed by the tests must be visible at +the same paths on both machines. + +${progname} runs COMMAND in the same directory on the HOST that +${progname} itself is run in on the build machine. + +The command and arguments are passed to the remote host in a way that +avoids any further shell substitution or expansion, on the assumption +that the shell on the build machine has already done them +appropriately. + +${progname} propagates the values all environment variables through to +the remote target, except the following: +${env_blacklist}" + +ssh='ssh' +while true; do + case "$1" in + + "--ssh") + shift; ssh="$1" + ;; + + "--help") + echo "$usage" + echo "$help" + exit 0 + ;; + + *) + break + ;; + esac + shift +done + +if [ $# -lt 1 ]; then + echo "$usage" >&2 + echo "Type '${progname} --help' for more detailed help." >&2 + exit 1 +fi + +host="$1"; shift + +# Return all input as a properly quoted Bourne shell string. +bourne_quote () { + echo -n '"' + sed -n \ + -e '1h' \ + -e '2,$H' \ + -e '${g + s/["$\`]/\\&/g + p + }' + echo -n '"' +} + +# Echo all lines of input except those starting with 'export VAR=', +# where VAR is a blacklisted variable. Turn lines starting with +# 'declare -x VAR=' into the analogous export commands, before +# blacklisting. +blacklist_exports () { + local pat + pat="$(for var in ${env_blacklist}; do + echo "^export ${var}=" + done)" + sed -e 's|^declare -x |export |' \ + | grep -v -e "$pat" +} + +# Produce properly quoted Bourne shell arguments for 'env' to carry +# over the current environment, less blacklisted variables. +# The 'export -p' command munges the values of environment variables if +# they contain newlines. +exports="$(export -p | blacklist_exports)" + +# Transform the current argument list into a properly quoted Bourne shell +# command string. +command="$(for word in "$@"; do + echo -n "$word" | bourne_quote + echo -n ' ' + done)" + +# Add commands to set environment variables and the current directory. +command="${exports} +cd $PWD +${command}" + +# HOST's sshd simply concatenates its arguments with spaces and +# passes them to some shell. We want to force the use of /bin/sh, +# so we need to re-quote the whole command to ensure it appears as +# the sole argument of the '-c' option. +$ssh "$host" /bin/sh -c "$(echo "${command}" | bourne_quote)" diff --git a/libc/stdio-common/Makefile b/libc/stdio-common/Makefile index 98220550f..895d6fd6a 100644 --- a/libc/stdio-common/Makefile +++ b/libc/stdio-common/Makefile @@ -63,7 +63,7 @@ include ../Rules $(inst_includedir)/bits/stdio_lim.h: $(common-objpfx)bits/stdio_lim.h $(+force) $(do-install) -ifeq ($(cross-compiling),no) +# eglibc: ifeq ($(cross-compiling),no) .PHONY: do-tst-unbputc do-tst-printf tests: do-tst-unbputc do-tst-printf @@ -74,7 +74,7 @@ $(objpfx)tst-unbputc.out: $(objpfx)tst-unbputc tst-unbputc.sh do-tst-printf: $(objpfx)tst-printf.out $(objpfx)tst-printf.out: $(objpfx)tst-printf tst-printf.sh $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)' -endif +# eglibc: endif CFLAGS-vfprintf.c = -Wno-uninitialized CFLAGS-tst-printf.c = -Wno-format diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index b4518b2bb..ec5526127 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -120,9 +120,9 @@ testmb2-ENV = LOCPATH=$(common-objpfx)localedata # Run a test on the header files we use. tests: $(objpfx)isomac.out -ifeq (no,$(cross-compiling)) +# eglibc: ifeq (no,$(cross-compiling)) tests: $(objpfx)tst-fmtmsg.out -endif +# eglibc: endif $(objpfx)isomac.out: $(objpfx)isomac $(dir $<)$(notdir $<) '$(CC)' \ diff --git a/libc/string/Makefile b/libc/string/Makefile index d4ec22457..734c96690 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -73,10 +73,10 @@ CFLAGS-stratcliff.c = -fno-builtin CFLAGS-test-ffs.c = -fno-builtin CFLAGS-tst-inlcall.c = -fno-builtin -ifeq ($(cross-compiling),no) +# eglibc: ifeq ($(cross-compiling),no) tests: $(objpfx)tst-svc.out $(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \ $(built-program-cmd) < $(word 1,$^) > $@ -cmp tst-svc.expect $(objpfx)tst-svc.out -endif +# eglibc: endif |