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