RFC: test-in-container vs ld.so

Message ID xn5ziuulv9.fsf@greed.delorie.com
State Dropped
Headers

Commit Message

DJ Delorie Dec. 6, 2019, 4:19 a.m. UTC
  Florian Weimer <fw@deneb.enyo.de> writes:
> I suspect the removalof LC_*, LANG etc. variables should be done in
> test-container, just for convenience.

This is what I ended up with.  All tests pass, but as I mentioned in a
previous email, very few tests run in the container.  This blocks the
outer variables from coming in, while letting the test itself set them
again if needed.

I'm not sure what kind of test we could run in the container to make
sure we're *not* accidentally using the build-tree file, though.
  

Patch

diff --git a/Rules b/Rules
index 8dbac56ce6..9ca5e14092 100644
--- a/Rules
+++ b/Rules
@@ -275,8 +275,8 @@  $(objpfx)%.out: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
 # tests-container.
 $(tests-container:%=$(objpfx)%.out): $(objpfx)%.out : $(if $(wildcard $(objpfx)%.files),$(objpfx)%.files,/dev/null) $(objpfx)%
 	$(test-wrapper-env) $(run-program-env) $(run-via-rtld-prefix) \
-	  $(common-objpfx)support/test-container env $(run-program-env) $($*-ENV) \
-	  $(host-test-program-cmd) $($*-ARGS) > $@; \
+	  $(common-objpfx)support/test-container env $($*-ENV) \
+	  $(built-program-file) $($*-ARGS) > $@; \
 	$(evaluate-test)
 
 
diff --git a/support/test-container.c b/support/test-container.c
index 5d08979df3..9b0b1c7631 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -712,6 +712,12 @@  main (int argc, char **argv)
       --argc;
     }
 
+  /* We don't want to inherit these from the ld.so wrapper we were
+     invoked with, but the test can still provide a test-specific
+     value via the "env" we pretend to run.  */
+  unsetenv ("GCONV_PATH");
+  unsetenv ("LOCPATH");
+
   if (strcmp (argv[1], "env") == 0)
     {
       ++argv;