On 10/11/15 07:27, Bernhard Voelker wrote:
> On 11/10/2015 12:54 AM, Pádraig Brady wrote:
>> For these reasons I might just keep the test cleanups
>> from my previous patch but continue to build kill by default?
> 
> +1
> 
>>From a packager's point of view, it's very easy to either use
> --enable-no-install-program=... or simply to remove the binary
> and the man page afterward.  I find it more complicated [1][2]
> to remove all occurrences from the Texinfo documentation - which
> the above switch doesn't accomplish btw.

I see that there were various issues apart from the texinfo docs
related to --enable-no-install-program, where tests would depend on
programs being built.  Hopefully that's mostly addressed in the
attached patch set.

> For upstream development, I'd prefer to always build all tools.
> We have to ensure that all tools still build, leave alone the
> dramatic decrease of test coverage of those programs.
> Therefore, I'd rather like to see all tools built here ...
> maybe similar to have we enabled -Werror when .git exists?

A good idea.

cheers,
Pádraig.
From 41a4c714e49e26f290e0c2e27a61d9086e633b52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Mon, 9 Nov 2015 18:50:21 +0000
Subject: [PATCH 1/3] tests: cleanup trapping of signal names

A side effect of this cleanup is we no longer
depend on our own kill command being built.

* init.cfg (require_trap_signame_): A new function to verify
that the shell supports specifying traps by signal name.
(require_kill_group_): A new function to ensure the shell
supports sending a signal to a group.
* tests/du/move-dir-while-traversing.sh: Ensure trap supports
signal names.
* tests/misc/stty-invalid.sh: Likewise.
* tests/misc/stty-pairs.sh: Likewise.
* tests/misc/stty-row-col.sh: Likewise.
* tests/misc/stty.sh: Likewise.
* tests/misc/sort-compress.sh: Likewise.  Also simplify trap call.
* tests/install/trap.sh: Likewise.
* tests/misc/timeout.sh: Likewise.
* tests/dd/stats.sh: Likewise.  Also use default kill command.
* tests/misc/timeout-group.sh: Likewise.
---
 init.cfg                              | 14 ++++++++++++++
 tests/dd/stats.sh                     |  3 ++-
 tests/du/move-dir-while-traversing.sh |  1 +
 tests/install/trap.sh                 |  4 ++--
 tests/misc/sort-compress.sh           |  4 ++--
 tests/misc/stty-invalid.sh            |  2 ++
 tests/misc/stty-pairs.sh              |  2 ++
 tests/misc/stty-row-col.sh            |  2 ++
 tests/misc/stty.sh                    |  2 ++
 tests/misc/timeout-group.sh           |  5 +++--
 tests/misc/timeout.sh                 |  4 ++--
 11 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/init.cfg b/init.cfg
index ef450d7..6f5f80b 100644
--- a/init.cfg
+++ b/init.cfg
@@ -470,6 +470,20 @@ require_proc_pid_status_()
     kill $pid
 }
 
+# Does trap support signal names?
+# Old versions of ash did not.
+require_trap_signame_()
+{
+    (trap '' CHLD) || skip_ 'requires trap with signal name support'
+}
+
+# Does kill support sending signal to whole group?
+# dash 0.5.8 at least does not.
+require_kill_group_()
+{
+    kill -0 -- -1 || skip_ 'requires kill with group signalling support'
+}
+
 # Return nonzero if the specified path is on a file system for
 # which FIEMAP support exists.  Note some file systems (like ext3 and btrfs)
 # only support FIEMAP for files, not directories.
diff --git a/tests/dd/stats.sh b/tests/dd/stats.sh
index a82c66d..da2c2d2 100755
--- a/tests/dd/stats.sh
+++ b/tests/dd/stats.sh
@@ -18,8 +18,9 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ dd
+require_trap_signame_
 
-env kill -l | grep '^INFO$' && SIGINFO='INFO' || SIGINFO='USR1'
+kill -l | grep 'INFO' && SIGINFO='INFO' || SIGINFO='USR1'
 
 # This to avoid races in the USR1 case
 # as the dd process will terminate by default until
diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh
index 67bb345..a90f1c4 100755
--- a/tests/du/move-dir-while-traversing.sh
+++ b/tests/du/move-dir-while-traversing.sh
@@ -18,6 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ du
+require_trap_signame_
 
 # We use a python-inotify script, so...
 python -m pyinotify -h > /dev/null \
diff --git a/tests/install/trap.sh b/tests/install/trap.sh
index 0851ba6..157d1bc 100755
--- a/tests/install/trap.sh
+++ b/tests/install/trap.sh
@@ -19,12 +19,12 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ ginstall
+require_trap_signame_
 
 
 # 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=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
+  trap '' CHLD
 
   # Before 2004-04-21, install would infloop, in the 'while (wait...' loop:
   exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" .
diff --git a/tests/misc/sort-compress.sh b/tests/misc/sort-compress.sh
index 584110e..7cb5df8 100755
--- a/tests/misc/sort-compress.sh
+++ b/tests/misc/sort-compress.sh
@@ -18,6 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ sort
+require_trap_signame_
 
 seq -w 2000 > exp || framework_failure_
 tac exp > in || framework_failure_
@@ -38,8 +39,7 @@ chmod +x gzip
 # Ensure 'sort' is immune to parent's SIGCHLD handler
 # 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=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
+  trap '' CHLD
 
   # This should force the use of child processes for "compression"
   PATH=.:$PATH exec sort -S 1k --compress-program=gzip in > /dev/null
diff --git a/tests/misc/stty-invalid.sh b/tests/misc/stty-invalid.sh
index 881146f..49c2086 100755
--- a/tests/misc/stty-invalid.sh
+++ b/tests/misc/stty-invalid.sh
@@ -19,6 +19,8 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ stty
 require_controlling_input_terminal_
+require_trap_signame_
+
 trap '' TTOU # Ignore SIGTTOU
 
 
diff --git a/tests/misc/stty-pairs.sh b/tests/misc/stty-pairs.sh
index 129c22f..0494343 100755
--- a/tests/misc/stty-pairs.sh
+++ b/tests/misc/stty-pairs.sh
@@ -23,6 +23,8 @@ expensive_
 
 # Make sure there's a tty on stdin.
 require_controlling_input_terminal_
+require_trap_signame_
+
 trap '' TTOU # Ignore SIGTTOU
 
 # Get the reversible settings from stty.c.
diff --git a/tests/misc/stty-row-col.sh b/tests/misc/stty-row-col.sh
index 0616812..8c18df6 100755
--- a/tests/misc/stty-row-col.sh
+++ b/tests/misc/stty-row-col.sh
@@ -32,6 +32,8 @@ export LC_ALL
 print_ver_ stty
 
 require_controlling_input_terminal_
+require_trap_signame_
+
 trap '' TTOU # Ignore SIGTTOU
 
 # Versions of GNU stty from shellutils-1.9.2c and earlier failed
diff --git a/tests/misc/stty.sh b/tests/misc/stty.sh
index 5e39b72e..217891a 100755
--- a/tests/misc/stty.sh
+++ b/tests/misc/stty.sh
@@ -21,6 +21,8 @@
 print_ver_ stty
 
 require_controlling_input_terminal_
+require_trap_signame_
+
 trap '' TTOU # Ignore SIGTTOU
 
 # Get the reversible settings from stty.c.
diff --git a/tests/misc/timeout-group.sh b/tests/misc/timeout-group.sh
index d47f0dc..029048f 100755
--- a/tests/misc/timeout-group.sh
+++ b/tests/misc/timeout-group.sh
@@ -18,6 +18,8 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ timeout
+require_trap_signame_
+require_kill_group_
 
 # construct a program group hierarchy as follows:
 #  timeout-group - foreground group
@@ -66,8 +68,7 @@ setsid ./group.sh & pid=$!
 # Wait 6.3s for timeout.cmd to start
 retry_delay_ check_timeout_cmd_running .1 6 || fail=1
 # Simulate a Ctrl-C to the group to test timely exit
-# Note dash doesn't support signalling groups (a leading -)
-env kill -INT -- -$pid
+kill -INT -- -$pid
 wait
 test -e int.received || fail=1
 
