tests: when skipping a test, say why on screen, not just in the log
authorJim Meyering <meyering@redhat.com>
Fri, 27 Feb 2009 08:12:14 +0000 (09:12 +0100)
committerJim Meyering <meyering@redhat.com>
Mon, 2 Mar 2009 08:35:12 +0000 (09:35 +0100)
* tests/test-lib.sh: Redirect also to descriptor 9.
Better one-line why-skip diagnostics.
* tests/check.mk (TESTS_ENVIRONMENT): Redirect 9 to stderr.
* tests/misc/pwd-unreadable-parent: Remove redundant "skipping..." diag.

tests/check.mk
tests/misc/pwd-unreadable-parent
tests/test-lib.sh

index 527e505..db5f900 100644 (file)
@@ -1,5 +1,5 @@
 # Include this file at the end of each tests/*/Makefile.am.
-# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -52,6 +52,7 @@ TESTS_ENVIRONMENT =                           \
   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.;        \
   . $(srcdir)/envvar-check;                    \
   TMPDIR=$$tmp__; export TMPDIR;               \
+  exec 9>&2;                                   \
   shell_or_perl_() {                           \
     if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                        \
       if $(PERL) -e 'use warnings' > /dev/null 2>&1; then              \
index c79daad..f5c7ae2 100755 (executable)
@@ -3,7 +3,7 @@
 # is unreadable.  Perform this test only on systems with a usable getcwd
 # function that has this capability.
 
-# Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ test $host_os != linux-gnu &&
 # Linux ia64 has the gl_FUNC_GETCWD_ABORT_BUG, so we can't use
 # the system getcwd.
 test $REPLACE_GETCWD = 1 &&
-  skip_test_ "can't use buggy system getcwd; skipping this test"
+  skip_test_ "can't use buggy system getcwd"
 
 mkdir -p a/b || framework_failure
 cd a/b || framework_failure
index cf90b44..b3aaf65 100644 (file)
@@ -25,6 +25,7 @@ fi
 
 skip_test_()
 {
+  echo "$0: skipping test: $@" | head -1 1>&9
   echo "$0: skipping test: $@" 1>&2
   Exit 77
 }
@@ -85,9 +86,10 @@ require_controlling_input_terminal_()
   tty -s || have_input_tty=no
   test -t 0 || have_input_tty=no
   if test "$have_input_tty" = no; then
-    skip_test_ "This test must have a controlling input \`terminal'," \
-      "so it may not be run via \`batch', \`at', or \`rsh'." \
-      "On some systems, it may not even be run in the background."
+    skip_test_ 'requires controlling input terminal
+This test must have a controlling input "terminal", so it may not be
+run via "batch", "at", or "ssh".  On some systems, it may not even be
+run in the background.'
   fi
 }
 
@@ -175,7 +177,7 @@ require_selinux_()
 very_expensive_()
 {
   if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then
-    skip_test_ '
+    skip_test_ 'very expensive: disabled by default
 This test is very expensive, so it is disabled by default.
 To run it anyway, rerun make check with the RUN_VERY_EXPENSIVE_TESTS
 environment variable set to yes.  E.g.,
@@ -188,7 +190,7 @@ environment variable set to yes.  E.g.,
 expensive_()
 {
   if test "$RUN_EXPENSIVE_TESTS" != yes; then
-    skip_test_ '
+    skip_test_ 'expensive: disabled by default
 This test is relatively expensive, so it is disabled by default.
 To run it anyway, rerun make check with the RUN_EXPENSIVE_TESTS
 environment variable set to yes.  E.g.,
@@ -217,8 +219,8 @@ require_membership_in_two_groups_()
   groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`}
   case "$groups" in
     *' '*) ;;
-    *) skip_test_ '
-$0: this test requires that you be a member of more than one group,
+    *) skip_test_ 'requires membership in two groups
+this test requires that you be a member of more than one group,
 but running `id -G'\'' either failed or found just one.  If you really
 are a member of at least two groups, then rerun this test with
 COREUTILS_GROUPS set in your environment to the space-separated list