aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/cp.test16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/cp.test b/tests/cp.test
index 9ee6cd0e..6c798b4b 100755
--- a/tests/cp.test
+++ b/tests/cp.test
@@ -2,6 +2,9 @@
[ -f testing.sh ] && . testing.sh
+OLDUMASK=$(umask)
+umask 0002
+
# Create test file
dd if=/dev/urandom of=random bs=64 count=1 2> /dev/null
@@ -35,17 +38,20 @@ rm -rf two three walrus
touch two
chmod 000 two
-testing "file->inaccessable [fail]" \
+skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
+testing "file->inaccessible [fail]" \
"cp random two 2>/dev/null || echo yes" "yes\n" "" ""
rm -f two
touch two
chmod 000 two
-testing "-f file->inaccessable" \
+skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
+testing "-f file->inaccessible" \
"cp -f random two && cmp random two && echo yes" "yes\n" "" ""
mkdir sub
chmod 000 sub
-testing "file->inaccessable_dir [fail]" \
+skipnot [ $(id -u) -ne 0 ] # Root doesn't count.
+testing "file->inaccessible_dir [fail]" \
"cp random sub 2>/dev/null || echo yes" "yes\n" "" ""
rm two
rmdir sub
@@ -101,9 +107,9 @@ rm -rf one one_
touch walrus
chmod 644 walrus
ln -s walrus woot
-
testing "symlink dest permissions" "cp woot carpenter && stat -c %A carpenter" \
"-rw-r--r--\n" "" ""
+rm -rf walrus woot carpenter
# cp -r ../source destdir
# cp -r one/two/three missing
@@ -114,3 +120,5 @@ testing "symlink dest permissions" "cp woot carpenter && stat -c %A carpenter" \
# Make sure it's truncating existing file
# copy with -d at top level, with -d in directory, without -d at top level,
# without -d in directory
+
+umask $OLDUMASK