]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: use "env builtin" in place of "$abs_top_builddir/src/builtin"
authorJim Meyering <meyering@fb.com>
Tue, 1 Jul 2014 16:40:50 +0000 (09:40 -0700)
committerJim Meyering <meyering@fb.com>
Wed, 2 Jul 2014 16:07:26 +0000 (09:07 -0700)
This works for any program that might also be a shell built-in.
It is more concise.  In addition, it makes output more reproducible:
some diagnostics include argv[0], which will now be just the program
name, rather than the full absolute name of the executable.
* tests/misc/sort-compress.sh: Use env kill, rather than absolute name.
* tests/install/trap.sh: Likewise.
* tests/misc/timeout.sh: Likewise.
* tests/touch/no-dereference.sh: Do the same for two uses of "test".
* tests/touch/no-create-missing.sh: Likewise.

tests/install/trap.sh
tests/misc/sort-compress.sh
tests/misc/timeout.sh
tests/touch/no-create-missing.sh
tests/touch/no-dereference.sh

index 3510df3dbaa8425b19511b379b41c30e01505e33..235cd1d1e49ec1c7de47a223f893d261170364ea 100755 (executable)
@@ -24,7 +24,7 @@ print_ver_ ginstall
 # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
 (
   # ash doesn't support "trap '' CHLD"; it knows only signal numbers.
-  sig=$("$abs_top_builddir/src/kill" -l CHLD 2>/dev/null) && trap '' $sig
+  sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
 
   # Before 2004-04-21, install would infloop, in the 'while (wait...' loop:
   exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" .
index 75ab8bd1e0af6d5c77fb4906daf8bc8c0d153678..8f215b8b90feaeba153e848628dabc00ffd19f0b 100755 (executable)
@@ -39,7 +39,7 @@ chmod +x gzip
 # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
 (
   # ash doesn't support "trap '' CHLD"; it knows only signal numbers.
-  sig=$("$abs_top_builddir/src/kill" -l CHLD 2>/dev/null) && trap '' $sig
+  sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
 
   # This should force the use of child processes for "compression"
   PATH=.:$PATH exec sort -S 1k --compress-program=gzip in > /dev/null
index 247c2fc4c8a2ae21abeba2a5b64ae4eb01506967..8eaeef9588469b08c192c1b0505143bafc1b4949 100755 (executable)
@@ -51,7 +51,7 @@ test $? = 124 && fail=1
 # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
 (
   # ash doesn't support "trap '' CHLD"; it knows only signal numbers.
-  sig=$("$abs_top_builddir/src/kill" -l CHLD 2>/dev/null) && trap '' $sig
+  sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
 
   exec timeout 10 true
 ) || fail=1
index 4e5056e1a8170ce9bed765a8e48d138291a70f1a..7ce63b1b7ef6d35a5751757fb1e53ddd19d5ae55 100755 (executable)
@@ -24,13 +24,11 @@ touch -c no-file > /dev/null 2>&1 || fail=1
 touch -cm no-file > /dev/null 2>&1 || fail=1
 touch -ca no-file > /dev/null 2>&1 || fail=1
 
-test="$abs_top_builddir/src/test"
-
 # If >&- works, test "touch -c -" etc.
 # >&- apparently does not work in HP-UX 11.23.
 # This test is ineffective unless /dev/stdout also works.
-if "$test" -w /dev/stdout >/dev/null &&
-   "$test" ! -w /dev/stdout >&-; then
+if env test -w /dev/stdout >/dev/null &&
+   env test ! -w /dev/stdout >&-; then
   touch -c - >&- 2> /dev/null || fail=1
   touch -cm - >&- 2> /dev/null || fail=1
   touch -ca - >&- 2> /dev/null || fail=1
index 1d012a1fe7c651152ac454a2145750d6e0b9d0a1..0f4fdca98c23207eaa11b84477d85dd1086a95de 100755 (executable)
@@ -69,14 +69,12 @@ esac
 # Test interactions with -.
 touch -h - > file || fail=1
 
-test="$abs_top_builddir/src/test"
-
 # If >&- works, test "touch -ch -" etc.
 # >&- apparently does not work in HP-UX 11.23.
 # This test is ineffective unless /dev/stdout also works.
 # If stdout is open, it is not a symlink.
-if "$test" -w /dev/stdout >/dev/null &&
-   "$test" ! -w /dev/stdout >&-; then
+if env test -w /dev/stdout >/dev/null &&
+   env test ! -w /dev/stdout >&-; then
   touch -h - >&- && fail=1
   touch -h -c - >&- || fail=1
 fi