From 3b387d81e63893ed3fe3b45e3721fbcfb1c5dde0 Mon Sep 17 00:00:00 2001
From: Tavian Barnes <tavianator@tavianator.com>
Date: Wed, 19 Oct 2022 10:29:05 -0400
Subject: tests: Split test cases into separate files

---
 tests/bsd/E.out                      |  1 +
 tests/bsd/E.sh                       |  2 ++
 tests/bsd/H_mnewer.out               |  4 ++++
 tests/bsd/H_mnewer.sh                |  1 +
 tests/bsd/L_acl.out                  |  2 ++
 tests/bsd/L_acl.sh                   |  9 +++++++++
 tests/bsd/L_xattr.out                |  3 +++
 tests/bsd/L_xattr.sh                 |  3 +++
 tests/bsd/L_xattrname.out            |  2 ++
 tests/bsd/L_xattrname.sh             | 11 +++++++++++
 tests/bsd/X.out                      | 19 +++++++++++++++++++
 tests/bsd/X.sh                       |  2 ++
 tests/bsd/acl.out                    |  1 +
 tests/bsd/acl.sh                     |  9 +++++++++
 tests/bsd/asince.out                 |  3 +++
 tests/bsd/asince.sh                  |  1 +
 tests/bsd/d_path.out                 | 19 +++++++++++++++++++
 tests/bsd/d_path.sh                  |  1 +
 tests/bsd/data_flow_depth.out        |  8 ++++++++
 tests/bsd/data_flow_depth.sh         |  1 +
 tests/bsd/data_flow_sparse.out       | 19 +++++++++++++++++++
 tests/bsd/data_flow_sparse.sh        |  1 +
 tests/bsd/depth_depth_n.out          |  6 ++++++
 tests/bsd/depth_depth_n.sh           |  1 +
 tests/bsd/depth_depth_n_minus.out    | 10 ++++++++++
 tests/bsd/depth_depth_n_minus.sh     |  1 +
 tests/bsd/depth_depth_n_plus.out     |  3 +++
 tests/bsd/depth_depth_n_plus.sh      |  1 +
 tests/bsd/depth_n.out                |  6 ++++++
 tests/bsd/depth_n.sh                 |  1 +
 tests/bsd/depth_n_minus.out          | 10 ++++++++++
 tests/bsd/depth_n_minus.sh           |  1 +
 tests/bsd/depth_n_plus.out           |  3 +++
 tests/bsd/depth_n_plus.sh            |  1 +
 tests/bsd/depth_overflow.out         | 19 +++++++++++++++++++
 tests/bsd/depth_overflow.sh          |  1 +
 tests/bsd/exit.out                   |  1 +
 tests/bsd/exit.sh                    | 11 +++++++++++
 tests/bsd/exit_no_implicit_print.out |  0
 tests/bsd/exit_no_implicit_print.sh  |  1 +
 tests/bsd/f.out                      |  4 ++++
 tests/bsd/f.sh                       |  2 ++
 tests/bsd/flags.out                  |  1 +
 tests/bsd/flags.sh                   |  8 ++++++++
 tests/bsd/gid_name.out               | 19 +++++++++++++++++++
 tests/bsd/gid_name.sh                |  1 +
 tests/bsd/mnewer.out                 |  4 ++++
 tests/bsd/mnewer.sh                  |  1 +
 tests/bsd/msince.out                 |  3 +++
 tests/bsd/msince.sh                  |  1 +
 tests/bsd/mtime_units.out            |  5 +++++
 tests/bsd/mtime_units.sh             |  1 +
 tests/bsd/okdir_stdin.out            | 19 +++++++++++++++++++
 tests/bsd/okdir_stdin.sh             |  2 ++
 tests/bsd/perm_000_plus.out          |  8 ++++++++
 tests/bsd/perm_000_plus.sh           |  1 +
 tests/bsd/perm_222_plus.out          |  5 +++++
 tests/bsd/perm_222_plus.sh           |  1 +
 tests/bsd/perm_644_plus.out          |  7 +++++++
 tests/bsd/perm_644_plus.sh           |  1 +
 tests/bsd/printx.out                 | 23 +++++++++++++++++++++++
 tests/bsd/printx.sh                  |  1 +
 tests/bsd/quit_implicit_print.out    |  1 +
 tests/bsd/quit_implicit_print.sh     |  1 +
 tests/bsd/rm.out                     |  1 +
 tests/bsd/rm.sh                      |  6 ++++++
 tests/bsd/s.out                      | 12 ++++++++++++
 tests/bsd/s.sh                       |  2 ++
 tests/bsd/size_T.out                 |  1 +
 tests/bsd/size_T.sh                  |  1 +
 tests/bsd/uid_name.out               | 19 +++++++++++++++++++
 tests/bsd/uid_name.sh                |  1 +
 tests/bsd/xattr.out                  |  3 +++
 tests/bsd/xattr.sh                   |  3 +++
 tests/bsd/xattrname.out              |  2 ++
 tests/bsd/xattrname.sh               | 11 +++++++++++
 76 files changed, 381 insertions(+)
 create mode 100644 tests/bsd/E.out
 create mode 100644 tests/bsd/E.sh
 create mode 100644 tests/bsd/H_mnewer.out
 create mode 100644 tests/bsd/H_mnewer.sh
 create mode 100644 tests/bsd/L_acl.out
 create mode 100644 tests/bsd/L_acl.sh
 create mode 100644 tests/bsd/L_xattr.out
 create mode 100644 tests/bsd/L_xattr.sh
 create mode 100644 tests/bsd/L_xattrname.out
 create mode 100644 tests/bsd/L_xattrname.sh
 create mode 100644 tests/bsd/X.out
 create mode 100644 tests/bsd/X.sh
 create mode 100644 tests/bsd/acl.out
 create mode 100644 tests/bsd/acl.sh
 create mode 100644 tests/bsd/asince.out
 create mode 100644 tests/bsd/asince.sh
 create mode 100644 tests/bsd/d_path.out
 create mode 100644 tests/bsd/d_path.sh
 create mode 100644 tests/bsd/data_flow_depth.out
 create mode 100644 tests/bsd/data_flow_depth.sh
 create mode 100644 tests/bsd/data_flow_sparse.out
 create mode 100644 tests/bsd/data_flow_sparse.sh
 create mode 100644 tests/bsd/depth_depth_n.out
 create mode 100644 tests/bsd/depth_depth_n.sh
 create mode 100644 tests/bsd/depth_depth_n_minus.out
 create mode 100644 tests/bsd/depth_depth_n_minus.sh
 create mode 100644 tests/bsd/depth_depth_n_plus.out
 create mode 100644 tests/bsd/depth_depth_n_plus.sh
 create mode 100644 tests/bsd/depth_n.out
 create mode 100644 tests/bsd/depth_n.sh
 create mode 100644 tests/bsd/depth_n_minus.out
 create mode 100644 tests/bsd/depth_n_minus.sh
 create mode 100644 tests/bsd/depth_n_plus.out
 create mode 100644 tests/bsd/depth_n_plus.sh
 create mode 100644 tests/bsd/depth_overflow.out
 create mode 100644 tests/bsd/depth_overflow.sh
 create mode 100644 tests/bsd/exit.out
 create mode 100644 tests/bsd/exit.sh
 create mode 100644 tests/bsd/exit_no_implicit_print.out
 create mode 100644 tests/bsd/exit_no_implicit_print.sh
 create mode 100644 tests/bsd/f.out
 create mode 100644 tests/bsd/f.sh
 create mode 100644 tests/bsd/flags.out
 create mode 100644 tests/bsd/flags.sh
 create mode 100644 tests/bsd/gid_name.out
 create mode 100644 tests/bsd/gid_name.sh
 create mode 100644 tests/bsd/mnewer.out
 create mode 100644 tests/bsd/mnewer.sh
 create mode 100644 tests/bsd/msince.out
 create mode 100644 tests/bsd/msince.sh
 create mode 100644 tests/bsd/mtime_units.out
 create mode 100644 tests/bsd/mtime_units.sh
 create mode 100644 tests/bsd/okdir_stdin.out
 create mode 100644 tests/bsd/okdir_stdin.sh
 create mode 100644 tests/bsd/perm_000_plus.out
 create mode 100644 tests/bsd/perm_000_plus.sh
 create mode 100644 tests/bsd/perm_222_plus.out
 create mode 100644 tests/bsd/perm_222_plus.sh
 create mode 100644 tests/bsd/perm_644_plus.out
 create mode 100644 tests/bsd/perm_644_plus.sh
 create mode 100644 tests/bsd/printx.out
 create mode 100644 tests/bsd/printx.sh
 create mode 100644 tests/bsd/quit_implicit_print.out
 create mode 100644 tests/bsd/quit_implicit_print.sh
 create mode 100644 tests/bsd/rm.out
 create mode 100644 tests/bsd/rm.sh
 create mode 100644 tests/bsd/s.out
 create mode 100644 tests/bsd/s.sh
 create mode 100644 tests/bsd/size_T.out
 create mode 100644 tests/bsd/size_T.sh
 create mode 100644 tests/bsd/uid_name.out
 create mode 100644 tests/bsd/uid_name.sh
 create mode 100644 tests/bsd/xattr.out
 create mode 100644 tests/bsd/xattr.sh
 create mode 100644 tests/bsd/xattrname.out
 create mode 100644 tests/bsd/xattrname.sh

