summaryrefslogtreecommitdiff
path: root/tests/rmdir
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-09-12 14:52:26 +0200
committerJim Meyering <jim@meyering.net>2007-09-15 08:40:39 +0200
commita669dfdabb3fa1be2e1367d53a797d495e7bd5c9 (patch)
treec88d6414649f7f4f5571138e193c72da44a03876 /tests/rmdir
parent0539705768992ebcc290bc859f64e27898c7f958 (diff)
downloadcoreutils-a669dfdabb3fa1be2e1367d53a797d495e7bd5c9.tar.xz
More misc, test-related changes. (some to allow running tests as root)
Diffstat (limited to 'tests/rmdir')
-rw-r--r--tests/rmdir/Makefile.am2
-rwxr-xr-xtests/rmdir/fail-perm21
-rwxr-xr-xtests/rmdir/ignore26
-rwxr-xr-xtests/rmdir/t-slash17
4 files changed, 19 insertions, 47 deletions
diff --git a/tests/rmdir/Makefile.am b/tests/rmdir/Makefile.am
index eadbaba33..54e305142 100644
--- a/tests/rmdir/Makefile.am
+++ b/tests/rmdir/Makefile.am
@@ -9,3 +9,5 @@ TESTS_ENVIRONMENT = \
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
PROG=rmdir
+
+include $(top_srcdir)/tests/check.mk
diff --git a/tests/rmdir/fail-perm b/tests/rmdir/fail-perm
index acc5fe556..51e4cf7f7 100755
--- a/tests/rmdir/fail-perm
+++ b/tests/rmdir/fail-perm
@@ -2,7 +2,7 @@
# For unwritable directory `d', `rmdir -p d d/e/f' would emit
# diagnostics but would not fail. Fixed in 5.1.2.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006, 2007 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
@@ -22,23 +22,10 @@ if test "$VERBOSE" = yes; then
rmdir --version
fi
-PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir d d/e d/e/f || framework_failure=1
-chmod a-w d || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir d d/e d/e/f || framework_failure
+chmod a-w d || framework_failure
fail=0
diff --git a/tests/rmdir/ignore b/tests/rmdir/ignore
index 5b6a6bc3e..5acc786cb 100755
--- a/tests/rmdir/ignore
+++ b/tests/rmdir/ignore
@@ -1,7 +1,7 @@
#!/bin/sh
# make sure rmdir's --ignore-fail-on-non-empty option works
-# Copyright (C) 1999 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2007 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
@@ -21,23 +21,17 @@ if test "$VERBOSE" = yes; then
rmdir --version
fi
-tmp=rmdir.$$
-trap "rm -rf $tmp" 0 1 2 3 15
+. $srcdir/../test-lib.sh
-test_failure=0
-mkdir -p $tmp/a/b $tmp/x || test_failure=1
-
-if test $test_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- exit 1
-fi
+cwd=`pwd`
+mkdir -p $cwd/a/b $cwd/x || framework_failure
fail=0
-rmdir -p --ignore-fail-on-non-empty $tmp/a/b || fail=1
-# $tmp/x should remain
-test -d $tmp/x || fail=1
-# $tmp/{a,b} should be gone
-test -d $tmp/a && fail=1
-test -d $tmp/a/b && fail=1
+rmdir -p --ignore-fail-on-non-empty $cwd/a/b || fail=1
+# $cwd/x should remain
+test -d $cwd/x || fail=1
+# $cwd/{a,b} should be gone
+test -d $cwd/a && fail=1
+test -d $cwd/a/b && fail=1
exit $fail
diff --git a/tests/rmdir/t-slash b/tests/rmdir/t-slash
index e85cbd081..4453f1606 100755
--- a/tests/rmdir/t-slash
+++ b/tests/rmdir/t-slash
@@ -1,7 +1,7 @@
#!/bin/sh
# make sure rmdir -p works on a directory specified with a trailing slash
-# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006, 2007 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
@@ -21,20 +21,9 @@ if test "$VERBOSE" = yes; then
rmdir --version
fi
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir dir || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir dir || framework_failure
fail=0