summaryrefslogtreecommitdiff
path: root/tests/init.sh
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-06-14 09:59:14 +0200
committerJim Meyering <meyering@redhat.com>2011-06-14 11:05:05 +0200
commit6b687452d8c08a1b00f53402caf651229cdb0c51 (patch)
tree9cb5b35b0216c2d3c75c980216832bb4b0450832 /tests/init.sh
parentef6e57b24b51f247119a83be6c81c6a8a30b87a4 (diff)
downloadcoreutils-6b687452d8c08a1b00f53402caf651229cdb0c51.tar.xz
tests: accommodate HP-UX and ksh-derived shells
Running "make check" normally prints a diagnostic to the outermost stderr (usually a tty) to explain why a test is skipped. It did this by redirecting FD 9 to stderr (via "exec 9>&2") before invoking the shell script. Shell scripts write skip-explanation to FD 9 via init.sh's skip_ function. However, with ksh and HP-UX's /bin/sh, the effects of "exec 9>&2" are canceled upon fork-and-exec, so we would get a "Bad file number" diagnostic and no skip explanation on those systems. * tests/check.mk (TESTS_ENVIRONMENT): Redirect more portably, via "$(SHELL) 9>&2", rather than the prior "exec 9>&2; $(SHELL) ..." Actually, we use "shell_or_perl_ 9>&2", to make this effective also for the perl-based tests. * tests/init.sh (stderr_fileno_): Update the advice in comments. See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488 for lots of discussion. Stefano Lattarini suggested the solution of putting "9>&2" after the command. Reported by Bruno Haible.
Diffstat (limited to 'tests/init.sh')
-rw-r--r--tests/init.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/init.sh b/tests/init.sh
index 60d1bc118..4a5262630 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -68,8 +68,8 @@ Exit () { set +e; (exit $1); exit $1; }
# Print warnings (e.g., about skipped and failed tests) to this file number.
# Override by defining to say, 9, in init.cfg, and putting say,
-# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition
-# of TESTS_ENVIRONMENT in your tests/Makefile.am file.
+# export ...ENVVAR_SETTINGS...; $(SHELL) 9>&2
+# in the definition of TESTS_ENVIRONMENT in your tests/Makefile.am file.
# This is useful when using automake's parallel tests mode, to print
# the reason for skip/failure to console, rather than to the .log files.
: ${stderr_fileno_=2}