summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2017-08-12 18:12:13 -0400
committerTavian Barnes <tavianator@tavianator.com>2017-08-12 18:12:13 -0400
commitacd7f7ed437793e7c67ecd869cfac32a87c1ec52 (patch)
treeabfb1561c90aca00362fb0f99b8a8da4a70fe08a /tests.sh
parent01a754bc5572103f9a49242d756dc04b0e86bb6e (diff)
downloadbfs-acd7f7ed437793e7c67ecd869cfac32a87c1ec52.tar.xz
Unify broken symlink handling
Rather than open-code the fallback logic for broken symlinks everywhere it's needed, introduce a new xfstatat() utility function that performs the fallback automatically. Using xfstatat() consistently fixes a few bugs, including cases where broken symlinks are given as arguments to predicates like -samefile.
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 88e93b1..1517bda 100755
--- a/tests.sh
+++ b/tests.sh
@@ -169,6 +169,7 @@ posix_tests=(
test_name_trailing_slash
test_path
test_newer
+ test_newer_link
test_links
test_links_plus
test_links_minus
@@ -215,6 +216,10 @@ bsd_tests=(
test_X
test_follow
test_samefile
+ test_samefile_symlink
+ test_H_samefile_symlink
+ test_samefile_broken
+ test_H_samefile_broken
test_name_slash
test_name_slashes
test_iname
@@ -285,6 +290,10 @@ gnu_tests=(
test_P_slash
test_follow
test_samefile
+ test_samefile_symlink
+ test_H_samefile_symlink
+ test_samefile_broken
+ test_H_samefile_broken
test_xtype_l
test_xtype_f
test_L_xtype_l
@@ -624,6 +633,10 @@ function test_newer() {
bfs_diff times -newer times/a
}
+function test_newer_link() {
+ bfs_diff times -newer times/l
+}
+
function test_anewer() {
bfs_diff times -anewer times/a
}
@@ -684,6 +697,22 @@ function test_samefile() {
bfs_diff links -samefile links/a
}
+function test_samefile_symlink() {
+ bfs_diff links -samefile links/b
+}
+
+function test_H_samefile_symlink() {
+ bfs_diff -H links -samefile links/b
+}
+
+function test_samefile_broken() {
+ bfs_diff links -samefile links/d/e/i
+}
+
+function test_H_samefile_broken() {
+ bfs_diff -H links -samefile links/d/e/i
+}
+
function test_xtype_l() {
bfs_diff links -xtype l
}