From 4a4fe636dcef1c71c6aef423be0c6788f9d46c40 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 12 May 2008 08:49:58 +0200 Subject: [PATCH] tests: env-related clean up * tests/Coreutils.pm: tiny clean-up: s/env/env --/ * tests/misc/help-version: Use "env" rather than an absolute file name prefix. * tests/misc/printf-surprise: Likewise. --- tests/Coreutils.pm | 2 +- tests/misc/help-version | 12 +++++------- tests/misc/printf-surprise | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm index 2406dd1..3245eda 100644 --- a/tests/Coreutils.pm +++ b/tests/Coreutils.pm @@ -217,7 +217,7 @@ sub run_tests ($$$$$) # To indicate that $prog is a shell built-in, you'd make it a string 'ref'. # E.g., call run_tests ($prog, \$prog, \@Tests, $save_temps, $verbose); # If it's a ref, invoke it via "env": - my @prog = ref $prog ? ('env', $$prog) : $prog; + my @prog = ref $prog ? (qw(env --), $$prog) : $prog; # Warn about empty t_spec. # FIXME diff --git a/tests/misc/help-version b/tests/misc/help-version index b14c153..77e54c7 100755 --- a/tests/misc/help-version +++ b/tests/misc/help-version @@ -50,10 +50,8 @@ for lang in C fr da; do # false fails even when invoked with --help or --version. if test $i = false; then - env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --help \ - >/dev/null && fail=1 - env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --version \ - >/dev/null && fail=1 + env LC_MESSAGES=$lang $i" --help >/dev/null && fail=1 + env LC_MESSAGES=$lang $i" --version >/dev/null && fail=1 continue fi @@ -61,8 +59,8 @@ for lang in C fr da; do test $i = install && i=ginstall # Make sure they exit successfully, under normal conditions. - "$abs_top_builddir/src/$i" --help > h-$i || fail=1 - "$abs_top_builddir/src/$i" --version >/dev/null || fail=1 + env $i --help > h-$i || fail=1 + env $i --version >/dev/null || fail=1 # Make sure they mention the bug-reporting address in --help output. grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1 @@ -188,7 +186,7 @@ for i in $built_programs; do # echo ================== $i test $i = [ && prog=lbracket || prog=$i eval "args=\$${prog}_args" - if "$abs_top_builddir/src/$i" $args < $tmp_in > $tmp_out; then + if env $i $args < $tmp_in > $tmp_out; then : # ok else echo FAIL: $i diff --git a/tests/misc/printf-surprise b/tests/misc/printf-surprise index 9056602..64fdad0 100755 --- a/tests/misc/printf-surprise +++ b/tests/misc/printf-surprise @@ -16,11 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -prog="$abs_top_builddir/src/printf" +prog=printf if test "$VERBOSE" = yes; then set -x - "$prog" --version + env $prog --version fi . $top_srcdir/tests/test-lib.sh @@ -50,7 +50,7 @@ fail=0 # triggering the printf(3) misbehavior -- which, btw, is required by ISO C99. ( ulimit -v 10000 - "$prog" %20000000f 0 2>err | head -c 10 >out ) + env $prog %20000000f 0 2>err | head -c 10 >out ) # Map this longer, and rarer, diagnostic to the common one. # printf: cannot perform formatted output: Cannot allocate memory" \ -- 2.7.4