summaryrefslogtreecommitdiffstats
path: root/tests/bsd
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bsd')
-rw-r--r--tests/bsd/Hf.out1
-rw-r--r--tests/bsd/Hf.sh1
-rw-r--r--tests/bsd/L_acl.out4
-rw-r--r--tests/bsd/L_acl.sh12
-rw-r--r--tests/bsd/L_xattr.out6
-rw-r--r--tests/bsd/L_xattr.sh4
-rw-r--r--tests/bsd/L_xattrname.out4
-rw-r--r--tests/bsd/L_xattrname.sh6
-rw-r--r--tests/bsd/X.out4
-rw-r--r--tests/bsd/acl.out2
-rw-r--r--tests/bsd/acl.sh12
-rw-r--r--tests/bsd/f_incomplete.sh1
-rw-r--r--tests/bsd/flags.out2
-rw-r--r--tests/bsd/flags.sh10
-rw-r--r--tests/bsd/perm_000_plus.out35
-rw-r--r--tests/bsd/perm_222_plus.out23
-rw-r--r--tests/bsd/perm_644_plus.out31
-rw-r--r--tests/bsd/printx.out8
-rw-r--r--tests/bsd/rm.out2
-rw-r--r--tests/bsd/rm.sh10
-rw-r--r--tests/bsd/s.out4
-rw-r--r--tests/bsd/s_quit.out1
-rw-r--r--tests/bsd/s_quit.sh4
-rw-r--r--tests/bsd/sparse.out1
-rw-r--r--tests/bsd/sparse.sh12
-rw-r--r--tests/bsd/type_w.out34
-rw-r--r--tests/bsd/type_w.sh56
-rw-r--r--tests/bsd/xattr.out6
-rw-r--r--tests/bsd/xattr.sh4
-rw-r--r--tests/bsd/xattrname.out4
-rw-r--r--tests/bsd/xattrname.sh6
31 files changed, 244 insertions, 66 deletions
diff --git a/tests/bsd/Hf.out b/tests/bsd/Hf.out
new file mode 100644
index 0000000..ff635ff
--- /dev/null
+++ b/tests/bsd/Hf.out
@@ -0,0 +1 @@
+links/deeply/nested/dir
diff --git a/tests/bsd/Hf.sh b/tests/bsd/Hf.sh
new file mode 100644
index 0000000..333280c
--- /dev/null
+++ b/tests/bsd/Hf.sh
@@ -0,0 +1 @@
+bfs_diff -Hf links/deeply/nested/dir
diff --git a/tests/bsd/L_acl.out b/tests/bsd/L_acl.out
index 1dae00a..dd89800 100644
--- a/tests/bsd/L_acl.out
+++ b/tests/bsd/L_acl.out
@@ -1,2 +1,2 @@
-scratch/acl
-scratch/link
+./acl
+./link
diff --git a/tests/bsd/L_acl.sh b/tests/bsd/L_acl.sh
index db97013..a3fcbc8 100644
--- a/tests/bsd/L_acl.sh
+++ b/tests/bsd/L_acl.sh
@@ -1,9 +1,9 @@
-clean_scratch
+cd "$TEST"
-invoke_bfs scratch -quit -acl || skip
+invoke_bfs . -quit -acl || skip
-"$XTOUCH" scratch/{normal,acl}
-set_acl scratch/acl || skip
-ln -s acl scratch/link
+"$XTOUCH" normal acl
+set_acl acl || skip
+ln -s acl link
-bfs_diff -L scratch -acl
+bfs_diff -L . -acl
diff --git a/tests/bsd/L_xattr.out b/tests/bsd/L_xattr.out
index 12fac95..21eb50f 100644
--- a/tests/bsd/L_xattr.out
+++ b/tests/bsd/L_xattr.out
@@ -1,3 +1,3 @@
-scratch/link
-scratch/xattr
-scratch/xattr_2
+./link
+./xattr
+./xattr_2
diff --git a/tests/bsd/L_xattr.sh b/tests/bsd/L_xattr.sh
index 1f61c78..f8b56d8 100644
--- a/tests/bsd/L_xattr.sh
+++ b/tests/bsd/L_xattr.sh
@@ -1,3 +1,3 @@
-invoke_bfs scratch -quit -xattr || skip
+invoke_bfs . -quit -xattr || skip
make_xattrs || skip
-bfs_diff -L scratch -xattr
+bfs_diff -L . -xattr
diff --git a/tests/bsd/L_xattrname.out b/tests/bsd/L_xattrname.out
index 4dc4836..9e4c172 100644
--- a/tests/bsd/L_xattrname.out
+++ b/tests/bsd/L_xattrname.out
@@ -1,2 +1,2 @@
-scratch/link
-scratch/xattr
+./link
+./xattr
diff --git a/tests/bsd/L_xattrname.sh b/tests/bsd/L_xattrname.sh
index 3b2006b..8108d57 100644
--- a/tests/bsd/L_xattrname.sh
+++ b/tests/bsd/L_xattrname.sh
@@ -1,11 +1,11 @@
-invoke_bfs scratch -quit -xattr || skip
+invoke_bfs . -quit -xattr || skip
make_xattrs || skip
case "$UNAME" in
Darwin|FreeBSD)
- bfs_diff -L scratch -xattrname bfs_test
+ bfs_diff -L . -xattrname bfs_test
;;
*)
- bfs_diff -L scratch -xattrname security.bfs_test
+ bfs_diff -L . -xattrname security.bfs_test
;;
esac
diff --git a/tests/bsd/X.out b/tests/bsd/X.out
index afa84f7..dbe2408 100644
--- a/tests/bsd/X.out
+++ b/tests/bsd/X.out
@@ -9,6 +9,8 @@ weirdnames/(-/c
weirdnames/(/b
weirdnames/)
weirdnames/)/g
+weirdnames/*
+weirdnames/*/m
weirdnames/,
weirdnames/,/f
weirdnames/-
@@ -17,3 +19,5 @@ weirdnames/...
weirdnames/.../h
weirdnames/[
weirdnames/[/k
+weirdnames/{
+weirdnames/{/l
diff --git a/tests/bsd/acl.out b/tests/bsd/acl.out
index ddf8446..92e2f67 100644
--- a/tests/bsd/acl.out
+++ b/tests/bsd/acl.out
@@ -1 +1 @@
-scratch/acl
+./acl
diff --git a/tests/bsd/acl.sh b/tests/bsd/acl.sh
index c044398..a13c75f 100644
--- a/tests/bsd/acl.sh
+++ b/tests/bsd/acl.sh
@@ -1,9 +1,9 @@
-clean_scratch
+cd "$TEST"
-invoke_bfs scratch -quit -acl || skip
+invoke_bfs . -quit -acl || skip
-"$XTOUCH" scratch/{normal,acl}
-set_acl scratch/acl || skip
-ln -s acl scratch/link
+"$XTOUCH" normal acl
+set_acl acl || skip
+ln -s acl link
-bfs_diff scratch -acl
+bfs_diff . -acl
diff --git a/tests/bsd/f_incomplete.sh b/tests/bsd/f_incomplete.sh
index 50afe42..0dfb19f 100644
--- a/tests/bsd/f_incomplete.sh
+++ b/tests/bsd/f_incomplete.sh
@@ -1,2 +1 @@
! invoke_bfs -f
-
diff --git a/tests/bsd/flags.out b/tests/bsd/flags.out
index 11998ed..3216ff5 100644
--- a/tests/bsd/flags.out
+++ b/tests/bsd/flags.out
@@ -1 +1 @@
-scratch/bar
+./bar
diff --git a/tests/bsd/flags.sh b/tests/bsd/flags.sh
index 949a7d3..eb9bc22 100644
--- a/tests/bsd/flags.sh
+++ b/tests/bsd/flags.sh
@@ -1,8 +1,8 @@
-invoke_bfs scratch -quit -flags offline || skip
+invoke_bfs . -quit -flags offline || skip
-clean_scratch
+cd "$TEST"
-"$XTOUCH" scratch/{foo,bar}
-chflags offline scratch/bar || skip
+"$XTOUCH" foo bar
+chflags offline bar || skip
-bfs_diff scratch -flags -offline,nohidden
+bfs_diff . -flags -offline,nohidden
diff --git a/tests/bsd/perm_000_plus.out b/tests/bsd/perm_000_plus.out
index d7494b8..e279684 100644
--- a/tests/bsd/perm_000_plus.out
+++ b/tests/bsd/perm_000_plus.out
@@ -1,8 +1,29 @@
perms
-perms/0
-perms/r
-perms/rw
-perms/rwx
-perms/rx
-perms/w
-perms/wx
+perms/dr-x------
+perms/dr-xr-xr-x
+perms/drwx------
+perms/drwxr-xr-x
+perms/drwxrwxr-x
+perms/drwxrwxrwx
+perms/f---------
+perms/f--x------
+perms/f--x--x--x
+perms/f-w-------
+perms/f-w--w----
+perms/f-w--w--w-
+perms/f-wx------
+perms/f-wx--x--x
+perms/f-wx-wx--x
+perms/f-wx-wx-wx
+perms/fr--------
+perms/fr--r--r--
+perms/fr-x------
+perms/fr-xr-xr-x
+perms/frw-------
+perms/frw-r--r--
+perms/frw-rw-r--
+perms/frw-rw-rw-
+perms/frwxr-----
+perms/frwxr-xr-x
+perms/frwxrwxr-x
+perms/frwxrwxrwx
diff --git a/tests/bsd/perm_222_plus.out b/tests/bsd/perm_222_plus.out
index 9a5b95a..1b6d885 100644
--- a/tests/bsd/perm_222_plus.out
+++ b/tests/bsd/perm_222_plus.out
@@ -1,5 +1,20 @@
perms
-perms/rw
-perms/rwx
-perms/w
-perms/wx
+perms/drwx------
+perms/drwxr-xr-x
+perms/drwxrwxr-x
+perms/drwxrwxrwx
+perms/f-w-------
+perms/f-w--w----
+perms/f-w--w--w-
+perms/f-wx------
+perms/f-wx--x--x
+perms/f-wx-wx--x
+perms/f-wx-wx-wx
+perms/frw-------
+perms/frw-r--r--
+perms/frw-rw-r--
+perms/frw-rw-rw-
+perms/frwxr-----
+perms/frwxr-xr-x
+perms/frwxrwxr-x
+perms/frwxrwxrwx
diff --git a/tests/bsd/perm_644_plus.out b/tests/bsd/perm_644_plus.out
index 7e5ae98..eef88ca 100644
--- a/tests/bsd/perm_644_plus.out
+++ b/tests/bsd/perm_644_plus.out
@@ -1,7 +1,26 @@
perms
-perms/r
-perms/rw
-perms/rwx
-perms/rx
-perms/w
-perms/wx
+perms/dr-x------
+perms/dr-xr-xr-x
+perms/drwx------
+perms/drwxr-xr-x
+perms/drwxrwxr-x
+perms/drwxrwxrwx
+perms/f-w-------
+perms/f-w--w----
+perms/f-w--w--w-
+perms/f-wx------
+perms/f-wx--x--x
+perms/f-wx-wx--x
+perms/f-wx-wx-wx
+perms/fr--------
+perms/fr--r--r--
+perms/fr-x------
+perms/fr-xr-xr-x
+perms/frw-------
+perms/frw-r--r--
+perms/frw-rw-r--
+perms/frw-rw-rw-
+perms/frwxr-----
+perms/frwxr-xr-x
+perms/frwxrwxr-x
+perms/frwxrwxrwx
diff --git a/tests/bsd/printx.out b/tests/bsd/printx.out
index 04bf9a9..034b2da 100644
--- a/tests/bsd/printx.out
+++ b/tests/bsd/printx.out
@@ -1,3 +1,5 @@
+
+/n
weirdnames
weirdnames/!
weirdnames/!-
@@ -9,6 +11,8 @@ weirdnames/(-/c
weirdnames/(/b
weirdnames/)
weirdnames/)/g
+weirdnames/*
+weirdnames/*/m
weirdnames/,
weirdnames/,/f
weirdnames/-
@@ -17,7 +21,11 @@ weirdnames/...
weirdnames/.../h
weirdnames/[
weirdnames/[/k
+weirdnames/\
+weirdnames/\
weirdnames/\
weirdnames/\ /j
weirdnames/\\
weirdnames/\\/i
+weirdnames/{
+weirdnames/{/l
diff --git a/tests/bsd/rm.out b/tests/bsd/rm.out
index fb188b9..9c558e3 100644
--- a/tests/bsd/rm.out
+++ b/tests/bsd/rm.out
@@ -1 +1 @@
-scratch
+.
diff --git a/tests/bsd/rm.sh b/tests/bsd/rm.sh
index 9ee2b0a..595d514 100644
--- a/tests/bsd/rm.sh
+++ b/tests/bsd/rm.sh
@@ -1,6 +1,4 @@
-clean_scratch
-"$XTOUCH" -p scratch/foo/bar/baz
-
-(cd scratch && invoke_bfs . -rm)
-
-bfs_diff scratch
+cd "$TEST"
+"$XTOUCH" -p foo/bar/baz
+invoke_bfs . -rm
+bfs_diff .
diff --git a/tests/bsd/s.out b/tests/bsd/s.out
index 6b790c2..5c85ac8 100644
--- a/tests/bsd/s.out
+++ b/tests/bsd/s.out
@@ -1,12 +1,16 @@
weirdnames
+weirdnames/
+
weirdnames/
weirdnames/!
weirdnames/!-
weirdnames/(
weirdnames/(-
weirdnames/)
+weirdnames/*
weirdnames/,
weirdnames/-
weirdnames/...
weirdnames/[
weirdnames/\
+weirdnames/{
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/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/xattr.out b/tests/bsd/xattr.out
index 109e7c9..0afed35 100644
--- a/tests/bsd/xattr.out
+++ b/tests/bsd/xattr.out
@@ -1,3 +1,3 @@
-scratch/xattr
-scratch/xattr_2
-scratch/xattr_link
+./xattr
+./xattr_2
+./xattr_link
diff --git a/tests/bsd/xattr.sh b/tests/bsd/xattr.sh
index 4a4658c..68f729a 100644
--- a/tests/bsd/xattr.sh
+++ b/tests/bsd/xattr.sh
@@ -1,3 +1,3 @@
-invoke_bfs scratch -quit -xattr || skip
+invoke_bfs . -quit -xattr || skip
make_xattrs || skip
-bfs_diff scratch -xattr
+bfs_diff . -xattr
diff --git a/tests/bsd/xattrname.out b/tests/bsd/xattrname.out
index 0285ac1..ef732bd 100644
--- a/tests/bsd/xattrname.out
+++ b/tests/bsd/xattrname.out
@@ -1,2 +1,2 @@
-scratch/xattr
-scratch/xattr_link
+./xattr
+./xattr_link
diff --git a/tests/bsd/xattrname.sh b/tests/bsd/xattrname.sh
index 655bd74..38b111a 100644
--- a/tests/bsd/xattrname.sh
+++ b/tests/bsd/xattrname.sh
@@ -1,11 +1,11 @@
-invoke_bfs scratch -quit -xattr || skip
+invoke_bfs . -quit -xattr || skip
make_xattrs || skip
case "$UNAME" in
Darwin|FreeBSD)
- bfs_diff scratch -xattrname bfs_test
+ bfs_diff . -xattrname bfs_test
;;
*)
- bfs_diff scratch -xattrname security.bfs_test
+ bfs_diff . -xattrname security.bfs_test
;;
esac