diff --git a/tests/env/env-S.pl b/tests/env/env-S.pl index 2d12c1843..6e01975c7 100755 --- a/tests/env/env-S.pl +++ b/tests/env/env-S.pl @@ -27,6 +27,19 @@ $env =~ m!^([-+\@\w./]+)$! or CuSkip::skip "unusual absolute builddir name; skipping this test\n"; $env = $1; +# We may depend on a library found in LD_LIBRARY_PATH, or an equivalent +# environment variable. Skip the test if it is set since unsetting it may +# prevent us from running commands. +foreach my $var (qw(LD_LIBRARY_PATH LD_32_LIBRARY_PATH DYLD_LIBRARY_PATH + LIBPATH)) + { + if (exists $ENV{$var}) + { + CuSkip::skip ("programs may depend on $var being set; " + . "skipping this test\n"); + } + } + # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; diff --git a/tests/env/env-null.sh b/tests/env/env-null.sh index 27d8c5fb2..c62e87402 100755 --- a/tests/env/env-null.sh +++ b/tests/env/env-null.sh @@ -19,6 +19,16 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ env printenv +# We may depend on a library found in LD_LIBRARY_PATH, or an equivalent +# environment variable. Skip the test if it is set since unsetting it may +# prevent us from running commands. +for var in LD_LIBRARY_PATH LD_32_LIBRARY_PATH DYLD_LIBRARY_PATH LIBPATH; do + eval val=\$$var + if test -n "$val"; then + skip_ "programs may depend on $var being set" + fi +done + # POSIX is clear that environ may, but need not be, sorted. # Environment variable values may contain newlines, which cannot be # observed by merely inspecting output from env.