summaryrefslogtreecommitdiff
path: root/tests/cp/fail-perm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cp/fail-perm')
-rwxr-xr-xtests/cp/fail-perm29
1 files changed, 8 insertions, 21 deletions
diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm
index 31b4cb3ad..0ed9166f4 100755
--- a/tests/cp/fail-perm
+++ b/tests/cp/fail-perm
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 Free Software
+# Copyright (C) 2000, 2002-2007 Free Software
# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -23,25 +23,12 @@ fi
. $srcdir/../lang-default
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/D || framework_failure=1
-touch D/a || framework_failure=1
-chmod 0 D/a || framework_failure=1
-chmod u=rx,go=,-st D || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+mkdir D D/D || framework_failure
+touch D/a || framework_failure
+chmod 0 D/a || framework_failure
+chmod u=rx,go=,-st D || framework_failure
fail=0
@@ -66,11 +53,11 @@ cp F symlink 2> out && fail=1
# ...: The file access permissions do not allow the specified action.
# to the expected one:
sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
-cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
+compare out exp || fail=1
cp --target-directory=symlink F 2> out && fail=1
sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
-cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
+compare out exp || fail=1
chmod 700 D