summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2015-02-03 01:52:04 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2015-02-03 02:19:54 +0100
commitbfb4f5c8b791fdcc3cdba87a5182fc684fa8cd24 (patch)
treefb1a8080816a2492da65d314998a9f786d3d870f /tests/misc
parentb3ecf3b1b219a2ccd17999561fd7e4fe64efac4b (diff)
downloadcoreutils-bfb4f5c8b791fdcc3cdba87a5182fc684fa8cd24.tar.xz
tests: avoid a FP on aarch64 when comparing env/printenv output
The following test fails on aarch64 on openSUSE's OpenBuildService due to glibc's execvp reversing the pointers of 'environ', i.e., the output of "env|tac" equals "env env" on that platform. * tests/misc/printenv.sh: Use 'env env' to work around the behavior on that platform. While at it, fix the grep pattern which suppressed all environment variables starting with an underscore "_" instead of "$_" (and "$LD_PRELOAD") only.
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/printenv.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/misc/printenv.sh b/tests/misc/printenv.sh
index 5c2f7c04c..862b48ba8 100755
--- a/tests/misc/printenv.sh
+++ b/tests/misc/printenv.sh
@@ -23,8 +23,12 @@ print_ver_ printenv
# printenv as a builtin, so we must invoke it via "env".
# But beware of $_, set by many shells to the last command run.
# Also, filter out LD_PRELOAD, which is set when running under valgrind.
-env | grep -Ev '^(_|LD_PRELOAD=)' > exp || framework_failure_
-env -- printenv | grep -Ev '^(_|LD_PRELOAD=)' > out || fail=1
+# Note the apparently redundant "env env": this is to ensure to get
+# env's output the same way as that of printenv and works around a bug
+# on aarch64 at least where libc's execvp reverses the order of the
+# output.
+env -- env | grep -Ev '^(_|LD_PRELOAD)=' > exp || framework_failure_
+env -- printenv | grep -Ev '^(_|LD_PRELOAD)=' > out || fail=1
compare exp out || fail=1
# POSIX is clear that environ may, but need not be, sorted.