summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-06-04 16:40:31 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-06-04 16:40:31 -0400
commit597aa41a5c1fc8f51e45dfc095eaf1aa99821bca (patch)
tree73ab49920b375e43ccfa14c6beeee8e6694d97d1 /tests
parent0410d8ee2575158686767ae0b0a7ad46d1ea54eb (diff)
downloadbfs-597aa41a5c1fc8f51e45dfc095eaf1aa99821bca.tar.xz
tests: New inaccessible/ directory tree for permission errors
Diffstat (limited to 'tests')
-rw-r--r--tests/bfs/xtype_depth.sh9
-rw-r--r--tests/bfs/xtype_reorder.sh3
-rw-r--r--tests/common/empty_error.out4
-rw-r--r--tests/common/empty_error.sh8
-rw-r--r--tests/posix/depth_error.out6
-rw-r--r--tests/posix/depth_error.sh8
-rw-r--r--tests/posix/prune_error.out2
-rw-r--r--tests/posix/prune_error.sh9
-rw-r--r--tests/stddirs.sh7
9 files changed, 18 insertions, 38 deletions
diff --git a/tests/bfs/xtype_depth.sh b/tests/bfs/xtype_depth.sh
index 93c4fb7..4683764 100644
--- a/tests/bfs/xtype_depth.sh
+++ b/tests/bfs/xtype_depth.sh
@@ -1,9 +1,2 @@
-cd "$TEST"
-"$XTOUCH" -p foo/bar
-ln -s foo/bar baz
-
-chmod a-rx foo
-defer chmod +rx foo
-
# Make sure -xtype is considered side-effecting for facts_when_impure
-! invoke_bfs . -xtype l -depth 100
+! invoke_bfs inaccessible/link -xtype l -depth 100
diff --git a/tests/bfs/xtype_reorder.sh b/tests/bfs/xtype_reorder.sh
index 8d75d7d..c1d94f3 100644
--- a/tests/bfs/xtype_reorder.sh
+++ b/tests/bfs/xtype_reorder.sh
@@ -1,4 +1,3 @@
# Make sure -xtype is not reordered in front of anything -- if -xtype runs
# before -links 100, it will report an ELOOP error
-bfs_diff loops -links 100 -xtype l
-invoke_bfs loops -links 100 -xtype l
+bfs_diff inaccessible/link -links 100 -xtype l
diff --git a/tests/common/empty_error.out b/tests/common/empty_error.out
index da45e23..49f773d 100644
--- a/tests/common/empty_error.out
+++ b/tests/common/empty_error.out
@@ -1,3 +1 @@
-./bar
-./baz
-./qux
+inaccessible/file
diff --git a/tests/common/empty_error.sh b/tests/common/empty_error.sh
index 7c8049c..3438cca 100644
--- a/tests/common/empty_error.sh
+++ b/tests/common/empty_error.sh
@@ -1,7 +1 @@
-cd "$TEST"
-
-"$XTOUCH" -p foo/ bar/ baz qux
-chmod -r foo baz
-defer chmod +r foo baz
-
-! bfs_diff . -empty
+! bfs_diff inaccessible -empty
diff --git a/tests/posix/depth_error.out b/tests/posix/depth_error.out
index 7ed5f0d..c4f8ce4 100644
--- a/tests/posix/depth_error.out
+++ b/tests/posix/depth_error.out
@@ -1,2 +1,4 @@
-.
-./foo
+inaccessible
+inaccessible/dir
+inaccessible/file
+inaccessible/link
diff --git a/tests/posix/depth_error.sh b/tests/posix/depth_error.sh
index db414ba..9b29385 100644
--- a/tests/posix/depth_error.sh
+++ b/tests/posix/depth_error.sh
@@ -1,7 +1 @@
-cd "$TEST"
-"$XTOUCH" -p foo/bar
-
-chmod a-r foo
-defer chmod +r foo
-
-! bfs_diff . -depth
+! bfs_diff inaccessible -depth
diff --git a/tests/posix/prune_error.out b/tests/posix/prune_error.out
index 9c558e3..436c48e 100644
--- a/tests/posix/prune_error.out
+++ b/tests/posix/prune_error.out
@@ -1 +1 @@
-.
+inaccessible
diff --git a/tests/posix/prune_error.sh b/tests/posix/prune_error.sh
index 9158a17..07a2523 100644
--- a/tests/posix/prune_error.sh
+++ b/tests/posix/prune_error.sh
@@ -1,8 +1 @@
-cd "$TEST"
-"$XTOUCH" -p foo/bar
-ln -s foo/bar baz
-
-chmod a-rx foo
-defer chmod +rx foo
-
-! bfs_diff -L . -name '???' -prune -o -print
+! bfs_diff -L inaccessible -path '*/*' -prune -o -print
diff --git a/tests/stddirs.sh b/tests/stddirs.sh
index b908ebe..989e7fe 100644
--- a/tests/stddirs.sh
+++ b/tests/stddirs.sh
@@ -48,6 +48,12 @@ make_loops() {
ln -s deeply/nested/loop/nested "$1/skip"
}
+# Creates a file+directory structure with inaccessible files
+make_inaccessible() {
+ "$XTOUCH" -p -M000 "$1/file" "$1/dir/"
+ ln -s dir/file "$1/link"
+}
+
# Creates a file+directory structure with varying timestamps
make_times() {
"$XTOUCH" -p -t "1991-12-14 00:00" "$1/a"
@@ -136,6 +142,7 @@ make_stddirs() {
make_perms "$TMP/perms"
make_links "$TMP/links"
make_loops "$TMP/loops"
+ make_inaccessible "$TMP/inaccessible"
make_times "$TMP/times"
make_weirdnames "$TMP/weirdnames"
make_deep "$TMP/deep"