From f81be72020a886b5eca21bc1d8a5b0d62b9954d9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 28 Nov 2015 11:26:51 -0500 Subject: Implement -executable, -readable, and -writable. --- tests.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests.sh') 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" -- cgit v1.2.3