5f7b84
commit bd598da9f454bc1091b4ebe0303b07e6f96ca130
5f7b84
Author: Joseph Myers <joseph@codesourcery.com>
5f7b84
Date:   Tue Dec 4 16:52:39 2018 +0000
5f7b84
5f7b84
    Stop test-in-container trying to run other-OS binaries.
5f7b84
    
5f7b84
    I noticed that, now that build-many-glibcs.py no longer copies glibc
5f7b84
    sources, I was getting core dumps in my glibc source directories.  The
5f7b84
    cause appears to be, from the i686-gnu build:
5f7b84
    
5f7b84
    for dso in ` env LD_TRACE_LOADED_OBJECTS=1  \
5f7b84
            /scratch/jmyers/glibc-bot/build/glibcs/i686-gnu/glibc/elf/ld.so.1 \
5f7b84
            /scratch/jmyers/glibc-bot/build/glibcs/i686-gnu/glibc/testroot.pristine/bin/sh \
5f7b84
    [...]
5f7b84
    Segmentation fault (core dumped)
5f7b84
    
5f7b84
    In this case, the x86 architecture means the binary executes, but
5f7b84
    dumps core rather than actually working.
5f7b84
    
5f7b84
    Anything involving running the newly built glibc should only be done
5f7b84
    ifeq ($(run-built-tests),yes).  This patch conditions the relevant
5f7b84
    part of the testroot setup accordingly.
5f7b84
    
5f7b84
    Tested for x86_64, and with build-many-glibcs.py for i686-gnu.
5f7b84
    
5f7b84
    	* Makefile ($(objpfx)testroot.pristine/install.stamp): Do not run
5f7b84
    	dynamic linker unless [$(run-built-tests) = yes].
5f7b84
5f7b84
diff --git a/Makefile b/Makefile
5f7b84
index b4703e4..fd73d9b 100644
5f7b84
--- a/Makefile
5f7b84
+++ b/Makefile
5f7b84
@@ -374,6 +374,7 @@ $(objpfx)testroot.pristine/install.stamp :
5f7b84
 	cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
5f7b84
 	cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
5f7b84
 	cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
5f7b84
+ifeq ($(run-built-tests),yes)
5f7b84
 	# Copy these DSOs first so we can overwrite them with our own.
5f7b84
 	for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1  \
5f7b84
 		$(objpfx)elf/$(rtld-installed-name) \
5f7b84
@@ -393,6 +394,7 @@ $(objpfx)testroot.pristine/install.stamp :
5f7b84
 	      mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
5f7b84
 	    $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
5f7b84
 	  done
5f7b84
+endif
5f7b84
 	$(MAKE) install DESTDIR=$(objpfx)testroot.pristine
5f7b84
 	touch $(objpfx)testroot.pristine/install.stamp
5f7b84