summaryrefslogtreecommitdiff
path: root/tests/rm/fail-eperm
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-07-18 09:12:23 +0000
committerJim Meyering <jim@meyering.net>2003-07-18 09:12:23 +0000
commitc42d31bc781550121dca4d836470b11fbed3e0ed (patch)
tree159b3ca08a9501b10155b4890f60c4c3d41be3c4 /tests/rm/fail-eperm
parent10c48512f081b0be233ba6c17455e91333d4dcf5 (diff)
downloadcoreutils-c42d31bc781550121dca4d836470b11fbed3e0ed.tar.xz
Use $srcdir/../priv-check, create a temporary
directory, and remove Perl-coded `you may not run as root' test.
Diffstat (limited to 'tests/rm/fail-eperm')
-rwxr-xr-xtests/rm/fail-eperm28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm
index 2e4d64cb3..6e6feb641 100755
--- a/tests/rm/fail-eperm
+++ b/tests/rm/fail-eperm
@@ -3,6 +3,27 @@
# Ensure that rm gives the expected diagnostic when failing to remove a file
# owned by some other user in a directory with the sticky bit set.
+if test "$VERBOSE" = yes; then
+ set -x
+ rm --version
+fi
+
+PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+
+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
+
+if test $framework_failure = 1; then
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+fi
+
: ${PERL=perl}
: ${srcdir=.}
@@ -28,13 +49,6 @@ $verbose
# Ensure that the diagnostics are in English.
$ENV{LC_ALL} = 'C';
-# Ensure that the effective UID is not 0.
-if ($> == 0)
- {
- warn "$ME: you may not run this test as root; skipping it.\n";
- exit 77;
- }
-
my @dir_list = qw(/tmp /var/tmp /usr/tmp);
# Find a directory with the sticky bit set.