[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r1386 - in /trunk/libc: ./ catgets/ elf/ grp/ iconv/ iconvdata/ intl/ io/ libio/ localedata/ malloc/ misc/ nptl/ posix/ reso...



Author: jimb
Date: Mon Feb  5 16:34:17 2007
New Revision: 1386

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

Added:
    trunk/libc/scripts/cross-test-ssh.sh
Modified:
    trunk/libc/ChangeLog.eglibc
    trunk/libc/Makeconfig
    trunk/libc/Rules
    trunk/libc/catgets/Makefile
    trunk/libc/elf/Makefile
    trunk/libc/elf/tst-pathopt.sh
    trunk/libc/grp/Makefile
    trunk/libc/grp/tst_fgetgrent.sh
    trunk/libc/iconv/Makefile
    trunk/libc/iconvdata/Makefile
    trunk/libc/iconvdata/run-iconv-test.sh
    trunk/libc/iconvdata/tst-table.sh
    trunk/libc/iconvdata/tst-tables.sh
    trunk/libc/intl/Makefile
    trunk/libc/intl/tst-codeset.sh
    trunk/libc/intl/tst-gettext.sh
    trunk/libc/intl/tst-gettext2.sh
    trunk/libc/intl/tst-gettext3.sh
    trunk/libc/intl/tst-translit.sh
    trunk/libc/io/Makefile
    trunk/libc/io/ftwtest-sh
    trunk/libc/libio/Makefile
    trunk/libc/localedata/Makefile
    trunk/libc/localedata/tst-fmon.sh
    trunk/libc/localedata/tst-numeric.sh
    trunk/libc/localedata/tst-rpmatch.sh
    trunk/libc/localedata/tst-wctype.sh
    trunk/libc/malloc/Makefile
    trunk/libc/malloc/tst-mtrace.sh
    trunk/libc/misc/Makefile
    trunk/libc/nptl/Makefile
    trunk/libc/nptl/tst-tls6.sh
    trunk/libc/posix/Makefile
    trunk/libc/posix/globtest.sh
    trunk/libc/posix/tst-getconf.sh
    trunk/libc/posix/wordexp-tst.sh
    trunk/libc/resolv/Makefile
    trunk/libc/rt/Makefile
    trunk/libc/stdio-common/Makefile
    trunk/libc/stdlib/Makefile
    trunk/libc/string/Makefile

Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Mon Feb  5 16:34:17 2007
@@ -1,3 +1,83 @@
+2007-02-05  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>
+
+	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@xxxxxxxxxxxxxxxx>
 
 	Use the host nm in NPTL tests.

Modified: trunk/libc/Makeconfig
==============================================================================
--- trunk/libc/Makeconfig (original)
+++ trunk/libc/Makeconfig Mon Feb  5 16:34:17 2007
@@ -551,17 +551,23 @@
 $(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)))
-else
-run-program-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)
+# 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-via-rtld-prefix =
+endif
+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

Modified: trunk/libc/Rules
==============================================================================
--- trunk/libc/Rules (original)
+++ trunk/libc/Rules Mon Feb  5 16:34:17 2007
@@ -91,17 +91,17 @@
 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)

Modified: trunk/libc/catgets/Makefile
==============================================================================
--- trunk/libc/catgets/Makefile (original)
+++ trunk/libc/catgets/Makefile Mon Feb  5 16:34:17 2007
@@ -55,7 +55,7 @@
 
 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)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

Modified: trunk/libc/elf/Makefile
==============================================================================
--- trunk/libc/elf/Makefile (original)
+++ trunk/libc/elf/Makefile Mon Feb  5 16:34:17 2007
@@ -395,9 +395,9 @@
 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)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)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 @@
 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)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)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)

Modified: trunk/libc/elf/tst-pathopt.sh
==============================================================================
--- trunk/libc/elf/tst-pathopt.sh (original)
+++ trunk/libc/elf/tst-pathopt.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 
 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 $?

