[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1..4] tests: when skipping a test, say why on screen, not just in
From: |
Jim Meyering |
Subject: |
[PATCH 1..4] tests: when skipping a test, say why on screen, not just in the log |
Date: |
Mon, 02 Mar 2009 18:46:00 +0100 |
Before, 'make check's tty output wouldn't say why a test was being
skipped. Now it does. That has exposed a few tests that were being
skipped mistakenly. These changes reenable the first few.
>From 1c7d5b58476d5bf5ab8db5d025b7d0820611aae7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Feb 2009 09:12:14 +0100
Subject: [PATCH 1/4] 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(-)
diff --git a/tests/check.mk b/tests/check.mk
index 527e505..db5f900 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 c79daad..f5c7ae2 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 cf90b44..b3aaf65 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
--
1.6.2.rc1.285.gc5f54
>From 0433f90e3d388734888dad17f5fc2f106c59faf4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Feb 2009 09:16:45 +0100
Subject: [PATCH 2/4] tests: reflect the s/+/./ SELinux indicator change
* tests/mkdir/perm: Now that this test is no longer always skipped,
make it work independently of ls: use stat, not ls, to get perm string.
* test-lib.sh (rwx_to_mode_): Use stat, not ls to get perm string
This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set.
---
tests/mkdir/perm | 6 +++---
tests/test-lib.sh | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/mkdir/perm b/tests/mkdir/perm
index 2f8715b..2f12d07 100755
--- a/tests/mkdir/perm
+++ b/tests/mkdir/perm
@@ -2,7 +2,7 @@
# Verify that mkdir's `-m MODE' option works properly
# with various umask settings.
-# Copyright (C) 2000, 2002-2008 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002-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
@@ -72,11 +72,11 @@ for p in empty -p; do
mkdir $p $mode parent/sub || fail=1
- perms=`ls -ld parent | sed 's/ .*//; s/+$//'`
+ perms=$(stat --printf %A parent)
test "$parent_perms" = "$perms" \
|| { fail=1; echo parent: expected $parent_perms, got $perms; }
- perms=`ls -ld parent/sub | sed 's/ .*//; s/+$//'`
+ perms=$(stat --printf %A parent/sub)
test "$sub_perms" = "$perms" \
|| { fail=1; echo parent/sub: expected $sub_perms, got $perms; }
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index b3aaf65..45026f1 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -136,7 +136,7 @@ rwx_to_mode_()
case $rwx in
[ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-]) ;;
- [ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-]+) ;;
+ [ld-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxsS-][rwx-][rwx-][rwxtT-][+.]) ;;
*) echo "$0: invalid mode string: $rwx" 1>&2; return;;
esac
--
1.6.2.rc1.285.gc5f54
>From 8c4f28b1242badb046f1a65942314420637d5cb7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Feb 2009 09:09:18 +0100
Subject: [PATCH 3/4] tests: don't skip setgid-dir related tests on
SELinux-enabled systems
* tests/setgid-check: The change in ls (use ".", not "+") caused
this check always to report the working directory as set-gid.
Now, use stat, not ls.
---
tests/setgid-check | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/tests/setgid-check b/tests/setgid-check
index 9fca2b7..cf26184 100644
--- a/tests/setgid-check
+++ b/tests/setgid-check
@@ -2,7 +2,7 @@
# Disable the current test if the working directory seems to have
# the setgid bit set.
-# Copyright (C) 2000, 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2004, 2005, 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
@@ -24,12 +24,11 @@ cwd_is_setgid=no
setgid_tmpdir=setgid-$$
(umask 77; mkdir $setgid_tmpdir)
-p=`ls -ld $setgid_tmpdir|sed 's/ .*//'`
+perms=$(stat --printf %A $setgid_tmpdir)
rmdir $setgid_tmpdir
-case $p in
+case $perms in
drwx------);;
- drwx------+);;
- drwxr-xr-x);; # Windows98 + DJGPP 2.03 + fileutils-4.1 does this.
+ drwxr-xr-x);; # Windows98 + DJGPP 2.03
*) cwd_is_setgid=yes;;
esac
if test $cwd_is_setgid = yes; then
--
1.6.2.rc1.285.gc5f54
>From 2b1e6636beab4d16ade9685175568d12bafeee9d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Feb 2009 12:54:01 +0100
Subject: [PATCH 4/4] tests: rm/ext3-perf: relax this test
* tests/rm/ext3-perf: If set-up takes too long, use the set-up time
as the removal time limit. Otherwise, a parallel "make check" would
usually fail when run with RUN_VERY_EXPENSIVE_TESTS=yes.
---
tests/rm/ext3-perf | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/tests/rm/ext3-perf b/tests/rm/ext3-perf
index b6467ef..6ca87a0 100755
--- a/tests/rm/ext3-perf
+++ b/tests/rm/ext3-perf
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that "rm -rf DIR-with-many-entries" is not O(N^2)
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-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
@@ -67,6 +67,11 @@ test $ok = 1 || framework_failure
setup_duration=$(expr $(date +%s) - $start)
echo creating a $n-entry directory took $setup_duration seconds
+# If set-up took longer than the default $threshold_seconds,
+# use the longer set-up duration as the limit.
+test $threshold_seconds -lt $setup_duration \
+ threshold_seconds=$setup_duration
+
fail=0
start=$(date +%s)
timeout ${threshold_seconds}s rm -rf d; err=$?
--
1.6.2.rc1.285.gc5f54
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 1..4] tests: when skipping a test, say why on screen, not just in the log,
Jim Meyering <=