diff options
Diffstat (limited to 'tests/bsd')
85 files changed, 483 insertions, 0 deletions
diff --git a/tests/bsd/E.out b/tests/bsd/E.out new file mode 100644 index 0000000..0f0971e --- /dev/null +++ b/tests/bsd/E.out @@ -0,0 +1 @@ +./( diff --git a/tests/bsd/E.sh b/tests/bsd/E.sh new file mode 100644 index 0000000..5d97178 --- /dev/null +++ b/tests/bsd/E.sh @@ -0,0 +1,2 @@ +cd weirdnames +bfs_diff -E . -regex '\./(\()' diff --git a/tests/bsd/H_mnewer.out b/tests/bsd/H_mnewer.out new file mode 100644 index 0000000..7f6c0dd --- /dev/null +++ b/tests/bsd/H_mnewer.out @@ -0,0 +1,4 @@ +times +times/b +times/c +times/l diff --git a/tests/bsd/H_mnewer.sh b/tests/bsd/H_mnewer.sh new file mode 100644 index 0000000..94fe08b --- /dev/null +++ b/tests/bsd/H_mnewer.sh @@ -0,0 +1 @@ +bfs_diff -H times -mnewer times/l diff --git a/tests/bsd/L_acl.out b/tests/bsd/L_acl.out new file mode 100644 index 0000000..dd89800 --- /dev/null +++ b/tests/bsd/L_acl.out @@ -0,0 +1,2 @@ +./acl +./link diff --git a/tests/bsd/L_acl.sh b/tests/bsd/L_acl.sh new file mode 100644 index 0000000..a3fcbc8 --- /dev/null +++ b/tests/bsd/L_acl.sh @@ -0,0 +1,9 @@ +cd "$TEST" + +invoke_bfs . -quit -acl || skip + +"$XTOUCH" normal acl +set_acl acl || skip +ln -s acl link + +bfs_diff -L . -acl diff --git a/tests/bsd/L_xattr.out b/tests/bsd/L_xattr.out new file mode 100644 index 0000000..21eb50f --- /dev/null +++ b/tests/bsd/L_xattr.out @@ -0,0 +1,3 @@ +./link +./xattr +./xattr_2 diff --git a/tests/bsd/L_xattr.sh b/tests/bsd/L_xattr.sh new file mode 100644 index 0000000..f8b56d8 --- /dev/null +++ b/tests/bsd/L_xattr.sh @@ -0,0 +1,3 @@ +invoke_bfs . -quit -xattr || skip +make_xattrs || skip +bfs_diff -L . -xattr diff --git a/tests/bsd/L_xattrname.out b/tests/bsd/L_xattrname.out new file mode 100644 index 0000000..9e4c172 --- /dev/null +++ b/tests/bsd/L_xattrname.out @@ -0,0 +1,2 @@ +./link +./xattr diff --git a/tests/bsd/L_xattrname.sh b/tests/bsd/L_xattrname.sh new file mode 100644 index 0000000..8108d57 --- /dev/null +++ b/tests/bsd/L_xattrname.sh @@ -0,0 +1,11 @@ +invoke_bfs . -quit -xattr || skip +make_xattrs || skip + +case "$UNAME" in + Darwin|FreeBSD) + bfs_diff -L . -xattrname bfs_test + ;; + *) + bfs_diff -L . -xattrname security.bfs_test + ;; +esac diff --git a/tests/bsd/X.out b/tests/bsd/X.out new file mode 100644 index 0000000..afa84f7 --- /dev/null +++ b/tests/bsd/X.out @@ -0,0 +1,19 @@ +weirdnames +weirdnames/! +weirdnames/!- +weirdnames/!-/e +weirdnames/!/d +weirdnames/( +weirdnames/(- +weirdnames/(-/c +weirdnames/(/b +weirdnames/) +weirdnames/)/g +weirdnames/, +weirdnames/,/f +weirdnames/- +weirdnames/-/a +weirdnames/... +weirdnames/.../h +weirdnames/[ +weirdnames/[/k diff --git a/tests/bsd/X.sh b/tests/bsd/X.sh new file mode 100644 index 0000000..54000cf --- /dev/null +++ b/tests/bsd/X.sh @@ -0,0 +1 @@ +! bfs_diff -X weirdnames diff --git a/tests/bsd/acl.out b/tests/bsd/acl.out new file mode 100644 index 0000000..92e2f67 --- /dev/null +++ b/tests/bsd/acl.out @@ -0,0 +1 @@ +./acl diff --git a/tests/bsd/acl.sh b/tests/bsd/acl.sh new file mode 100644 index 0000000..a13c75f --- /dev/null +++ b/tests/bsd/acl.sh @@ -0,0 +1,9 @@ +cd "$TEST" + +invoke_bfs . -quit -acl || skip + +"$XTOUCH" normal acl +set_acl acl || skip +ln -s acl link + +bfs_diff . -acl diff --git a/tests/bsd/asince.out b/tests/bsd/asince.out new file mode 100644 index 0000000..650e550 --- /dev/null +++ b/tests/bsd/asince.out @@ -0,0 +1,3 @@ +times +times/c +times/l diff --git a/tests/bsd/asince.sh b/tests/bsd/asince.sh new file mode 100644 index 0000000..32d5228 --- /dev/null +++ b/tests/bsd/asince.sh @@ -0,0 +1 @@ +bfs_diff times -asince 1991-12-14T00:01 diff --git a/tests/bsd/d_path.out b/tests/bsd/d_path.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/bsd/d_path.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/d_path.sh b/tests/bsd/d_path.sh new file mode 100644 index 0000000..010f76f --- /dev/null +++ b/tests/bsd/d_path.sh @@ -0,0 +1 @@ +bfs_diff -d basic diff --git a/tests/bsd/data_flow_depth.out b/tests/bsd/data_flow_depth.out new file mode 100644 index 0000000..ab127ec --- /dev/null +++ b/tests/bsd/data_flow_depth.out @@ -0,0 +1,8 @@ +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/k/foo/bar +basic/l/foo +basic/l/foo/bar diff --git a/tests/bsd/data_flow_depth.sh b/tests/bsd/data_flow_depth.sh new file mode 100644 index 0000000..cd5d6b2 --- /dev/null +++ b/tests/bsd/data_flow_depth.sh @@ -0,0 +1 @@ +bfs_diff basic -depth +1 -depth -4 diff --git a/tests/bsd/data_flow_sparse.out b/tests/bsd/data_flow_sparse.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/bsd/data_flow_sparse.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/data_flow_sparse.sh b/tests/bsd/data_flow_sparse.sh new file mode 100644 index 0000000..bd7e1f7 --- /dev/null +++ b/tests/bsd/data_flow_sparse.sh @@ -0,0 +1 @@ +bfs_diff basic \( -sparse -not -sparse \) -o \( -sparse -o -not -sparse \) diff --git a/tests/bsd/depth_depth_n.out b/tests/bsd/depth_depth_n.out new file mode 100644 index 0000000..3bfc1d3 --- /dev/null +++ b/tests/bsd/depth_depth_n.out @@ -0,0 +1,6 @@ +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo diff --git a/tests/bsd/depth_depth_n.sh b/tests/bsd/depth_depth_n.sh new file mode 100644 index 0000000..5989b3c --- /dev/null +++ b/tests/bsd/depth_depth_n.sh @@ -0,0 +1 @@ +bfs_diff basic -depth -depth 2 diff --git a/tests/bsd/depth_depth_n_minus.out b/tests/bsd/depth_depth_n_minus.out new file mode 100644 index 0000000..7575ae4 --- /dev/null +++ b/tests/bsd/depth_depth_n_minus.out @@ -0,0 +1,10 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l diff --git a/tests/bsd/depth_depth_n_minus.sh b/tests/bsd/depth_depth_n_minus.sh new file mode 100644 index 0000000..1d8ac79 --- /dev/null +++ b/tests/bsd/depth_depth_n_minus.sh @@ -0,0 +1 @@ +bfs_diff basic -depth -depth -2 diff --git a/tests/bsd/depth_depth_n_plus.out b/tests/bsd/depth_depth_n_plus.out new file mode 100644 index 0000000..847995d --- /dev/null +++ b/tests/bsd/depth_depth_n_plus.out @@ -0,0 +1,3 @@ +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/depth_depth_n_plus.sh b/tests/bsd/depth_depth_n_plus.sh new file mode 100644 index 0000000..64e392b --- /dev/null +++ b/tests/bsd/depth_depth_n_plus.sh @@ -0,0 +1 @@ +bfs_diff basic -depth -depth +2 diff --git a/tests/bsd/depth_n.out b/tests/bsd/depth_n.out new file mode 100644 index 0000000..3bfc1d3 --- /dev/null +++ b/tests/bsd/depth_n.out @@ -0,0 +1,6 @@ +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo diff --git a/tests/bsd/depth_n.sh b/tests/bsd/depth_n.sh new file mode 100644 index 0000000..4852952 --- /dev/null +++ b/tests/bsd/depth_n.sh @@ -0,0 +1 @@ +bfs_diff basic -depth 2 diff --git a/tests/bsd/depth_n_minus.out b/tests/bsd/depth_n_minus.out new file mode 100644 index 0000000..7575ae4 --- /dev/null +++ b/tests/bsd/depth_n_minus.out @@ -0,0 +1,10 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l diff --git a/tests/bsd/depth_n_minus.sh b/tests/bsd/depth_n_minus.sh new file mode 100644 index 0000000..192bf8a --- /dev/null +++ b/tests/bsd/depth_n_minus.sh @@ -0,0 +1 @@ +bfs_diff basic -depth -2 diff --git a/tests/bsd/depth_n_plus.out b/tests/bsd/depth_n_plus.out new file mode 100644 index 0000000..847995d --- /dev/null +++ b/tests/bsd/depth_n_plus.out @@ -0,0 +1,3 @@ +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/depth_n_plus.sh b/tests/bsd/depth_n_plus.sh new file mode 100644 index 0000000..858e1c4 --- /dev/null +++ b/tests/bsd/depth_n_plus.sh @@ -0,0 +1 @@ +bfs_diff basic -depth +2 diff --git a/tests/bsd/depth_overflow.out b/tests/bsd/depth_overflow.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/bsd/depth_overflow.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/depth_overflow.sh b/tests/bsd/depth_overflow.sh new file mode 100644 index 0000000..4685d03 --- /dev/null +++ b/tests/bsd/depth_overflow.sh @@ -0,0 +1 @@ +bfs_diff basic -depth -4294967296 diff --git a/tests/bsd/exit.out b/tests/bsd/exit.out new file mode 100644 index 0000000..cf4d5a9 --- /dev/null +++ b/tests/bsd/exit.out @@ -0,0 +1 @@ +basic/g diff --git a/tests/bsd/exit.sh b/tests/bsd/exit.sh new file mode 100644 index 0000000..248349c --- /dev/null +++ b/tests/bsd/exit.sh @@ -0,0 +1,5 @@ +check_exit 42 invoke_bfs basic -name foo -exit 42 + +check_exit 0 invoke_bfs basic -name qux -exit 42 + +bfs_diff basic/g -print -name g -exit diff --git a/tests/bsd/exit_no_implicit_print.out b/tests/bsd/exit_no_implicit_print.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/bsd/exit_no_implicit_print.out diff --git a/tests/bsd/exit_no_implicit_print.sh b/tests/bsd/exit_no_implicit_print.sh new file mode 100644 index 0000000..c48b43c --- /dev/null +++ b/tests/bsd/exit_no_implicit_print.sh @@ -0,0 +1 @@ +bfs_diff basic -not -name foo -o -exit diff --git a/tests/bsd/f.out b/tests/bsd/f.out new file mode 100644 index 0000000..77eac77 --- /dev/null +++ b/tests/bsd/f.out @@ -0,0 +1,4 @@ +( +(/b +- +-/a diff --git a/tests/bsd/f.sh b/tests/bsd/f.sh new file mode 100644 index 0000000..42d2dfd --- /dev/null +++ b/tests/bsd/f.sh @@ -0,0 +1,2 @@ +cd weirdnames +bfs_diff -f '-' -f '(' diff --git a/tests/bsd/f_incomplete.sh b/tests/bsd/f_incomplete.sh new file mode 100644 index 0000000..0dfb19f --- /dev/null +++ b/tests/bsd/f_incomplete.sh @@ -0,0 +1 @@ +! invoke_bfs -f diff --git a/tests/bsd/flags.out b/tests/bsd/flags.out new file mode 100644 index 0000000..3216ff5 --- /dev/null +++ b/tests/bsd/flags.out @@ -0,0 +1 @@ +./bar diff --git a/tests/bsd/flags.sh b/tests/bsd/flags.sh new file mode 100644 index 0000000..eb9bc22 --- /dev/null +++ b/tests/bsd/flags.sh @@ -0,0 +1,8 @@ +invoke_bfs . -quit -flags offline || skip + +cd "$TEST" + +"$XTOUCH" foo bar +chflags offline bar || skip + +bfs_diff . -flags -offline,nohidden diff --git a/tests/bsd/gid_name.out b/tests/bsd/gid_name.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/bsd/gid_name.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/gid_name.sh b/tests/bsd/gid_name.sh new file mode 100644 index 0000000..c7e0e71 --- /dev/null +++ b/tests/bsd/gid_name.sh @@ -0,0 +1 @@ +bfs_diff basic -gid "$(id -gn)" diff --git a/tests/bsd/mnewer.out b/tests/bsd/mnewer.out new file mode 100644 index 0000000..7f6c0dd --- /dev/null +++ b/tests/bsd/mnewer.out @@ -0,0 +1,4 @@ +times +times/b +times/c +times/l diff --git a/tests/bsd/mnewer.sh b/tests/bsd/mnewer.sh new file mode 100644 index 0000000..5d9f1a7 --- /dev/null +++ b/tests/bsd/mnewer.sh @@ -0,0 +1 @@ +bfs_diff times -mnewer times/a diff --git a/tests/bsd/msince.out b/tests/bsd/msince.out new file mode 100644 index 0000000..650e550 --- /dev/null +++ b/tests/bsd/msince.out @@ -0,0 +1,3 @@ +times +times/c +times/l diff --git a/tests/bsd/msince.sh b/tests/bsd/msince.sh new file mode 100644 index 0000000..ec22f02 --- /dev/null +++ b/tests/bsd/msince.sh @@ -0,0 +1 @@ +bfs_diff times -msince 1991-12-14T00:01 diff --git a/tests/bsd/mtime_bad_unit.sh b/tests/bsd/mtime_bad_unit.sh new file mode 100644 index 0000000..6e2caf1 --- /dev/null +++ b/tests/bsd/mtime_bad_unit.sh @@ -0,0 +1 @@ +! invoke_bfs times -mtime +1q diff --git a/tests/bsd/mtime_missing_unit.sh b/tests/bsd/mtime_missing_unit.sh new file mode 100644 index 0000000..f6b1f93 --- /dev/null +++ b/tests/bsd/mtime_missing_unit.sh @@ -0,0 +1 @@ +! invoke_bfs times -mtime +1w2 diff --git a/tests/bsd/mtime_units.out b/tests/bsd/mtime_units.out new file mode 100644 index 0000000..f7f63b0 --- /dev/null +++ b/tests/bsd/mtime_units.out @@ -0,0 +1,5 @@ +times +times/a +times/b +times/c +times/l diff --git a/tests/bsd/mtime_units.sh b/tests/bsd/mtime_units.sh new file mode 100644 index 0000000..a1e587e --- /dev/null +++ b/tests/bsd/mtime_units.sh @@ -0,0 +1 @@ +bfs_diff times -mtime +500w400d300h200m100s diff --git a/tests/bsd/okdir_stdin.out b/tests/bsd/okdir_stdin.out new file mode 100644 index 0000000..ef2a68b --- /dev/null +++ b/tests/bsd/okdir_stdin.out @@ -0,0 +1,19 @@ +./a? y +./b? y +./bar? y +./bar? y +./basic? y +./baz? y +./c? y +./d? y +./e? y +./f? y +./foo? y +./foo? y +./foo? y +./g? y +./h? y +./i? y +./j? y +./k? y +./l? y diff --git a/tests/bsd/okdir_stdin.sh b/tests/bsd/okdir_stdin.sh new file mode 100644 index 0000000..7908ac0 --- /dev/null +++ b/tests/bsd/okdir_stdin.sh @@ -0,0 +1,2 @@ +# -okdir should *not* close stdin +yes | bfs_diff basic -okdir bash -c 'printf "%s? " "$1" && head -n1' bash {} \; diff --git a/tests/bsd/perm_000_plus.out b/tests/bsd/perm_000_plus.out new file mode 100644 index 0000000..d7494b8 --- /dev/null +++ b/tests/bsd/perm_000_plus.out @@ -0,0 +1,8 @@ +perms +perms/0 +perms/r +perms/rw +perms/rwx +perms/rx +perms/w +perms/wx diff --git a/tests/bsd/perm_000_plus.sh b/tests/bsd/perm_000_plus.sh new file mode 100644 index 0000000..9ab3146 --- /dev/null +++ b/tests/bsd/perm_000_plus.sh @@ -0,0 +1 @@ +bfs_diff perms -perm +000 diff --git a/tests/bsd/perm_222_plus.out b/tests/bsd/perm_222_plus.out new file mode 100644 index 0000000..9a5b95a --- /dev/null +++ b/tests/bsd/perm_222_plus.out @@ -0,0 +1,5 @@ +perms +perms/rw +perms/rwx +perms/w +perms/wx diff --git a/tests/bsd/perm_222_plus.sh b/tests/bsd/perm_222_plus.sh new file mode 100644 index 0000000..ac3c4eb --- /dev/null +++ b/tests/bsd/perm_222_plus.sh @@ -0,0 +1 @@ +bfs_diff perms -perm +222 diff --git a/tests/bsd/perm_644_plus.out b/tests/bsd/perm_644_plus.out new file mode 100644 index 0000000..7e5ae98 --- /dev/null +++ b/tests/bsd/perm_644_plus.out @@ -0,0 +1,7 @@ +perms +perms/r +perms/rw +perms/rwx +perms/rx +perms/w +perms/wx diff --git a/tests/bsd/perm_644_plus.sh b/tests/bsd/perm_644_plus.sh new file mode 100644 index 0000000..b3f5bc6 --- /dev/null +++ b/tests/bsd/perm_644_plus.sh @@ -0,0 +1 @@ +bfs_diff perms -perm +644 diff --git a/tests/bsd/printx.out b/tests/bsd/printx.out new file mode 100644 index 0000000..04bf9a9 --- /dev/null +++ b/tests/bsd/printx.out @@ -0,0 +1,23 @@ +weirdnames +weirdnames/! +weirdnames/!- +weirdnames/!-/e +weirdnames/!/d +weirdnames/( +weirdnames/(- +weirdnames/(-/c +weirdnames/(/b +weirdnames/) +weirdnames/)/g +weirdnames/, +weirdnames/,/f +weirdnames/- +weirdnames/-/a +weirdnames/... +weirdnames/.../h +weirdnames/[ +weirdnames/[/k +weirdnames/\ +weirdnames/\ /j +weirdnames/\\ +weirdnames/\\/i diff --git a/tests/bsd/printx.sh b/tests/bsd/printx.sh new file mode 100644 index 0000000..cb24aab --- /dev/null +++ b/tests/bsd/printx.sh @@ -0,0 +1 @@ +bfs_diff weirdnames -printx diff --git a/tests/bsd/quit_implicit_print.out b/tests/bsd/quit_implicit_print.out new file mode 100644 index 0000000..15a13db --- /dev/null +++ b/tests/bsd/quit_implicit_print.out @@ -0,0 +1 @@ +basic diff --git a/tests/bsd/quit_implicit_print.sh b/tests/bsd/quit_implicit_print.sh new file mode 100644 index 0000000..ea8fd5d --- /dev/null +++ b/tests/bsd/quit_implicit_print.sh @@ -0,0 +1 @@ +bfs_diff basic -name basic -o -quit diff --git a/tests/bsd/rm.out b/tests/bsd/rm.out new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/tests/bsd/rm.out @@ -0,0 +1 @@ +. diff --git a/tests/bsd/rm.sh b/tests/bsd/rm.sh new file mode 100644 index 0000000..595d514 --- /dev/null +++ b/tests/bsd/rm.sh @@ -0,0 +1,4 @@ +cd "$TEST" +"$XTOUCH" -p foo/bar/baz +invoke_bfs . -rm +bfs_diff . diff --git a/tests/bsd/s.out b/tests/bsd/s.out new file mode 100644 index 0000000..6b790c2 --- /dev/null +++ b/tests/bsd/s.out @@ -0,0 +1,12 @@ +weirdnames +weirdnames/ +weirdnames/! +weirdnames/!- +weirdnames/( +weirdnames/(- +weirdnames/) +weirdnames/, +weirdnames/- +weirdnames/... +weirdnames/[ +weirdnames/\ diff --git a/tests/bsd/s.sh b/tests/bsd/s.sh new file mode 100644 index 0000000..52f8eb3 --- /dev/null +++ b/tests/bsd/s.sh @@ -0,0 +1,2 @@ +invoke_bfs -s weirdnames -maxdepth 1 >"$OUT" +diff_output diff --git a/tests/bsd/s_quit.out b/tests/bsd/s_quit.out new file mode 100644 index 0000000..5ea492b --- /dev/null +++ b/tests/bsd/s_quit.out @@ -0,0 +1 @@ +basic/j/foo diff --git a/tests/bsd/s_quit.sh b/tests/bsd/s_quit.sh new file mode 100644 index 0000000..6bd55ab --- /dev/null +++ b/tests/bsd/s_quit.sh @@ -0,0 +1,4 @@ +# Regression test: bfs -S ids -s -name foo -quit would not actually quit, +# ending up in a confused state and erroring/crashing + +bfs_diff -s basic -name foo -print -quit diff --git a/tests/bsd/size_T.out b/tests/bsd/size_T.out new file mode 100644 index 0000000..279f3f1 --- /dev/null +++ b/tests/bsd/size_T.out @@ -0,0 +1 @@ +basic/l/foo/bar/baz diff --git a/tests/bsd/size_T.sh b/tests/bsd/size_T.sh new file mode 100644 index 0000000..1023a10 --- /dev/null +++ b/tests/bsd/size_T.sh @@ -0,0 +1 @@ +bfs_diff basic -type f -size 1T diff --git a/tests/bsd/sparse.out b/tests/bsd/sparse.out new file mode 100644 index 0000000..52dcf49 --- /dev/null +++ b/tests/bsd/sparse.out @@ -0,0 +1 @@ +mnt/sparse diff --git a/tests/bsd/sparse.sh b/tests/bsd/sparse.sh new file mode 100644 index 0000000..7fcdeed --- /dev/null +++ b/tests/bsd/sparse.sh @@ -0,0 +1,12 @@ +test "$UNAME" = "Linux" || skip + +cd "$TEST" +mkdir mnt + +bfs_sudo mount -t tmpfs tmpfs mnt || skip +defer bfs_sudo umount mnt + +truncate -s 1M mnt/sparse +dd if=/dev/zero of=mnt/dense bs=1M count=1 + +bfs_diff mnt -type f -sparse diff --git a/tests/bsd/type_w.out b/tests/bsd/type_w.out new file mode 100644 index 0000000..a20a4f3 --- /dev/null +++ b/tests/bsd/type_w.out @@ -0,0 +1,34 @@ +1: -rw-r--r-- mnt/lower/bar +1: -rw-r--r-- mnt/lower/baz +1: -rw-r--r-- mnt/lower/foo +1: -rw-r--r-- mnt/upper/baz/qux +1: -rw-r--r-- mnt/upper/foo +1: drwxr-xr-x mnt/lower +1: drwxr-xr-x mnt/upper +1: drwxr-xr-x mnt/upper/baz +2: w--------- mnt/upper/bar +3: -rw-r--r-- mnt/lower/bar +3: -rw-r--r-- mnt/lower/baz +3: -rw-r--r-- mnt/lower/foo +3: -rw-r--r-- mnt/upper/baz/qux +3: -rw-r--r-- mnt/upper/foo +3: drwxr-xr-x mnt/lower +3: drwxr-xr-x mnt/upper +3: drwxr-xr-x mnt/upper/baz +3: w--------- mnt/upper/bar +4: -rw-r--r-- mnt/lower/bar +4: -rw-r--r-- mnt/lower/baz +4: -rw-r--r-- mnt/lower/foo +4: -rw-r--r-- mnt/upper/baz/qux +4: drwxr-xr-x mnt/lower +4: drwxr-xr-x mnt/upper +4: drwxr-xr-x mnt/upper/baz +5: w--------- mnt/upper/bar +6: -rw-r--r-- mnt/lower/bar +6: -rw-r--r-- mnt/lower/baz +6: -rw-r--r-- mnt/lower/foo +6: -rw-r--r-- mnt/upper/baz/qux +6: drwxr-xr-x mnt/lower +6: drwxr-xr-x mnt/upper +6: drwxr-xr-x mnt/upper/baz +6: w--------- mnt/upper/bar diff --git a/tests/bsd/type_w.sh b/tests/bsd/type_w.sh new file mode 100644 index 0000000..3aa50d5 --- /dev/null +++ b/tests/bsd/type_w.sh @@ -0,0 +1,56 @@ +# Only ffs supports whiteouts on FreeBSD +command -v mdconfig &>/dev/null || skip +command -v newfs &>/dev/null || skip + +cd "$TEST" + +# Create a ramdisk +if command -v truncate &>/dev/null; then + truncate -s1M img +else + dd if=/dev/zero of=img bs=1k count=1k +fi +md=$(bfs_sudo mdconfig img) || skip +defer bfs_sudo mdconfig -du "$md" + +# Make an ffs filesystem +bfs_sudo newfs -n "/dev/$md" >&2 || skip +mkdir mnt + +# Mount it +bfs_sudo mount "/dev/$md" mnt || skip +defer bfs_sudo umount mnt + +# Make it owned by us +bfs_sudo chown "$(id -u):$(id -g)" mnt +"$XTOUCH" -p mnt/{lower/{foo,bar,baz},upper/{bar,baz/qux}} + +# Mount a union filesystem within it +bfs_sudo mount -t unionfs -o below mnt/{lower,upper} +defer bfs_sudo umount mnt/upper + +# Create a whiteout +rm mnt/upper/bar + +# FreeBSD find doesn't have -printf, so munge -ls output +munge_ls() { + sed -En 's|.*([-drwx]{10}).*(mnt/.*)|'"$1"': \1 \2|p' +} + +# Do a few tests in one +{ + # Normally, we shouldn't see the whiteouts + invoke_bfs mnt -ls | munge_ls 1 + # -type w adds whiteouts to the output + invoke_bfs mnt -type w -ls | munge_ls 2 + # So this is not the same as test 1 + invoke_bfs mnt \( -type w -or -not -type w \) -ls | munge_ls 3 + # Unmount the unionfs + pop_defer + # Now repeat the same tests + invoke_bfs mnt -ls | munge_ls 4 + invoke_bfs mnt -type w -ls | munge_ls 5 + invoke_bfs mnt \( -type w -or -not -type w \) -ls | munge_ls 6 +} >"$OUT" +sort_output +diff_output diff --git a/tests/bsd/uid_name.out b/tests/bsd/uid_name.out new file mode 100644 index 0000000..a7ccfe4 --- /dev/null +++ b/tests/bsd/uid_name.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/c/d +basic/e +basic/e/f +basic/g +basic/g/h +basic/i +basic/j +basic/j/foo +basic/k +basic/k/foo +basic/k/foo/bar +basic/l +basic/l/foo +basic/l/foo/bar +basic/l/foo/bar/baz diff --git a/tests/bsd/uid_name.sh b/tests/bsd/uid_name.sh new file mode 100644 index 0000000..7d3ba82 --- /dev/null +++ b/tests/bsd/uid_name.sh @@ -0,0 +1 @@ +bfs_diff basic -uid "$(id -un)" diff --git a/tests/bsd/xattr.out b/tests/bsd/xattr.out new file mode 100644 index 0000000..0afed35 --- /dev/null +++ b/tests/bsd/xattr.out @@ -0,0 +1,3 @@ +./xattr +./xattr_2 +./xattr_link diff --git a/tests/bsd/xattr.sh b/tests/bsd/xattr.sh new file mode 100644 index 0000000..68f729a --- /dev/null +++ b/tests/bsd/xattr.sh @@ -0,0 +1,3 @@ +invoke_bfs . -quit -xattr || skip +make_xattrs || skip +bfs_diff . -xattr diff --git a/tests/bsd/xattrname.out b/tests/bsd/xattrname.out new file mode 100644 index 0000000..ef732bd --- /dev/null +++ b/tests/bsd/xattrname.out @@ -0,0 +1,2 @@ +./xattr +./xattr_link diff --git a/tests/bsd/xattrname.sh b/tests/bsd/xattrname.sh new file mode 100644 index 0000000..38b111a --- /dev/null +++ b/tests/bsd/xattrname.sh @@ -0,0 +1,11 @@ +invoke_bfs . -quit -xattr || skip +make_xattrs || skip + +case "$UNAME" in + Darwin|FreeBSD) + bfs_diff . -xattrname bfs_test + ;; + *) + bfs_diff . -xattrname security.bfs_test + ;; +esac |