summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/cp/perm3
-rwxr-xr-xtests/du/2g6
-rwxr-xr-xtests/tail-2/assert2
-rwxr-xr-xtests/tail-2/assert-22
-rw-r--r--tests/test-lib.sh13
-rw-r--r--tests/very-expensive11
8 files changed, 29 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index c0b974308..d00ab45de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -564,6 +564,15 @@
2007-11-30 Jim Meyering <meyering@redhat.com>
+ Move the very-expensive file into test-lib.sh.
+ * tests/very-expensive: Remove file.
+ * tests/test-lib.sh (very_expensive_): New function.
+ * tests/Makefile.am (EXTRA_DIST): Remove very-expensive.
+ * tests/cp/perm: Call the new function, rather than sourcing the file.
+ * tests/tail-2/assert: Likewise.
+ * tests/tail-2/assert-2: Likewise.
+ * tests/du/2g: Likewise.
+
Avoid a spurious test failure when build directory is set-GID.
* tests/cp/fail-perm: Ensure that '.'s set-GID bit is off.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d060c5b86..ede631065 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,8 +27,7 @@ EXTRA_DIST = \
sparse-file \
strace \
test-lib.sh \
- umask-check \
- very-expensive
+ umask-check
# Regarding ordering in SUBDIRS, place early in the list the tools that
# are most commonly used in test scripts. Every test script uses rm
diff --git a/tests/cp/perm b/tests/cp/perm
index 88052aa02..a31d430e0 100755
--- a/tests/cp/perm
+++ b/tests/cp/perm
@@ -16,8 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. $srcdir/../very-expensive
-
if test "$VERBOSE" = yes; then
set -x
cp --version
@@ -25,6 +23,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../test-lib.sh
+very_expensive_
umask 037
diff --git a/tests/du/2g b/tests/du/2g
index ea2d6c784..a19b8ab4f 100755
--- a/tests/du/2g
+++ b/tests/du/2g
@@ -23,11 +23,11 @@ if test "$VERBOSE" = yes; then
du --version
fi
-# Creating a 2GB file counts as `very expensive'.
-. $srcdir/../very-expensive
-
. $srcdir/../test-lib.sh
+# Creating a 2GB file counts as `very expensive'.
+very_expensive_
+
fail=0
# Get number of free kilobytes on current partition, so we can
diff --git a/tests/tail-2/assert b/tests/tail-2/assert
index 72ee9c933..2ab617e77 100755
--- a/tests/tail-2/assert
+++ b/tests/tail-2/assert
@@ -29,8 +29,8 @@ if test "$VERBOSE" = yes; then
fi
# Not "expensive" per se, but sleeping for so long is annoying.
-. $srcdir/../very-expensive
. $srcdir/../test-lib.sh
+very_expensive_
ok='ok ok ok'
diff --git a/tests/tail-2/assert-2 b/tests/tail-2/assert-2
index 090bf0ff9..2911878a1 100755
--- a/tests/tail-2/assert-2
+++ b/tests/tail-2/assert-2
@@ -24,8 +24,8 @@ if test "$VERBOSE" = yes; then
fi
# Not "expensive" per se, but sleeping for so long is annoying.
-. $srcdir/../very-expensive
. $srcdir/../test-lib.sh
+very_expensive_
ok='ok ok ok'
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index cfc386a1a..3b8d2ce98 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -87,6 +87,19 @@ require_selinux_()
esac
}
+very_expensive_()
+{
+ if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then
+ skip_test_ '
+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.,
+
+ env RUN_VERY_EXPENSIVE_TESTS=yes make check
+'
+ fi
+}
+
skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
error_() { echo "$0: $@" 1>&2; (exit 1); exit 1; }
framework_failure() { error_ 'failure in testing framework'; }
diff --git a/tests/very-expensive b/tests/very-expensive
deleted file mode 100644
index 3e27c0bed..000000000
--- a/tests/very-expensive
+++ /dev/null
@@ -1,11 +0,0 @@
-if test "$RUN_VERY_EXPENSIVE_TESTS" != yes; then
- cat <<EOF >&2
-$0: 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.,
-
- env RUN_VERY_EXPENSIVE_TESTS=yes make check
-
-EOF
- (exit 77); exit 77
-fi