When running under valgrind, I saw this spurious failure: FAIL: misc/printenv (exit: 1) ============================= ... + env -- printenv + grep -v '^_' + compare exp out + diff -u exp out --- exp 2009-12-10 07:20:38.221344757 +0100 +++ out 2009-12-10 07:20:39.230469779 +0100 @@ -125,4 +125,4 @@ host_triplet=x86_64-unknown-linux-gnu COLORTERM=gnome-terminal XAUTHORITY=/var/run/gdm/auth-for-meyering-mUEkRg/database -LD_PRELOAD=/usr/lib64/valgrind/vgpreload_core-amd64-linux.so:/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so +LD_PRELOAD= + fail=1
This patch avoids it. Also fixes an obsolete comment. >From c3e1c7948238923423b4d9ef246a5893b89cada0 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Thu, 10 Dec 2009 08:17:02 +0100 Subject: [PATCH] tests: avoid spurious failure when run via valgrind * tests/misc/printenv: Ignore LD_PRELOAD differences. --- tests/misc/printenv | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/misc/printenv b/tests/misc/printenv index c2bd2e4..a56e9c7 100755 --- a/tests/misc/printenv +++ b/tests/misc/printenv @@ -25,10 +25,11 @@ fi # Without arguments, printenv behaves like env. Some shells provide -# printenv as a builtin, so we must test via absolute name. +# printenv as a builtin, so we must invoke it via "env". # But beware of $_, set by many shells to the last command run. -env | grep -v '^_' > exp || framework_failure -env -- printenv | grep -v '^_' > out || fail=1 +# Also, filter out LD_PRELOAD, which is set when running under valgrind. +env | grep -Ev '^(_|LD_LIBRARY=)' > exp || framework_failure +env -- printenv | grep -Ev '^(_|LD_LIBRARY=)' > out || fail=1 compare exp out || fail=1 # POSIX is clear that environ may, but need not be, sorted. -- 1.6.6.rc1.319.g9b57d