diff --git a/tests/misc/timeout.sh b/tests/misc/timeout.sh
index 3cebd33..ec77d61 100755
--- a/tests/misc/timeout.sh
+++ b/tests/misc/timeout.sh
@@ -18,6 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ timeout
+require_trap_signame_
 
 # no timeout
 timeout 10 true || fail=1
@@ -50,8 +51,7 @@ test $? = 124 && fail=1
 # Ensure 'timeout' is immune to parent's SIGCHLD handler
 # 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=$(env kill -l CHLD 2>/dev/null) && trap '' $sig
+  trap '' CHLD
 
   exec timeout 10 true
 ) || fail=1
-- 
2.5.0


From dcae88c00962729db2978ab41007683394bbbfa9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Tue, 10 Nov 2015 12:59:40 +0000
Subject: [PATCH 2/3] maint: use standard spacing in shebang line in tests

It's better to be consistent even though spacing is insignificant:
http://www.in-ulm.de/~mascheck/various/shebang/#blankrequired
---
 tests/install/basic-1.sh        | 2 +-
 tests/install/create-leading.sh | 2 +-
 tests/misc/help-version.sh      | 2 +-
 tests/misc/nice.sh              | 2 +-
 tests/misc/stty-row-col.sh      | 2 +-
 tests/misc/stty.sh              | 2 +-
 tests/mv/into-self.sh           | 2 +-
 tests/mv/mv-special-1.sh        | 2 +-
 tests/no-perl                   | 2 +-
 tests/other-fs-tmpdir           | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/install/basic-1.sh b/tests/install/basic-1.sh
index db3b3c3..875211c 100755
--- a/tests/install/basic-1.sh
+++ b/tests/install/basic-1.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Basic tests for "install".
 
 # Copyright (C) 1998-2015 Free Software Foundation, Inc.
diff --git a/tests/install/create-leading.sh b/tests/install/create-leading.sh
index c9cb1dc..b994880 100755
--- a/tests/install/create-leading.sh
+++ b/tests/install/create-leading.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Test -D option.
 
 # Copyright (C) 2000-2015 Free Software Foundation, Inc.
diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh
index 7815037..29468ed 100755
--- a/tests/misc/help-version.sh
+++ b/tests/misc/help-version.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Make sure all of these programs work properly
 # when invoked with --help or --version.
 
diff --git a/tests/misc/nice.sh b/tests/misc/nice.sh
index 59316ec..7852df7 100755
--- a/tests/misc/nice.sh
+++ b/tests/misc/nice.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Test "nice".
 
 # Copyright (C) 2002-2015 Free Software Foundation, Inc.
diff --git a/tests/misc/stty-row-col.sh b/tests/misc/stty-row-col.sh
index 8c18df6..46fbeb1 100755
--- a/tests/misc/stty-row-col.sh
+++ b/tests/misc/stty-row-col.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Test "stty" with rows and columns.
 
 # Copyright (C) 1998-2015 Free Software Foundation, Inc.
diff --git a/tests/misc/stty.sh b/tests/misc/stty.sh
index 217891a..3f1304a 100755
--- a/tests/misc/stty.sh
+++ b/tests/misc/stty.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Make sure stty can parse most of its options.
 
 # Copyright (C) 1998-2015 Free Software Foundation, Inc.
diff --git a/tests/mv/into-self.sh b/tests/mv/into-self.sh
index 0a08154..9304a7a 100755
--- a/tests/mv/into-self.sh
+++ b/tests/mv/into-self.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Demonstrate how mv fails when it tries to move a directory into itself.
 
 # Copyright (C) 1998-2015 Free Software Foundation, Inc.
diff --git a/tests/mv/mv-special-1.sh b/tests/mv/mv-special-1.sh
index 0c649f0..44c6273 100755
--- a/tests/mv/mv-special-1.sh
+++ b/tests/mv/mv-special-1.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Test "mv" with special files.
 
 # Copyright (C) 1998-2015 Free Software Foundation, Inc.
diff --git a/tests/no-perl b/tests/no-perl
index 956a826..19cfcfb 100644
--- a/tests/no-perl
+++ b/tests/no-perl
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 # Perl is not available, the test should be considered skipped.
 # FD 9 should have been opened by the test suite harness, pointing
 # to the original stderr (usually, the user's terminal).
