diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2015-11-28 11:26:51 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-11-28 11:26:51 -0500 |
commit | f81be72020a886b5eca21bc1d8a5b0d62b9954d9 (patch) | |
tree | 0857734c416768778dd27b7b87b12c417594ea62 /tests.sh | |
parent | 85bb6db3e14a38a2b9c6085e806873aeeacc9b95 (diff) | |
download | bfs-f81be72020a886b5eca21bc1d8a5b0d62b9954d9.tar.xz |
Implement -executable, -readable, and -writable.
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -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" |