(limited to 'tests/bsd')

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..1dae00a
--- /dev/null
+++ b/tests/bsd/L_acl.out
@@ -0,0 +1,2 @@
+scratch/acl
+scratch/link
diff --git a/tests/bsd/L_acl.sh b/tests/bsd/L_acl.sh
new file mode 100644
index 0000000..d8f5a7d
--- /dev/null
+++ b/tests/bsd/L_acl.sh
@@ -0,0 +1,9 @@
+rm -rf scratch/*
+
+skip_unless invoke_bfs scratch -quit -acl
+
+$TOUCH scratch/{normal,acl}
+skip_unless set_acl scratch/acl
+ln -s acl scratch/link
+
+bfs_diff -L scratch -acl
diff --git a/tests/bsd/L_xattr.out b/tests/bsd/L_xattr.out
new file mode 100644
index 0000000..12fac95
--- /dev/null
+++ b/tests/bsd/L_xattr.out
@@ -0,0 +1,3 @@
+scratch/link
+scratch/xattr
+scratch/xattr_2
diff --git a/tests/bsd/L_xattr.sh b/tests/bsd/L_xattr.sh
new file mode 100644
index 0000000..7c27e0d
--- /dev/null
+++ b/tests/bsd/L_xattr.sh
@@ -0,0 +1,3 @@
+skip_unless invoke_bfs scratch -quit -xattr
+skip_unless make_xattrs
+bfs_diff -L scratch -xattr
diff --git a/tests/bsd/L_xattrname.out b/tests/bsd/L_xattrname.out
new file mode 100644
index 0000000..4dc4836
--- /dev/null
+++ b/tests/bsd/L_xattrname.out
@@ -0,0 +1,2 @@
+scratch/link
+scratch/xattr
diff --git a/tests/bsd/L_xattrname.sh b/tests/bsd/L_xattrname.sh
new file mode 100644
index 0000000..39d6a77
--- /dev/null
+++ b/tests/bsd/L_xattrname.sh
@@ -0,0 +1,11 @@
+skip_unless invoke_bfs scratch -quit -xattr
+skip_unless make_xattrs
+
+case "$UNAME" in
+    Darwin|FreeBSD)
+        bfs_diff -L scratch -xattrname bfs_test
+        ;;
+    *)
+        bfs_diff -L scratch -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..03d9eee
--- /dev/null
+++ b/tests/bsd/X.sh
@@ -0,0 +1,2 @@
+bfs_diff -X weirdnames
+[ $? -eq $EX_BFS ]
diff --git a/tests/bsd/acl.out b/tests/bsd/acl.out
new file mode 100644
index 0000000..ddf8446
--- /dev/null
+++ b/tests/bsd/acl.out
@@ -0,0 +1 @@
+scratch/acl
diff --git a/tests/bsd/acl.sh b/tests/bsd/acl.sh
new file mode 100644
index 0000000..5bbfccc
--- /dev/null
+++ b/tests/bsd/acl.sh
@@ -0,0 +1,9 @@
+rm -rf scratch/*
+
+skip_unless invoke_bfs scratch -quit -acl
+
+$TOUCH scratch/{normal,acl}
+skip_unless set_acl scratch/acl
+ln -s acl scratch/link
+
+bfs_diff scratch -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..524a75f
--- /dev/null
+++ b/tests/bsd/exit.sh
@@ -0,0 +1,11 @@
+invoke_bfs basic -name foo -exit 42
+if [ $? -ne 42 ]; then
+    return 1
+fi
+
+invoke_bfs basic -name qux -exit 42
+if [ $? -ne 0 ]; then
+    return 1
+fi
+
+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
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/flags.out b/tests/bsd/flags.out
new file mode 100644
index 0000000..11998ed
--- /dev/null
+++ b/tests/bsd/flags.out
@@ -0,0 +1 @@
+scratch/bar
diff --git a/tests/bsd/flags.sh b/tests/bsd/flags.sh
new file mode 100644
index 0000000..99d0fdb
--- /dev/null
+++ b/tests/bsd/flags.sh
@@ -0,0 +1,8 @@
+skip_unless invoke_bfs scratch -quit -flags offline
+
+rm -rf scratch/*
+
+$TOUCH scratch/{foo,bar}
+skip_unless chflags offline scratch/bar
+
+bfs_diff scratch -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_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..fb188b9
--- /dev/null
+++ b/tests/bsd/rm.out
@@ -0,0 +1 @@
+scratch
diff --git a/tests/bsd/rm.sh b/tests/bsd/rm.sh
new file mode 100644
index 0000000..2e8b613
--- /dev/null
+++ b/tests/bsd/rm.sh
@@ -0,0 +1,6 @@
+rm -rf scratch/*
+touchp scratch/foo/bar/baz
+
+(cd scratch && invoke_bfs . -rm)
+
+bfs_diff scratch
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/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/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..109e7c9
--- /dev/null
+++ b/tests/bsd/xattr.out
@@ -0,0 +1,3 @@
+scratch/xattr
+scratch/xattr_2
+scratch/xattr_link
diff --git a/tests/bsd/xattr.sh b/tests/bsd/xattr.sh
new file mode 100644
index 0000000..727c220
--- /dev/null
+++ b/tests/bsd/xattr.sh
@@ -0,0 +1,3 @@
+skip_unless invoke_bfs scratch -quit -xattr
+skip_unless make_xattrs
+bfs_diff scratch -xattr
diff --git a/tests/bsd/xattrname.out b/tests/bsd/xattrname.out
new file mode 100644
index 0000000..0285ac1
--- /dev/null
+++ b/tests/bsd/xattrname.out
@@ -0,0 +1,2 @@
+scratch/xattr
+scratch/xattr_link
diff --git a/tests/bsd/xattrname.sh b/tests/bsd/xattrname.sh
new file mode 100644
index 0000000..6a0fe7e
--- /dev/null
+++ b/tests/bsd/xattrname.sh
@@ -0,0 +1,11 @@
+skip_unless invoke_bfs scratch -quit -xattr
+skip_unless make_xattrs
+
+case "$UNAME" in
+    Darwin|FreeBSD)
+        bfs_diff scratch -xattrname bfs_test
+        ;;
+    *)
+        bfs_diff scratch -xattrname security.bfs_test
+        ;;
+esac
-- 
cgit v1.2.3