diff --git a/tests/other-fs-tmpdir b/tests/other-fs-tmpdir
index 22d8cca..d412051 100644
--- a/tests/other-fs-tmpdir
+++ b/tests/other-fs-tmpdir
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
 
 # Use stat to find a writable directory on a file system different from that
 # of the current directory.  If one is found, create a temporary directory
-- 
2.5.0


From f720844207e03f64502409f36be0693fee3ae676 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Tue, 10 Nov 2015 14:05:50 +0000
Subject: [PATCH 3/3] tests: ensure programs are built before testing

programs may not be built due to missing system dependencies,
or any program can be excluded at configure time with
--enable-no-install-program.  So ensure we're not testing the
system versions in these cases.

* init.cfg (print_ver_): Call require_built_ first.
* tests/misc/tty-eof.pl: Skip programs not built.
* tests/Coreutils.pm (run_tests): Likewise.
* tests/misc/ls-misc.pl: Use 'env test' rather than abs path.
* tests/misc/test-diag.pl: Likewise.
* tests/local.mk: Adjust include order for dependencies.
* tests/misc/arch.sh: Remove redundant calls to require_built_.
* tests/misc/chroot-fail.sh: Likewise.
* tests/misc/groups-dash.sh: Likewise.
* tests/misc/groups-version.sh: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/cp/acl.sh: Remove problematic call to print_ver_ [gs]etfacl.
* tests/mv/acl.sh: Likewise.
* cfg.mk (sc_env_test_dependencies): A new syntax check to enforce
specifying dependencies with print_ver_ for programs
specified through the env command.
* du/bigtime.sh: Add new print_ver_ dependencies.
* du/max-depth.sh: Likewise.
* dd/ascii.sh: Likewise.
* tests/ls/capability.sh: Likewise.
* tests/ls/root-rel-symlink-color.sh: Likewise.
* tests/misc/chroot-fail.sh: Likewise.
* tests/misc/readlink-fp-loop.sh: Likewise.
* tests/misc/sort-debug-keys.sh: Likewise.
* tests/readlink/can-e.sh: Likewise.
* tests/readlink/can-f.sh: Likewise.
* tests/readlink/can-m.sh: Likewise.
* tests/tail-2/inotify-race.sh: Likewise.
* tests/tail-2/inotify-race2.sh: Likewise.
* tests/touch/no-create-missing.sh: Likewise.
* tests/touch/no-dereference.sh: Likewise.
* tests/misc/printenv.sh: Tweak to avoid syntax check trigger.
* tests/misc/help-version.sh: Likewise.
* tests/misc/yes.sh: Likewise.
* tests/misc/printf-quote.sh: Use previously unused $prog.
* configure.ac (EXTRA_MANS): Add $gl_no_install_prog to the list
so that check-x-vs-1 syntax check is satisfied.
---
 cfg.mk                             | 14 ++++++++++++++
 configure.ac                       |  4 +++-
 init.cfg                           |  1 +
 tests/Coreutils.pm                 |  4 ++++
 tests/cp/acl.sh                    |  2 +-
 tests/dd/ascii.sh                  |  2 +-
 tests/du/bigtime.sh                |  1 +
 tests/du/max-depth.sh              |  1 +
 tests/local.mk                     |  2 +-
 tests/ls/capability.sh             |  2 +-
 tests/ls/root-rel-symlink-color.sh |  2 +-
 tests/misc/arch.sh                 |  2 --
 tests/misc/chroot-fail.sh          |  4 +---
 tests/misc/groups-dash.sh          |  1 -
 tests/misc/groups-version.sh       |  1 -
 tests/misc/help-version.sh         |  3 ++-
 tests/misc/ls-misc.pl              |  2 +-
 tests/misc/printenv.sh             |  2 +-
 tests/misc/printf-quote.sh         | 12 ++++++------
 tests/misc/readlink-fp-loop.sh     |  2 +-
 tests/misc/sort-debug-keys.sh      |  2 +-
 tests/misc/stdbuf.sh               |  1 -
 tests/misc/test-diag.pl            |  5 ++---
 tests/misc/tty-eof.pl              |  1 +
 tests/misc/yes.sh                  |  3 ++-
 tests/mv/acl.sh                    |  2 +-
 tests/readlink/can-e.sh            |  2 +-
 tests/readlink/can-f.sh            |  2 +-
 tests/readlink/can-m.sh            |  2 +-
 tests/tail-2/inotify-race.sh       |  2 +-
 tests/tail-2/inotify-race2.sh      |  2 +-
 tests/touch/no-create-missing.sh   |  2 +-
 tests/touch/no-dereference.sh      |  2 +-
 33 files changed, 55 insertions(+), 37 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index d6c4c9f..a204034 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -527,6 +527,20 @@ sc_prohibit_verbose_version:
 	halt='use the print_ver_ function instead...'			\
 	  $(_sc_search_regexp)
 
