summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-06-23 17:59:04 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-06-23 18:08:46 -0400
commit1fe2438dd99b0355ed75991067ff201ec81910fc (patch)
treee0d043fe98d5755409a0b477704d638ebf0fef1f
parent3e0eb2892926b3cbcd95a08de8f4b06164c38d58 (diff)
downloadbfs-1fe2438dd99b0355ed75991067ff201ec81910fc.tar.xz
tests: New test for -depth in the presence of read errors
-rwxr-xr-xtests.sh18
-rw-r--r--tests/test_depth_error.out4
2 files changed, 22 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 16750b6..8f0f72c 100755
--- a/tests.sh
+++ b/tests.sh
@@ -176,6 +176,7 @@ posix_tests=(
test_depth_mindepth_2
test_depth_maxdepth_1
test_depth_maxdepth_2
+ test_depth_error
test_name
test_name_root
test_name_root_depth
@@ -620,6 +621,23 @@ function test_depth_maxdepth_2() {
bfs_diff basic -maxdepth 2 -depth
}
+function test_depth_error() {
+ rm -rf scratch/*
+ touchp scratch/foo/bar
+ touchp scratch/baz/qux
+ chmod -r scratch/foo
+ chmod -x scratch/baz
+
+ bfs_diff scratch -depth 2>/dev/null
+ local ret=$?
+
+ chmod +r scratch/foo
+ chmod +x scratch/baz
+ rm -rf scratch/*
+
+ return $ret
+}
+
function test_name() {
bfs_diff basic -name '*f*'
}
diff --git a/tests/test_depth_error.out b/tests/test_depth_error.out
new file mode 100644
index 0000000..fad4b28
--- /dev/null
+++ b/tests/test_depth_error.out
@@ -0,0 +1,4 @@
+scratch
+scratch/baz
+scratch/foo
+scratch/baz/qux