Modified: trunk/libc/grp/Makefile
==============================================================================
--- trunk/libc/grp/Makefile (original)
+++ trunk/libc/grp/Makefile Mon Feb  5 16:34:17 2007
@@ -59,13 +59,13 @@
 
 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

Modified: trunk/libc/grp/tst_fgetgrent.sh
==============================================================================
--- trunk/libc/grp/tst_fgetgrent.sh (original)
+++ trunk/libc/grp/tst_fgetgrent.sh Mon Feb  5 16:34:17 2007
@@ -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
 

Modified: trunk/libc/iconv/Makefile
==============================================================================
--- trunk/libc/iconv/Makefile (original)
+++ trunk/libc/iconv/Makefile Mon Feb  5 16:34:17 2007
@@ -79,9 +79,9 @@
 $(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

Modified: trunk/libc/iconvdata/Makefile
==============================================================================
--- trunk/libc/iconvdata/Makefile (original)
+++ trunk/libc/iconvdata/Makefile Mon Feb  5 16:34:17 2007
@@ -317,7 +317,7 @@
 	$(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 @@
 	   $(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)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
 

Modified: trunk/libc/iconvdata/run-iconv-test.sh
==============================================================================
--- trunk/libc/iconvdata/run-iconv-test.sh (original)
+++ trunk/libc/iconvdata/run-iconv-test.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 # 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 @@
 
 # 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 @@
       { 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 @@
     { echo "/FAILED"; failed=1; continue; }
   echo "OK"
 
-done < TESTS2
+done
+exec 5<&-
 
 exit $failed
 # Local Variables:

Modified: trunk/libc/iconvdata/tst-table.sh
==============================================================================
--- trunk/libc/iconvdata/tst-table.sh (original)
+++ trunk/libc/iconvdata/tst-table.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 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
 

Modified: trunk/libc/iconvdata/tst-tables.sh
==============================================================================
--- trunk/libc/iconvdata/tst-tables.sh (original)
+++ trunk/libc/iconvdata/tst-tables.sh Mon Feb  5 16:34:17 2007
@@ -24,6 +24,7 @@
 
 common_objpfx=$1
 objpfx=$2
+cross_test_wrapper="$3"
 
 status=0
 
@@ -250,7 +251,10 @@
   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}"

Modified: trunk/libc/intl/Makefile
==============================================================================
--- trunk/libc/intl/Makefile (original)
+++ trunk/libc/intl/Makefile Mon Feb  5 16:34:17 2007
@@ -61,7 +61,7 @@
 
 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 @@
 	$(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)

Modified: trunk/libc/intl/tst-codeset.sh
==============================================================================
--- trunk/libc/intl/tst-codeset.sh (original)
+++ trunk/libc/intl/tst-codeset.sh Mon Feb  5 16:34:17 2007
@@ -21,6 +21,7 @@
 
 common_objpfx=$1
 objpfx=$2
+cross_test_wrapper=$3
 
 LC_ALL=C
 export LC_ALL
@@ -37,6 +38,7 @@
 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
 

Modified: trunk/libc/intl/tst-gettext.sh
==============================================================================
--- trunk/libc/intl/tst-gettext.sh (original)
+++ trunk/libc/intl/tst-gettext.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 
 # 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
 

Modified: trunk/libc/intl/tst-gettext2.sh
==============================================================================
--- trunk/libc/intl/tst-gettext2.sh (original)
+++ trunk/libc/intl/tst-gettext2.sh Mon Feb  5 16:34:17 2007
@@ -21,6 +21,7 @@
 
 common_objpfx=$1
 objpfx=$2
+cross_test_wrapper=$3
 
 LC_ALL=C
 export LC_ALL
@@ -66,6 +67,7 @@
 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

Modified: trunk/libc/intl/tst-gettext3.sh
==============================================================================
--- trunk/libc/intl/tst-gettext3.sh (original)
+++ trunk/libc/intl/tst-gettext3.sh Mon Feb  5 16:34:17 2007
@@ -22,6 +22,7 @@
 
 common_objpfx=$1
 objpfx=$2
+cross_test_wrapper=$3
 
 LC_ALL=C
 export LC_ALL
@@ -38,6 +39,7 @@
 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
 

Modified: trunk/libc/intl/tst-translit.sh
==============================================================================
--- trunk/libc/intl/tst-translit.sh (original)
+++ trunk/libc/intl/tst-translit.sh Mon Feb  5 16:34:17 2007
@@ -21,6 +21,7 @@
 
 common_objpfx=$1
 objpfx=$2
+cross_test_wrapper=$3
 
 LC_ALL=C
 export LC_ALL
@@ -36,6 +37,7 @@
 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
 

Modified: trunk/libc/io/Makefile
==============================================================================
--- trunk/libc/io/Makefile (original)
+++ trunk/libc/io/Makefile Mon Feb  5 16:34:17 2007
@@ -94,10 +94,20 @@
 
 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

Modified: trunk/libc/io/ftwtest-sh
==============================================================================
--- trunk/libc/io/ftwtest-sh (original)
+++ trunk/libc/io/ftwtest-sh Mon Feb  5 16:34:17 2007
@@ -2,6 +2,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:
@@ -11,7 +14,7 @@
 #   --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 @@
 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
 

Modified: trunk/libc/libio/Makefile
==============================================================================
--- trunk/libc/libio/Makefile (original)
+++ trunk/libc/libio/Makefile Mon Feb  5 16:34:17 2007
@@ -172,9 +172,9 @@
 
 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)'	\

Modified: trunk/libc/localedata/Makefile
==============================================================================
--- trunk/libc/localedata/Makefile (original)
+++ trunk/libc/localedata/Makefile Mon Feb  5 16:34:17 2007
@@ -86,7 +86,7 @@
 # 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 @@
 tests: $(objpfx)mtrace-tst-leaks
 endif
 endif
-endif
+# eglibc: endif
 
 # Files to install.
 install-others := $(addprefix $(inst_i18ndir)/, \
@@ -138,7 +138,7 @@
 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 @@
 $(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 @@
 	$(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
 

Modified: trunk/libc/localedata/tst-fmon.sh
==============================================================================
--- trunk/libc/localedata/tst-fmon.sh (original)
+++ trunk/libc/localedata/tst-fmon.sh Mon Feb  5 16:34:17 2007
@@ -32,10 +32,13 @@
 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 @@
     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

Modified: trunk/libc/localedata/tst-numeric.sh
==============================================================================
--- trunk/libc/localedata/tst-numeric.sh (original)
+++ trunk/libc/localedata/tst-numeric.sh Mon Feb  5 16:34:17 2007
@@ -30,10 +30,13 @@
 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"

Modified: trunk/libc/localedata/tst-rpmatch.sh
==============================================================================
--- trunk/libc/localedata/tst-rpmatch.sh (original)
+++ trunk/libc/localedata/tst-rpmatch.sh Mon Feb  5 16:34:17 2007
@@ -25,9 +25,12 @@
 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

Modified: trunk/libc/localedata/tst-wctype.sh
==============================================================================
--- trunk/libc/localedata/tst-wctype.sh (original)
+++ trunk/libc/localedata/tst-wctype.sh Mon Feb  5 16:34:17 2007
@@ -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 $?

Modified: trunk/libc/malloc/Makefile
==============================================================================
--- trunk/libc/malloc/Makefile (original)
+++ trunk/libc/malloc/Makefile Mon Feb  5 16:34:17 2007
@@ -112,15 +112,15 @@
 
 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)
+	$(SHELL) -e $< $(common-objpfx) '$(cross-test-wrapper)'
 endif
 endif
-endif
+# eglibc: endif
 
 tst-mcheck-ENV = MALLOC_CHECK_=3
 

Modified: trunk/libc/malloc/tst-mtrace.sh
==============================================================================
--- trunk/libc/malloc/tst-mtrace.sh (original)
+++ trunk/libc/malloc/tst-mtrace.sh Mon Feb  5 16:34:17 2007
@@ -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
 

Modified: trunk/libc/misc/Makefile
==============================================================================
--- trunk/libc/misc/Makefile (original)
+++ trunk/libc/misc/Makefile Mon Feb  5 16:34:17 2007
@@ -79,9 +79,9 @@
 
 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)

Modified: trunk/libc/nptl/Makefile
==============================================================================
--- trunk/libc/nptl/Makefile (original)
+++ trunk/libc/nptl/Makefile Mon Feb  5 16:34:17 2007
@@ -434,7 +434,7 @@
 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-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 @@
 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 @@
 
 $(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

Modified: trunk/libc/nptl/tst-tls6.sh
==============================================================================
--- trunk/libc/nptl/tst-tls6.sh (original)
+++ trunk/libc/nptl/tst-tls6.sh Mon Feb  5 16:34:17 2007
@@ -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

Modified: trunk/libc/posix/Makefile
==============================================================================
--- trunk/libc/posix/Makefile (original)
+++ trunk/libc/posix/Makefile Mon Feb  5 16:34:17 2007
@@ -121,18 +121,18 @@
 			$(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
-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 @@
 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 @@
 # 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 @@
 	$(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

Modified: trunk/libc/posix/globtest.sh
==============================================================================
--- trunk/libc/posix/globtest.sh (original)
+++ trunk/libc/posix/globtest.sh Mon Feb  5 16:34:17 2007
@@ -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
@@ -19,6 +20,9 @@
 
 # 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
@@ -62,7 +66,7 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 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 @@
 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 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 @@
 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 @@
 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 # ... 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # ... 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 @@
 
 # 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 @@
 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 @@
 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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 @@
 
 # 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

Modified: trunk/libc/posix/tst-getconf.sh
==============================================================================
--- trunk/libc/posix/tst-getconf.sh (original)
+++ trunk/libc/posix/tst-getconf.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 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 @@
 
 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

Modified: trunk/libc/posix/wordexp-tst.sh
==============================================================================
--- trunk/libc/posix/wordexp-tst.sh (original)
+++ trunk/libc/posix/wordexp-tst.sh Mon Feb  5 16:34:17 2007
@@ -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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 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 @@
 # 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 @@
 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 @@
 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 @@
 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 @@
   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

Modified: trunk/libc/resolv/Makefile
==============================================================================
--- trunk/libc/resolv/Makefile (original)
+++ trunk/libc/resolv/Makefile Mon Feb  5 16:34:17 2007
@@ -101,17 +101,17 @@
 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

Modified: trunk/libc/rt/Makefile
==============================================================================
--- trunk/libc/rt/Makefile (original)
+++ trunk/libc/rt/Makefile Mon Feb  5 16:34:17 2007
@@ -80,7 +80,7 @@
 $(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 \

Added: trunk/libc/scripts/cross-test-ssh.sh
==============================================================================
--- trunk/libc/scripts/cross-test-ssh.sh (added)
+++ trunk/libc/scripts/cross-test-ssh.sh Mon Feb  5 16:34:17 2007
@@ -1,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)"

Modified: trunk/libc/stdio-common/Makefile
==============================================================================
--- trunk/libc/stdio-common/Makefile (original)
+++ trunk/libc/stdio-common/Makefile Mon Feb  5 16:34:17 2007
@@ -63,7 +63,7 @@
 $(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 @@
 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

Modified: trunk/libc/stdlib/Makefile
==============================================================================
--- trunk/libc/stdlib/Makefile (original)
+++ trunk/libc/stdlib/Makefile Mon Feb  5 16:34:17 2007
@@ -120,9 +120,9 @@
 # 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)'  \

Modified: trunk/libc/string/Makefile
==============================================================================
--- trunk/libc/string/Makefile (original)
+++ trunk/libc/string/Makefile Mon Feb  5 16:34:17 2007
@@ -73,10 +73,10 @@
 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