+# Enforce print_ver_ tracking of dependencies
+# Each coreutils specific program a test requires
+# should be tagged by calling through env(1).
+sc_env_test_dependencies:
+	@cd $(top_srcdir) && GIT_PAGER= git grep -E \
+	    "env ($$(build-aux/gen-lists-of-programs.sh --list-progs | \
+		grep -vF '[' |paste -d'|' -s))" tests | \
+	    sed "s/\([^:]\):.*env \([^)' ]*\).*/\1 \2/" | uniq | \
+	    while read test prog; do \
+	      printf '%s' $$test | grep -q '\.pl$$' && continue; \
+	      grep -q "print_ver_.* $$prog" $$test \
+		|| echo $$test should call: print_ver_ $$prog; \
+	    done | grep . && exit 1 || :
+
 # Use framework_failure_, not the old name without the trailing underscore.
 sc_prohibit_framework_failure:
 	@prohibit='\<framework_''failure\>'				\
diff --git a/configure.ac b/configure.ac
index fc1a052..66c8cbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -517,7 +517,9 @@ man1_MANS=`
 
 # Not installed by "make install", but must be built when creating
 # a distribution tarball.
-EXTRA_MANS=`for p in $no_install_progs_default; do echo man/$p.1; done`
+EXTRA_MANS=`for p in $no_install_progs_default $gl_no_install_prog; do
+              echo man/$p.1
+            done`
 
 # Replace all the programs by the single binary and symlinks if specified.
 single_binary_progs=
diff --git a/init.cfg b/init.cfg
index 6f5f80b..e4309ae 100644
--- a/init.cfg
+++ b/init.cfg
@@ -659,6 +659,7 @@ retry_delay_()
 # sourcing init.sh.
 print_ver_()
 {
+  require_built_ "$@"
   if test "$VERBOSE" = yes; then
     local i
     for i in $*; do
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index bd2088f..632960a 100644
--- a/tests/Coreutils.pm
+++ b/tests/Coreutils.pm
@@ -224,6 +224,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 $built_prog = ref $prog ? $$prog : $prog;
   my @prog = ref $prog ? (qw(env --), $$prog) : $prog;
 
   # Warn about empty t_spec.
@@ -271,6 +272,9 @@ sub run_tests ($$$$$)
     }
   return 1 if $bad_test_name;
 
+  $ENV{built_programs} =~ /\b$built_prog\b/ ||
+    CuSkip::skip "required program(s) not built [$built_prog]\n";
+
   # FIXME check exit status
   system (@prog, '--version') if $verbose;
 
diff --git a/tests/cp/acl.sh b/tests/cp/acl.sh
index e397ff0..591479c 100755
--- a/tests/cp/acl.sh
+++ b/tests/cp/acl.sh
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ cp getfacl setfacl
+print_ver_ cp
 
 require_acl_
 
diff --git a/tests/dd/ascii.sh b/tests/dd/ascii.sh
index be6494a..5f96a2d 100755
--- a/tests/dd/ascii.sh
+++ b/tests/dd/ascii.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ dd
+print_ver_ dd printf
 
 {
   # Two lines, EBCDIC " A A" and " A  ", followed by all the bytes in order.
diff --git a/tests/du/bigtime.sh b/tests/du/bigtime.sh
index 95fa193..990853e 100755
--- a/tests/du/bigtime.sh
+++ b/tests/du/bigtime.sh
@@ -17,6 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
 
 export LC_ALL=C
 export TZ=UTC0
diff --git a/tests/du/max-depth.sh b/tests/du/max-depth.sh
index 25ad468..3c0b0bc 100755
--- a/tests/du/max-depth.sh
+++ b/tests/du/max-depth.sh
@@ -17,6 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ du
 
 mkdir -p a/b/c/d/e || framework_failure_
 printf 'a/b/c\na/b\na\n' > exp || framework_failure_
diff --git a/tests/local.mk b/tests/local.mk
index f65f7bc..675607e 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -32,7 +32,7 @@ TESTSUITE_PERL = $(SHELL) $(srcdir)/no-perl
 endif
 
 # Options passed to the perl invocations running the perl test scripts.
-TESTSUITE_PERL_OPTIONS = -w -I$(srcdir)/tests -MCoreutils -MCuSkip
+TESTSUITE_PERL_OPTIONS = -w -I$(srcdir)/tests -MCuSkip -MCoreutils
 # '$f' is set by the Automake-generated test harness to the path of the
 # current test script stripped of VPATH components, and is used by the
 # CuTmpdir module to determine the name of the temporary files to be
diff --git a/tests/ls/capability.sh b/tests/ls/capability.sh
index bd32be2..2a85c7c 100755
--- a/tests/ls/capability.sh
+++ b/tests/ls/capability.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ ls
+print_ver_ ls printf
 require_root_
 
 grep '^#define HAVE_CAP 1' $CONFIG_HEADER > /dev/null \
diff --git a/tests/ls/root-rel-symlink-color.sh b/tests/ls/root-rel-symlink-color.sh
index 0b977fc..41ad342 100755
--- a/tests/ls/root-rel-symlink-color.sh
+++ b/tests/ls/root-rel-symlink-color.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ ls
+print_ver_ ls test
 
 symlink_to_rel=
 for i in /*; do
diff --git a/tests/misc/arch.sh b/tests/misc/arch.sh
index d5ae582..1c924a0 100755
--- a/tests/misc/arch.sh
+++ b/tests/misc/arch.sh
@@ -19,8 +19,6 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ arch
 
-require_built_ arch
-
 arch > out || fail=1
 uname -m > exp || fail=1
 
diff --git a/tests/misc/chroot-fail.sh b/tests/misc/chroot-fail.sh
index 14499ed..fe4178b 100755
--- a/tests/misc/chroot-fail.sh
+++ b/tests/misc/chroot-fail.sh
@@ -18,9 +18,7 @@
 
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ chroot
-
-require_built_ chroot
+print_ver_ chroot pwd
 
 # These tests verify exact status of internal failure; since none of
 # them actually run a command, we don't need root privileges
diff --git a/tests/misc/groups-dash.sh b/tests/misc/groups-dash.sh
index 8f7ec75..1d96743 100755
--- a/tests/misc/groups-dash.sh
+++ b/tests/misc/groups-dash.sh
@@ -18,7 +18,6 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ groups
-require_built_ groups
 
 # Coreutils 6.9 and earlier failed to display information on first argument
 # if later argument was --.
diff --git a/tests/misc/groups-version.sh b/tests/misc/groups-version.sh
index 4439443..f6de3f2 100755
--- a/tests/misc/groups-version.sh
+++ b/tests/misc/groups-version.sh
@@ -18,7 +18,6 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ groups
-require_built_ groups
 
 groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1
 id --version | sed '/^$/q' > exp || fail=1
diff --git a/tests/misc/help-version.sh b/tests/misc/help-version.sh
index 29468ed..1878ae9 100755
--- a/tests/misc/help-version.sh
+++ b/tests/misc/help-version.sh
@@ -213,7 +213,8 @@ id_setup () { args=-u; }
 
 # Use env to avoid invoking built-in sleep of Solaris 11's /bin/sh.
 kill_setup () {
-  env sleep 10m & pid=$!
+  external=env
+  $external sleep 10m & pid=$!
   args=$pid
 }
 
diff --git a/tests/misc/ls-misc.pl b/tests/misc/ls-misc.pl
index d389773..6932e4d 100755
--- a/tests/misc/ls-misc.pl
+++ b/tests/misc/ls-misc.pl
@@ -55,7 +55,7 @@ sub shell_quote($)
 # that cannot be done.
 sub setuid_setup()
 {
-  my $test = shell_quote "$ENV{abs_top_builddir}/src/test";
+  my $test = 'env test';
   system (qq(touch setuid && chmod u+s setuid && $test -u setuid &&
            touch setgid && chmod g+s setgid && $test -g setgid &&
            mkdir sticky && chmod +t sticky  && $test -k sticky &&
diff --git a/tests/misc/printenv.sh b/tests/misc/printenv.sh
index 862b48b..0be97e8 100755
--- a/tests/misc/printenv.sh
+++ b/tests/misc/printenv.sh
@@ -23,7 +23,7 @@ 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.
-# Note the apparently redundant "env env": this is to ensure to get
+# 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.
diff --git a/tests/misc/printf-quote.sh b/tests/misc/printf-quote.sh
index 73fc404..e618300 100755
--- a/tests/misc/printf-quote.sh
+++ b/tests/misc/printf-quote.sh
@@ -16,13 +16,13 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-prog='env printf'
-
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ printf
 
+prog='env printf'
+
 # Equivalent output to ls --quoting=shell-escape
-env printf '%q\n' '' "'" a 'a b' '~a' 'a~' "$(env printf %b 'a\r')" > out
+$prog '%q\n' '' "'" a 'a b' '~a' 'a~' "$($prog %b 'a\r')" > out
 cat <<\EOF > exp || framework_failure_
 ''
 ''\'''
@@ -40,11 +40,11 @@ f=$LOCALE_FR_UTF8
 if test "$LOCALE_FR_UTF8" != "none"; then
   (
    #printable multi-byte
-   LC_ALL=$f env printf '%q\n' 'áḃç' > out
+   LC_ALL=$f $prog '%q\n' 'áḃç' > out
    #non-printable multi-byte
-   LC_ALL=$f env printf '%q\n' "$(LC_ALL=$f env printf '\u0378')" >> out
+   LC_ALL=$f $prog '%q\n' "$(LC_ALL=$f $prog '\u0378')" >> out
    #printable multi-byte in C locale
-   LC_ALL=C env printf '%q\n' 'áḃç' >> out
+   LC_ALL=C $prog '%q\n' 'áḃç' >> out
   )
   cat <<\EOF > exp || framework_failure_
 áḃç
diff --git a/tests/misc/readlink-fp-loop.sh b/tests/misc/readlink-fp-loop.sh
index 50ada55..0e18fe7 100755
--- a/tests/misc/readlink-fp-loop.sh
+++ b/tests/misc/readlink-fp-loop.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ readlink
+print_ver_ readlink pwd
 cwd=$(env pwd -P)
 
 # To trigger this bug, we have to construct a name/situation during
diff --git a/tests/misc/sort-debug-keys.sh b/tests/misc/sort-debug-keys.sh
index 776fb67..a0a2874 100755
--- a/tests/misc/sort-debug-keys.sh
+++ b/tests/misc/sort-debug-keys.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ sort
+print_ver_ sort printf
 
 number() { cat -n | sed 's/^ *//'; }
 
diff --git a/tests/misc/stdbuf.sh b/tests/misc/stdbuf.sh
index 428d4a2..66b644b 100755
--- a/tests/misc/stdbuf.sh
+++ b/tests/misc/stdbuf.sh
@@ -20,7 +20,6 @@
 print_ver_ stdbuf
 
 getlimits_
-require_built_ stdbuf
 
 # stdbuf fails when the absolute top build dir name contains e.g.,
 # space, TAB, NL
diff --git a/tests/misc/test-diag.pl b/tests/misc/test-diag.pl
index f498d1a..c120509 100755
--- a/tests/misc/test-diag.pl
+++ b/tests/misc/test-diag.pl
@@ -23,7 +23,6 @@ use strict;
 # Turn off localization of executable's output.
 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
 
-my $prog = "$ENV{abs_top_builddir}/src/test";
 my @Tests =
     (
      # In coreutils-5.93, this diagnostic lacked the newline.
@@ -34,6 +33,6 @@ my @Tests =
 
 my $save_temps = $ENV{DEBUG};
 my $verbose = $ENV{VERBOSE};
-
-my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
+my $prog = 'test';
+my $fail = run_tests ($program_name, \$prog, \@Tests, $save_temps, $verbose);
 exit $fail;
diff --git a/tests/misc/tty-eof.pl b/tests/misc/tty-eof.pl
index c1b4b78..f7f5492 100755
--- a/tests/misc/tty-eof.pl
+++ b/tests/misc/tty-eof.pl
@@ -68,6 +68,7 @@ $@
     {
       my $exp = new Expect;
       $exp->log_user(0);
+      $ENV{built_programs} =~ /\b$cmd\b/ || next;
       $exp->spawn("$cmd 2> $stderr")
         or (warn "$ME: cannot run '$cmd': $!\n"), $fail=1, next;
       # No input for cut -f2.
diff --git a/tests/misc/yes.sh b/tests/misc/yes.sh
index 79f8b87..a5e8177 100755
--- a/tests/misc/yes.sh
+++ b/tests/misc/yes.sh
@@ -31,7 +31,8 @@ done
 
 # Check the many small items case,
 # both fitting and overflowing the internal buffer
-if env true $(seq 4000); then
+external=env
+if external true $(seq 4000); then
   for i in 100 4000; do
     seq $i | paste -s -d ' ' | sed p > out.1
     yes $(seq $i) | head -n2 > out.2
diff --git a/tests/mv/acl.sh b/tests/mv/acl.sh
index b09125c..d1471dc 100755
--- a/tests/mv/acl.sh
+++ b/tests/mv/acl.sh
@@ -18,7 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ mv getfacl setfacl
+print_ver_ mv
 
 require_acl_
 
diff --git a/tests/readlink/can-e.sh b/tests/readlink/can-e.sh
index 05f297b..eb49bc6 100755
--- a/tests/readlink/can-e.sh
+++ b/tests/readlink/can-e.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ readlink
+print_ver_ readlink pwd
 
 pwd=$(pwd)
 my_pwd=$(env pwd -P)
diff --git a/tests/readlink/can-f.sh b/tests/readlink/can-f.sh
index 4b25fc6..b157bbf 100755
--- a/tests/readlink/can-f.sh
+++ b/tests/readlink/can-f.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ readlink
+print_ver_ readlink pwd
 
 pwd=$(pwd)
 my_pwd=$(env pwd -P)
diff --git a/tests/readlink/can-m.sh b/tests/readlink/can-m.sh
index 2eb1356..0bcbd64 100755
--- a/tests/readlink/can-m.sh
+++ b/tests/readlink/can-m.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ readlink
+print_ver_ readlink pwd
 
 pwd=$(pwd)
 my_pwd=$(env pwd -P)
diff --git a/tests/tail-2/inotify-race.sh b/tests/tail-2/inotify-race.sh
index 4ce0508..546cb85 100755
--- a/tests/tail-2/inotify-race.sh
+++ b/tests/tail-2/inotify-race.sh
@@ -21,7 +21,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ tail
+print_ver_ tail sleep
 
 # Terminate any background gdb/tail process
 cleanup_() {
diff --git a/tests/tail-2/inotify-race2.sh b/tests/tail-2/inotify-race2.sh
index 1e01d50..78d8b54 100755
--- a/tests/tail-2/inotify-race2.sh
+++ b/tests/tail-2/inotify-race2.sh
@@ -20,7 +20,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ tail
+print_ver_ tail sleep
 
 # Terminate any background gdb/tail process
 cleanup_() {
diff --git a/tests/touch/no-create-missing.sh b/tests/touch/no-create-missing.sh
index 7ad1a3a..90ec6dc 100755
--- a/tests/touch/no-create-missing.sh
+++ b/tests/touch/no-create-missing.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ touch
+print_ver_ touch test
 
 
 touch -c no-file > /dev/null 2>&1 || fail=1
diff --git a/tests/touch/no-dereference.sh b/tests/touch/no-dereference.sh
index fc0c723..cddcbbe 100755
--- a/tests/touch/no-dereference.sh
+++ b/tests/touch/no-dereference.sh
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-print_ver_ touch
+print_ver_ touch test
 
 ln -s nowhere dangling || framework_failure_
 touch file || framework_failure_
-- 
2.5.0

Reply via email to