summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2015-11-28 11:26:51 -0500
committerTavian Barnes <tavianator@tavianator.com>2015-11-28 11:26:51 -0500
commitf81be72020a886b5eca21bc1d8a5b0d62b9954d9 (patch)
tree0857734c416768778dd27b7b87b12c417594ea62 /tests.sh
parent85bb6db3e14a38a2b9c6085e806873aeeacc9b95 (diff)
downloadbfs-f81be72020a886b5eca21bc1d8a5b0d62b9954d9.tar.xz
Implement -executable, -readable, and -writable.
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests.sh b/tests.sh
index 060448b..90ef066 100755
--- a/tests.sh
+++ b/tests.sh
@@ -18,6 +18,16 @@ function basic_structure() {
touchp "$1/l/foo/bar/baz"
}
+# Creates a file+directory structure with various permissions for tests
+function perms_structure() {
+ install -Dm444 /dev/null "$1/r"
+ install -Dm222 /dev/null "$1/w"
+ install -Dm644 /dev/null "$1/rw"
+ install -Dm555 /dev/null "$1/rx"
+ install -Dm311 /dev/null "$1/wx"
+ install -Dm755 /dev/null "$1/rwx"
+}
+
# Checks for any (order-independent) differences between bfs and find
function find_diff() {
diff -u <(./bfs "$@" | sort) <(find "$@" | sort)
@@ -80,7 +90,22 @@ function test_0011() {
find_diff "$1" -path "$1/*f*"
}
-for i in {1..11}; do
+function test_0012() {
+ perms_structure "$1"
+ find_diff "$1" -executable
+}
+
+function test_0013() {
+ perms_structure "$1"
+ find_diff "$1" -readable
+}
+
+function test_0014() {
+ perms_structure "$1"
+ find_diff "$1" -writable
+}
+
+for i in {1..14}; do
dir="$(mktemp -d "${TMPDIR:-/tmp}"/bfs.XXXXXXXXXX)"
test="test_$(printf '%04d' $i)"
"$test" "$dir"