From 1c7d5b58476d5bf5ab8db5d025b7d0820611aae7 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 27 Feb 2009 09:12:14 +0100 Subject: tests: when skipping a test, say why on screen, not just in the log * 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 | 3 ++- tests/misc/pwd-unreadable-parent | 4 ++-- tests/test-lib.sh | 16 +++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/check.mk b/tests/check.mk index 527e50581..db5f90093 100644 --- a/tests/check.mk +++ b/tests/check.mk @@ -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 \ diff --git a/tests/misc/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent index c79daad0c..f5c7ae237 100755 --- a/tests/misc/pwd-unreadable-parent +++ b/tests/misc/pwd-unreadable-parent @@ -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 diff --git a/tests/test-lib.sh b/tests/test-lib.sh index cf90b446b..b3aaf65db 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -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 -- cgit v1.2.3-70-g09d2