]> gitweb.michael.orlitzky.com - apply-default-acl.git/blobdiff - run-tests.sh
run-tests.sh: add tests for "./" and "../" as arguments, too.
[apply-default-acl.git] / run-tests.sh
index 923c19c6a3a9c222001270726af5d0fe392be253..cb04d47cf759f1d44205eb4fab66e4725320f9ad 100755 (executable)
@@ -259,7 +259,7 @@ ACTUAL=$(getfacl --omit-header "${TARGET}")
 compare
 
 
-# A slightly modified test #1 to make sure it works right.
+# A slightly modified version of the first test, to make sure it works.
 ((TESTNUM++))
 TARGET="${TESTDIR}"/foo
 touch "${TARGET}"
@@ -306,7 +306,7 @@ compare
 
 
 # The --recursive mode should work normally if the argument is a
-# normal file. See Test #1.
+# normal file. See the first test.
 ((TESTNUM++))
 TARGET="${TESTDIR}"/foo
 setfacl -d -m user::r--  "${TESTDIR}"
@@ -533,57 +533,6 @@ compare
 
 
 
-# Test #16's setup repeated with the --no-exec-mask flag.
-#
-((TESTNUM++))
-TARGET="${TESTDIR}"/foo
-touch "${TARGET}"
-chmod 644 "${TARGET}"
-# The directory allows execute for user, group, and other, so the file
-# should actually inherit them regardless of its initial mode when the
-# --no-exec-mask flag is passed.
-setfacl -d -m user:${USERS[0]}:rwx "${TESTDIR}"
-
-$BIN --no-exec-mask "${TARGET}"
-
-EXPECTED=$(cat <<EOF
-user::rwx
-user:${USERS[0]}:rwx
-group::r-x
-mask::rwx
-other::r-x
-EOF
-)
-
-ACTUAL=$(getfacl --omit-header "${TARGET}")
-compare
-
-
-
-# Test #20 repeated recursively to make sure the flags play nice
-# together.
-((TESTNUM++))
-PARENT_DIR="${TESTDIR}"/foo
-TARGET="${PARENT_DIR}"/bar
-mkdir "${PARENT_DIR}"
-touch "${TARGET}"
-chmod 644 "${TARGET}"
-setfacl -d -m user:${USERS[0]}:rwx "${TESTDIR}"
-
-$BIN --recursive --no-exec-mask "${PARENT_DIR}"
-
-EXPECTED=$(cat <<EOF
-user::rwx
-user:${USERS[0]}:rwx
-group::r-x
-mask::rwx
-other::r-x
-EOF
-)
-
-ACTUAL=$(getfacl --omit-header "${TARGET}")
-compare
-
 
 # Make sure a mask with an execute bit doesn't count as being
 # executable.
@@ -613,8 +562,8 @@ ACTUAL=$(getfacl --omit-header "${TARGET}")
 compare
 
 
-# Same as test #2, except we pass multiple files on the command
-# line and check the result of the first one.
+# Same as the second test, except we pass multiple files on the
+# command line and check the result of the first one.
 ((TESTNUM++))
 setfacl -d -m user::r--     "${TESTDIR}"
 setfacl -d -m group::r--    "${TESTDIR}"
@@ -676,12 +625,14 @@ ACTUAL=$( "${BIN}" test/nonexistent 2>&1 )
 EXPECTED="test/nonexistent: No such file or directory"
 compare
 
+
 # Same as the previous test, but with --recursive.
 ((TESTNUM++))
 ACTUAL=$( "${BIN}" --recursive test/nonexistent 2>&1 )
 EXPECTED="test/nonexistent: No such file or directory"
 compare
 
+
 # If we call apply-default-acl on more than one file, it should report any
 # that don't exist (but proceed to operate on the others).
 ((TESTNUM++))
@@ -712,8 +663,7 @@ EOF
 compare
 
 
-# Ensure that symlinks are not followed in subdirectories
-# (recursively).
+# Ensure that symlinks are not followed in subdirectories (recursively).
 ((TESTNUM++))
 TARGET="${TESTDIR}/bar"
 touch "${TARGET}"
@@ -916,3 +866,88 @@ EXPECTED="1"
 "${BIN}" --recursive "${TARGET}"
 ACTUAL=$?
 compare
+
+
+# Ensure that "." works as an argument.
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir "${TARGET}/foo"
+mkdir "${TARGET}/bar"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo" )
+pushd "${TARGET}/bar" > /dev/null
+"${BIN}" "."
+ACTUAL=$( getfacl --omit-header "." )
+popd > /dev/null
+compare
+
+# Ensure that "." works as an argument (recursive).
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir -p "${TARGET}/foo/baz"
+mkdir -p "${TARGET}/bar/baz"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" --recursive "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo/baz" )
+pushd "${TARGET}/bar" > /dev/null
+"${BIN}" --recursive "."
+ACTUAL=$( getfacl --omit-header "./baz" )
+popd > /dev/null
+compare
+
+# Ensure that "./" works as an argument.
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir "${TARGET}/foo"
+mkdir "${TARGET}/bar"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo" )
+pushd "${TARGET}/bar" > /dev/null
+"${BIN}" "./"
+ACTUAL=$( getfacl --omit-header "./" )
+popd > /dev/null
+compare
+
+# Ensure that ".." works as an argument.
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir "${TARGET}/foo"
+mkdir -p "${TARGET}/bar/baz"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo" )
+pushd "${TARGET}/bar/baz" > /dev/null
+"${BIN}" ".."
+ACTUAL=$( getfacl --omit-header ".." )
+popd > /dev/null
+compare
+
+# Ensure that ".." works as an argument (recursive).
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir -p "${TARGET}/foo/baz"
+mkdir -p "${TARGET}/bar/baz"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" --recursive "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo/baz" )
+pushd "${TARGET}/bar/baz" > /dev/null
+"${BIN}" --recursive ".."
+ACTUAL=$( getfacl --omit-header "." )
+popd > /dev/null
+compare
+
+# Ensure that "../" works as an argument.
+((TESTNUM++))
+TARGET="${TESTDIR}"
+mkdir "${TARGET}/foo"
+mkdir -p "${TARGET}/bar/baz"
+setfacl --default --modify user:${USERS[0]}:rw "${TARGET}"
+"${BIN}" "${TARGET}/foo"
+EXPECTED=$( getfacl --omit-header "${TARGET}/foo" )
+pushd "${TARGET}/bar/baz" > /dev/null
+"${BIN}" "../"
+ACTUAL=$( getfacl --omit-header "../" )
+popd > /dev/null
+compare