summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-10-19 10:29:05 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-10-19 11:50:03 -0400
commit3b387d81e63893ed3fe3b45e3721fbcfb1c5dde0 (patch)
tree513c32eda43d92a8ed977f394492ba198bba1f3b /tests/common
parente5972621ffa8864b18d3e303ac714fdbe231be74 (diff)
downloadbfs-3b387d81e63893ed3fe3b45e3721fbcfb1c5dde0.tar.xz
tests: Split test cases into separate files
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/H_newer.out4
-rw-r--r--tests/common/H_newer.sh1
-rw-r--r--tests/common/H_samefile_broken.out1
-rw-r--r--tests/common/H_samefile_broken.sh1
-rw-r--r--tests/common/H_samefile_notdir.out1
-rw-r--r--tests/common/H_samefile_notdir.sh1
-rw-r--r--tests/common/H_samefile_symlink.out2
-rw-r--r--tests/common/H_samefile_symlink.sh1
-rw-r--r--tests/common/L_ilname.out0
-rw-r--r--tests/common/L_ilname.sh2
-rw-r--r--tests/common/L_lname.out0
-rw-r--r--tests/common/L_lname.sh1
-rw-r--r--tests/common/L_ls.sh1
-rw-r--r--tests/common/L_mount.out5
-rw-r--r--tests/common/L_mount.sh15
-rw-r--r--tests/common/L_samefile_broken.out1
-rw-r--r--tests/common/L_samefile_broken.sh1
-rw-r--r--tests/common/L_samefile_notdir.out1
-rw-r--r--tests/common/L_samefile_notdir.sh1
-rw-r--r--tests/common/L_samefile_symlink.out3
-rw-r--r--tests/common/L_samefile_symlink.sh1
-rw-r--r--tests/common/P.out1
-rw-r--r--tests/common/P.sh1
-rw-r--r--tests/common/P_slash.out1
-rw-r--r--tests/common/P_slash.sh1
-rw-r--r--tests/common/anewer.out4
-rw-r--r--tests/common/anewer.sh1
-rw-r--r--tests/common/delete.out1
-rw-r--r--tests/common/delete.sh7
-rw-r--r--tests/common/delete_many.out1
-rw-r--r--tests/common/delete_many.sh8
-rw-r--r--tests/common/depth_maxdepth_1.out10
-rw-r--r--tests/common/depth_maxdepth_1.sh1
-rw-r--r--tests/common/depth_maxdepth_2.out16
-rw-r--r--tests/common/depth_maxdepth_2.sh1
-rw-r--r--tests/common/depth_mindepth_1.out18
-rw-r--r--tests/common/depth_mindepth_1.sh1
-rw-r--r--tests/common/depth_mindepth_2.out9
-rw-r--r--tests/common/depth_mindepth_2.sh1
-rw-r--r--tests/common/double_dash.out7
-rw-r--r--tests/common/double_dash.sh2
-rw-r--r--tests/common/exec_substring.out19
-rw-r--r--tests/common/exec_substring.sh1
-rw-r--r--tests/common/execdir_nonexistent.out19
-rw-r--r--tests/common/execdir_nonexistent.sh5
-rw-r--r--tests/common/execdir_pwd.out19
-rw-r--r--tests/common/execdir_pwd.sh3
-rw-r--r--tests/common/execdir_slash.out1
-rw-r--r--tests/common/execdir_slash.sh2
-rw-r--r--tests/common/execdir_slash_pwd.out1
-rw-r--r--tests/common/execdir_slash_pwd.sh1
-rw-r--r--tests/common/execdir_slashes.out1
-rw-r--r--tests/common/execdir_slashes.sh1
-rw-r--r--tests/common/execdir_ulimit.out40
-rw-r--r--tests/common/execdir_ulimit.sh7
-rw-r--r--tests/common/flag_double_dash.out7
-rw-r--r--tests/common/flag_double_dash.sh2
-rw-r--r--tests/common/follow.out17
-rw-r--r--tests/common/follow.sh1
-rw-r--r--tests/common/ilname.out0
-rw-r--r--tests/common/ilname.sh2
-rw-r--r--tests/common/iname.out4
-rw-r--r--tests/common/iname.sh2
-rw-r--r--tests/common/inum.out1
-rw-r--r--tests/common/inum.sh1
-rw-r--r--tests/common/inum_bind_mount.out2
-rw-r--r--tests/common/inum_bind_mount.sh12
-rw-r--r--tests/common/inum_mount.out1
-rw-r--r--tests/common/inum_mount.sh12
-rw-r--r--tests/common/ipath.out7
-rw-r--r--tests/common/ipath.sh2
-rw-r--r--tests/common/iregex.out3
-rw-r--r--tests/common/iregex.sh1
-rw-r--r--tests/common/lname.out0
-rw-r--r--tests/common/lname.sh1
-rw-r--r--tests/common/ls.sh1
-rw-r--r--tests/common/maxdepth.out10
-rw-r--r--tests/common/maxdepth.sh1
-rw-r--r--tests/common/mindepth.out18
-rw-r--r--tests/common/mindepth.sh1
-rw-r--r--tests/common/mount.out4
-rw-r--r--tests/common/mount.sh13
-rw-r--r--tests/common/name_slash.out1
-rw-r--r--tests/common/name_slash.sh1
-rw-r--r--tests/common/name_slashes.out1
-rw-r--r--tests/common/name_slashes.sh1
-rw-r--r--tests/common/newerma.out4
-rw-r--r--tests/common/newerma.sh1
-rw-r--r--tests/common/newermt.out3
-rw-r--r--tests/common/newermt.sh1
-rw-r--r--tests/common/newermt_epoch_minus_one.out5
-rw-r--r--tests/common/newermt_epoch_minus_one.sh1
-rw-r--r--tests/common/ok_closed_stdin.out0
-rw-r--r--tests/common/ok_closed_stdin.sh1
-rw-r--r--tests/common/okdir_closed_stdin.out0
-rw-r--r--tests/common/okdir_closed_stdin.sh1
-rw-r--r--tests/common/quit.out1
-rw-r--r--tests/common/quit.sh1
-rw-r--r--tests/common/quit_after_print.out1
-rw-r--r--tests/common/quit_after_print.sh1
-rw-r--r--tests/common/quit_before_print.out0
-rw-r--r--tests/common/quit_before_print.sh1
-rw-r--r--tests/common/quit_child.out2
-rw-r--r--tests/common/quit_child.sh1
-rw-r--r--tests/common/quit_depth.out2
-rw-r--r--tests/common/quit_depth.sh1
-rw-r--r--tests/common/quit_depth_child.out1
-rw-r--r--tests/common/quit_depth_child.sh1
-rw-r--r--tests/common/regex.out3
-rw-r--r--tests/common/regex.sh1
-rw-r--r--tests/common/regex_parens.out1
-rw-r--r--tests/common/regex_parens.sh2
-rw-r--r--tests/common/samefile.out2
-rw-r--r--tests/common/samefile.sh1
-rw-r--r--tests/common/samefile_broken.out1
-rw-r--r--tests/common/samefile_broken.sh1
-rw-r--r--tests/common/samefile_notdir.out1
-rw-r--r--tests/common/samefile_notdir.sh1
-rw-r--r--tests/common/samefile_symlink.out1
-rw-r--r--tests/common/samefile_symlink.sh1
-rw-r--r--tests/common/size_big.out0
-rw-r--r--tests/common/size_big.sh1
122 files changed, 433 insertions, 0 deletions
diff --git a/tests/common/H_newer.out b/tests/common/H_newer.out
new file mode 100644
index 0000000..7f6c0dd
--- /dev/null
+++ b/tests/common/H_newer.out
@@ -0,0 +1,4 @@
+times
+times/b
+times/c
+times/l
diff --git a/tests/common/H_newer.sh b/tests/common/H_newer.sh
new file mode 100644
index 0000000..c72bff7
--- /dev/null
+++ b/tests/common/H_newer.sh
@@ -0,0 +1 @@
+bfs_diff -H times -newer times/l
diff --git a/tests/common/H_samefile_broken.out b/tests/common/H_samefile_broken.out
new file mode 100644
index 0000000..21d6316
--- /dev/null
+++ b/tests/common/H_samefile_broken.out
@@ -0,0 +1 @@
+links/broken
diff --git a/tests/common/H_samefile_broken.sh b/tests/common/H_samefile_broken.sh
new file mode 100644
index 0000000..7a3366d
--- /dev/null
+++ b/tests/common/H_samefile_broken.sh
@@ -0,0 +1 @@
+bfs_diff -H links -samefile links/broken
diff --git a/tests/common/H_samefile_notdir.out b/tests/common/H_samefile_notdir.out
new file mode 100644
index 0000000..6e6658d
--- /dev/null
+++ b/tests/common/H_samefile_notdir.out
@@ -0,0 +1 @@
+links/notdir
diff --git a/tests/common/H_samefile_notdir.sh b/tests/common/H_samefile_notdir.sh
new file mode 100644
index 0000000..25ad88d
--- /dev/null
+++ b/tests/common/H_samefile_notdir.sh
@@ -0,0 +1 @@
+bfs_diff -H links -samefile links/notdir
diff --git a/tests/common/H_samefile_symlink.out b/tests/common/H_samefile_symlink.out
new file mode 100644
index 0000000..996ffc8
--- /dev/null
+++ b/tests/common/H_samefile_symlink.out
@@ -0,0 +1,2 @@
+links/file
+links/hardlink
diff --git a/tests/common/H_samefile_symlink.sh b/tests/common/H_samefile_symlink.sh
new file mode 100644
index 0000000..c73ddb2
--- /dev/null
+++ b/tests/common/H_samefile_symlink.sh
@@ -0,0 +1 @@
+bfs_diff -H links -samefile links/symlink
diff --git a/tests/common/L_ilname.out b/tests/common/L_ilname.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/L_ilname.out
diff --git a/tests/common/L_ilname.sh b/tests/common/L_ilname.sh
new file mode 100644
index 0000000..cfb15a8
--- /dev/null
+++ b/tests/common/L_ilname.sh
@@ -0,0 +1,2 @@
+skip_unless invoke_bfs -quit -ilname PATTERN
+bfs_diff -L links -ilname '[AQ]'
diff --git a/tests/common/L_lname.out b/tests/common/L_lname.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/L_lname.out
diff --git a/tests/common/L_lname.sh b/tests/common/L_lname.sh
new file mode 100644
index 0000000..65b9da5
--- /dev/null
+++ b/tests/common/L_lname.sh
@@ -0,0 +1 @@
+bfs_diff -L links -lname '[aq]'
diff --git a/tests/common/L_ls.sh b/tests/common/L_ls.sh
new file mode 100644
index 0000000..d886791
--- /dev/null
+++ b/tests/common/L_ls.sh
@@ -0,0 +1 @@
+invoke_bfs -L rainbow -ls >scratch/L_ls.out
diff --git a/tests/common/L_mount.out b/tests/common/L_mount.out
new file mode 100644
index 0000000..2e80082
--- /dev/null
+++ b/tests/common/L_mount.out
@@ -0,0 +1,5 @@
+scratch
+scratch/foo
+scratch/foo/bar
+scratch/foo/qux
+scratch/mnt
diff --git a/tests/common/L_mount.sh b/tests/common/L_mount.sh
new file mode 100644
index 0000000..d43f95a
--- /dev/null
+++ b/tests/common/L_mount.sh
@@ -0,0 +1,15 @@
+skip_unless test "$SUDO"
+skip_if test "$UNAME" = "Darwin"
+
+rm -rf scratch/*
+mkdir scratch/{foo,mnt}
+sudo mount -t tmpfs tmpfs scratch/mnt
+ln -s ../mnt scratch/foo/bar
+$TOUCH scratch/mnt/baz
+ln -s ../mnt/baz scratch/foo/qux
+
+bfs_diff -L scratch -mount
+ret=$?
+
+sudo umount scratch/mnt
+return $ret
diff --git a/tests/common/L_samefile_broken.out b/tests/common/L_samefile_broken.out
new file mode 100644
index 0000000..21d6316
--- /dev/null
+++ b/tests/common/L_samefile_broken.out
@@ -0,0 +1 @@
+links/broken
diff --git a/tests/common/L_samefile_broken.sh b/tests/common/L_samefile_broken.sh
new file mode 100644
index 0000000..5f860cc
--- /dev/null
+++ b/tests/common/L_samefile_broken.sh
@@ -0,0 +1 @@
+bfs_diff -L links -samefile links/broken
diff --git a/tests/common/L_samefile_notdir.out b/tests/common/L_samefile_notdir.out
new file mode 100644
index 0000000..6e6658d
--- /dev/null
+++ b/tests/common/L_samefile_notdir.out
@@ -0,0 +1 @@
+links/notdir
diff --git a/tests/common/L_samefile_notdir.sh b/tests/common/L_samefile_notdir.sh
new file mode 100644
index 0000000..9b63429
--- /dev/null
+++ b/tests/common/L_samefile_notdir.sh
@@ -0,0 +1 @@
+bfs_diff -L links -samefile links/notdir
diff --git a/tests/common/L_samefile_symlink.out b/tests/common/L_samefile_symlink.out
new file mode 100644
index 0000000..222ac78
--- /dev/null
+++ b/tests/common/L_samefile_symlink.out
@@ -0,0 +1,3 @@
+links/file
+links/hardlink
+links/symlink
diff --git a/tests/common/L_samefile_symlink.sh b/tests/common/L_samefile_symlink.sh
new file mode 100644
index 0000000..4a7a8dd
--- /dev/null
+++ b/tests/common/L_samefile_symlink.sh
@@ -0,0 +1 @@
+bfs_diff -L links -samefile links/symlink
diff --git a/tests/common/P.out b/tests/common/P.out
new file mode 100644
index 0000000..ff635ff
--- /dev/null
+++ b/tests/common/P.out
@@ -0,0 +1 @@
+links/deeply/nested/dir
diff --git a/tests/common/P.sh b/tests/common/P.sh
new file mode 100644
index 0000000..a7a09d1
--- /dev/null
+++ b/tests/common/P.sh
@@ -0,0 +1 @@
+bfs_diff -P links/deeply/nested/dir
diff --git a/tests/common/P_slash.out b/tests/common/P_slash.out
new file mode 100644
index 0000000..df7701b
--- /dev/null
+++ b/tests/common/P_slash.out
@@ -0,0 +1 @@
+links/deeply/nested/dir/
diff --git a/tests/common/P_slash.sh b/tests/common/P_slash.sh
new file mode 100644
index 0000000..9b9ffa0
--- /dev/null
+++ b/tests/common/P_slash.sh
@@ -0,0 +1 @@
+bfs_diff -P links/deeply/nested/dir/
diff --git a/tests/common/anewer.out b/tests/common/anewer.out
new file mode 100644
index 0000000..7f6c0dd
--- /dev/null
+++ b/tests/common/anewer.out
@@ -0,0 +1,4 @@
+times
+times/b
+times/c
+times/l
diff --git a/tests/common/anewer.sh b/tests/common/anewer.sh
new file mode 100644
index 0000000..0cdd759
--- /dev/null
+++ b/tests/common/anewer.sh
@@ -0,0 +1 @@
+bfs_diff times -anewer times/a
diff --git a/tests/common/delete.out b/tests/common/delete.out
new file mode 100644
index 0000000..fb188b9
--- /dev/null
+++ b/tests/common/delete.out
@@ -0,0 +1 @@
+scratch
diff --git a/tests/common/delete.sh b/tests/common/delete.sh
new file mode 100644
index 0000000..4855d60
--- /dev/null
+++ b/tests/common/delete.sh
@@ -0,0 +1,7 @@
+rm -rf scratch/*
+touchp scratch/foo/bar/baz
+
+# Don't try to delete '.'
+(cd scratch && invoke_bfs . -delete)
+
+bfs_diff scratch
diff --git a/tests/common/delete_many.out b/tests/common/delete_many.out
new file mode 100644
index 0000000..fb188b9
--- /dev/null
+++ b/tests/common/delete_many.out
@@ -0,0 +1 @@
+scratch
diff --git a/tests/common/delete_many.sh b/tests/common/delete_many.sh
new file mode 100644
index 0000000..6446f93
--- /dev/null
+++ b/tests/common/delete_many.sh
@@ -0,0 +1,8 @@
+# Test for https://github.com/tavianator/bfs/issues/67
+
+rm -rf scratch/*
+mkdir scratch/foo
+$TOUCH scratch/foo/{1..256}
+
+invoke_bfs scratch/foo -delete
+bfs_diff scratch
diff --git a/tests/common/depth_maxdepth_1.out b/tests/common/depth_maxdepth_1.out
new file mode 100644
index 0000000..7575ae4
--- /dev/null
+++ b/tests/common/depth_maxdepth_1.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/common/depth_maxdepth_1.sh b/tests/common/depth_maxdepth_1.sh
new file mode 100644
index 0000000..4b7e538
--- /dev/null
+++ b/tests/common/depth_maxdepth_1.sh
@@ -0,0 +1 @@
+bfs_diff basic -maxdepth 1 -depth
diff --git a/tests/common/depth_maxdepth_2.out b/tests/common/depth_maxdepth_2.out
new file mode 100644
index 0000000..c53041e
--- /dev/null
+++ b/tests/common/depth_maxdepth_2.out
@@ -0,0 +1,16 @@
+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/l
+basic/l/foo
diff --git a/tests/common/depth_maxdepth_2.sh b/tests/common/depth_maxdepth_2.sh
new file mode 100644
index 0000000..2c49a65
--- /dev/null
+++ b/tests/common/depth_maxdepth_2.sh
@@ -0,0 +1 @@
+bfs_diff basic -maxdepth 2 -depth
diff --git a/tests/common/depth_mindepth_1.out b/tests/common/depth_mindepth_1.out
new file mode 100644
index 0000000..3b461cf
--- /dev/null
+++ b/tests/common/depth_mindepth_1.out
@@ -0,0 +1,18 @@
+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/common/depth_mindepth_1.sh b/tests/common/depth_mindepth_1.sh
new file mode 100644
index 0000000..868d9e1
--- /dev/null
+++ b/tests/common/depth_mindepth_1.sh
@@ -0,0 +1 @@
+bfs_diff basic -mindepth 1 -depth
diff --git a/tests/common/depth_mindepth_2.out b/tests/common/depth_mindepth_2.out
new file mode 100644
index 0000000..6ccd80a
--- /dev/null
+++ b/tests/common/depth_mindepth_2.out
@@ -0,0 +1,9 @@
+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
+basic/l/foo/bar/baz
diff --git a/tests/common/depth_mindepth_2.sh b/tests/common/depth_mindepth_2.sh
new file mode 100644
index 0000000..2031b2c
--- /dev/null
+++ b/tests/common/depth_mindepth_2.sh
@@ -0,0 +1 @@
+bfs_diff basic -mindepth 2 -depth
diff --git a/tests/common/double_dash.out b/tests/common/double_dash.out
new file mode 100644
index 0000000..774cc7c
--- /dev/null
+++ b/tests/common/double_dash.out
@@ -0,0 +1,7 @@
+./a
+./b
+./c/d
+./e/f
+./j/foo
+./k/foo/bar
+./l/foo/bar/baz
diff --git a/tests/common/double_dash.sh b/tests/common/double_dash.sh
new file mode 100644
index 0000000..1a7a118
--- /dev/null
+++ b/tests/common/double_dash.sh
@@ -0,0 +1,2 @@
+cd basic
+bfs_diff -- . -type f
diff --git a/tests/common/exec_substring.out b/tests/common/exec_substring.out
new file mode 100644
index 0000000..32a6353
--- /dev/null
+++ b/tests/common/exec_substring.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/common/exec_substring.sh b/tests/common/exec_substring.sh
new file mode 100644
index 0000000..5cf8e85
--- /dev/null
+++ b/tests/common/exec_substring.sh
@@ -0,0 +1 @@
+bfs_diff basic -exec echo '-{}-' \;
diff --git a/tests/common/execdir_nonexistent.out b/tests/common/execdir_nonexistent.out
new file mode 100644
index 0000000..a7ccfe4
--- /dev/null
+++ b/tests/common/execdir_nonexistent.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/common/execdir_nonexistent.sh b/tests/common/execdir_nonexistent.sh
new file mode 100644
index 0000000..5d116e5
--- /dev/null
+++ b/tests/common/execdir_nonexistent.sh
@@ -0,0 +1,5 @@
+stderr=$(invoke_bfs basic -execdir "$TESTS/nonexistent" {} \; 2>&1 >/dev/null)
+[ -n "$stderr" ] || return 1
+
+bfs_diff basic -print -execdir "$TESTS/nonexistent" {} \; -print
+(($? == EX_BFS))
diff --git a/tests/common/execdir_pwd.out b/tests/common/execdir_pwd.out
new file mode 100644
index 0000000..a11cd25
--- /dev/null
+++ b/tests/common/execdir_pwd.out
@@ -0,0 +1,19 @@
+
+basic
+basic
+basic
+basic
+basic
+basic
+basic
+basic
+basic
+basic/c
+basic/e
+basic/g
+basic/j
+basic/k
+basic/k/foo
+basic/l
+basic/l/foo
+basic/l/foo/bar
diff --git a/tests/common/execdir_pwd.sh b/tests/common/execdir_pwd.sh
new file mode 100644
index 0000000..1c0165a
--- /dev/null
+++ b/tests/common/execdir_pwd.sh
@@ -0,0 +1,3 @@
+TMP_REAL=$(cd "$TMP" && pwd)
+OFFSET=$((${#TMP_REAL} + 2))
+bfs_diff basic -execdir bash -c "pwd | cut -b$OFFSET-" \;
diff --git a/tests/common/execdir_slash.out b/tests/common/execdir_slash.out
new file mode 100644
index 0000000..b498fd4
--- /dev/null
+++ b/tests/common/execdir_slash.out
@@ -0,0 +1 @@
+/
diff --git a/tests/common/execdir_slash.sh b/tests/common/execdir_slash.sh
new file mode 100644
index 0000000..965f679
--- /dev/null
+++ b/tests/common/execdir_slash.sh
@@ -0,0 +1,2 @@
+# Don't prepend ./ for absolute paths in -execdir
+bfs_diff / -maxdepth 0 -execdir echo {} \;
diff --git a/tests/common/execdir_slash_pwd.out b/tests/common/execdir_slash_pwd.out
new file mode 100644
index 0000000..b498fd4
--- /dev/null
+++ b/tests/common/execdir_slash_pwd.out
@@ -0,0 +1 @@
+/
diff --git a/tests/common/execdir_slash_pwd.sh b/tests/common/execdir_slash_pwd.sh
new file mode 100644
index 0000000..9c82e09
--- /dev/null
+++ b/tests/common/execdir_slash_pwd.sh
@@ -0,0 +1 @@
+bfs_diff / -maxdepth 0 -execdir pwd \;
diff --git a/tests/common/execdir_slashes.out b/tests/common/execdir_slashes.out
new file mode 100644
index 0000000..b498fd4
--- /dev/null
+++ b/tests/common/execdir_slashes.out
@@ -0,0 +1 @@
+/
diff --git a/tests/common/execdir_slashes.sh b/tests/common/execdir_slashes.sh
new file mode 100644
index 0000000..4e2b327
--- /dev/null
+++ b/tests/common/execdir_slashes.sh
@@ -0,0 +1 @@
+bfs_diff /// -maxdepth 0 -execdir echo {} \;
diff --git a/tests/common/execdir_ulimit.out b/tests/common/execdir_ulimit.out
new file mode 100644
index 0000000..7f53982
--- /dev/null
+++ b/tests/common/execdir_ulimit.out
@@ -0,0 +1,40 @@
+./0
+./1
+./2
+./3
+./4
+./5
+./6
+./7
+./8
+./9
+./A
+./B
+./C
+./a
+./b
+./c
+./d
+./e
+./f
+./g
+./h
+./i
+./j
+./k
+./l
+./m
+./n
+./o
+./p
+./q
+./r
+./s
+./scratch
+./t
+./u
+./v
+./w
+./x
+./y
+./z
diff --git a/tests/common/execdir_ulimit.sh b/tests/common/execdir_ulimit.sh
new file mode 100644
index 0000000..6da8783
--- /dev/null
+++ b/tests/common/execdir_ulimit.sh
@@ -0,0 +1,7 @@
+rm -rf scratch/*
+mkdir -p scratch/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z
+mkdir -p scratch/a/b/c/d/e/f/g/h/i/j/k/l/m/0/1/2/3/4/5/6/7/8/9/A/B/C
+
+closefrom 4
+ulimit -n 13
+bfs_diff scratch -execdir echo {} \;
diff --git a/tests/common/flag_double_dash.out b/tests/common/flag_double_dash.out
new file mode 100644
index 0000000..774cc7c
--- /dev/null
+++ b/tests/common/flag_double_dash.out
@@ -0,0 +1,7 @@
+./a
+./b
+./c/d
+./e/f
+./j/foo
+./k/foo/bar
+./l/foo/bar/baz
diff --git a/tests/common/flag_double_dash.sh b/tests/common/flag_double_dash.sh
new file mode 100644
index 0000000..1075b06
--- /dev/null
+++ b/tests/common/flag_double_dash.sh
@@ -0,0 +1,2 @@
+cd basic
+bfs_diff -L -- . -type f
diff --git a/tests/common/follow.out b/tests/common/follow.out
new file mode 100644
index 0000000..ec9e861
--- /dev/null
+++ b/tests/common/follow.out
@@ -0,0 +1,17 @@
+links
+links/broken
+links/deeply
+links/deeply/nested
+links/deeply/nested/broken
+links/deeply/nested/dir
+links/deeply/nested/file
+links/deeply/nested/link
+links/file
+links/hardlink
+links/notdir
+links/skip
+links/skip/broken
+links/skip/dir
+links/skip/file
+links/skip/link
+links/symlink
diff --git a/tests/common/follow.sh b/tests/common/follow.sh
new file mode 100644
index 0000000..b5a2ae1
--- /dev/null
+++ b/tests/common/follow.sh
@@ -0,0 +1 @@
+bfs_diff links -follow
diff --git a/tests/common/ilname.out b/tests/common/ilname.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/ilname.out
diff --git a/tests/common/ilname.sh b/tests/common/ilname.sh
new file mode 100644
index 0000000..7ab0793
--- /dev/null
+++ b/tests/common/ilname.sh
@@ -0,0 +1,2 @@
+skip_unless invoke_bfs -quit -ilname PATTERN
+bfs_diff links -ilname '[AQ]'
diff --git a/tests/common/iname.out b/tests/common/iname.out
new file mode 100644
index 0000000..a9e5d42
--- /dev/null
+++ b/tests/common/iname.out
@@ -0,0 +1,4 @@
+basic/e/f
+basic/j/foo
+basic/k/foo
+basic/l/foo
diff --git a/tests/common/iname.sh b/tests/common/iname.sh
new file mode 100644
index 0000000..8fcc443
--- /dev/null
+++ b/tests/common/iname.sh
@@ -0,0 +1,2 @@
+skip_unless invoke_bfs -quit -iname PATTERN
+bfs_diff basic -iname '*F*'
diff --git a/tests/common/inum.out b/tests/common/inum.out
new file mode 100644
index 0000000..ebcaf79
--- /dev/null
+++ b/tests/common/inum.out
@@ -0,0 +1 @@
+basic/k/foo/bar
diff --git a/tests/common/inum.sh b/tests/common/inum.sh
new file mode 100644
index 0000000..ca63bbb
--- /dev/null
+++ b/tests/common/inum.sh
@@ -0,0 +1 @@
+bfs_diff basic -inum "$(inum basic/k/foo/bar)"
diff --git a/tests/common/inum_bind_mount.out b/tests/common/inum_bind_mount.out
new file mode 100644
index 0000000..a520de3
--- /dev/null
+++ b/tests/common/inum_bind_mount.out
@@ -0,0 +1,2 @@
+scratch/bar
+scratch/foo
diff --git a/tests/common/inum_bind_mount.sh b/tests/common/inum_bind_mount.sh
new file mode 100644
index 0000000..654e762
--- /dev/null
+++ b/tests/common/inum_bind_mount.sh
@@ -0,0 +1,12 @@
+skip_unless test "$SUDO"
+skip_unless test "$UNAME" = "Linux"
+
+rm -rf scratch/*
+$TOUCH scratch/{foo,bar}
+sudo mount --bind scratch/{foo,bar}
+
+bfs_diff scratch -inum "$(inum scratch/bar)"
+ret=$?
+
+sudo umount scratch/bar
+return $ret
diff --git a/tests/common/inum_mount.out b/tests/common/inum_mount.out
new file mode 100644
index 0000000..99c7511
--- /dev/null
+++ b/tests/common/inum_mount.out
@@ -0,0 +1 @@
+scratch/mnt
diff --git a/tests/common/inum_mount.sh b/tests/common/inum_mount.sh
new file mode 100644
index 0000000..8f5c317
--- /dev/null
+++ b/tests/common/inum_mount.sh
@@ -0,0 +1,12 @@
+skip_unless test "$SUDO"
+skip_if test "$UNAME" = "Darwin"
+
+rm -rf scratch/*
+mkdir scratch/{foo,mnt}
+sudo mount -t tmpfs tmpfs scratch/mnt
+
+bfs_diff scratch -inum "$(inum scratch/mnt)"
+ret=$?
+
+sudo umount scratch/mnt
+return $ret
diff --git a/tests/common/ipath.out b/tests/common/ipath.out
new file mode 100644
index 0000000..ae1ae21
--- /dev/null
+++ b/tests/common/ipath.out
@@ -0,0 +1,7 @@
+basic/e/f
+basic/j/foo
+basic/k/foo
+basic/k/foo/bar
+basic/l/foo
+basic/l/foo/bar
+basic/l/foo/bar/baz
diff --git a/tests/common/ipath.sh b/tests/common/ipath.sh
new file mode 100644
index 0000000..9e6f8c5
--- /dev/null
+++ b/tests/common/ipath.sh
@@ -0,0 +1,2 @@
+skip_unless invoke_bfs -quit -ipath PATTERN
+bfs_diff basic -ipath 'basic/*F*'
diff --git a/tests/common/iregex.out b/tests/common/iregex.out
new file mode 100644
index 0000000..cfc113b
--- /dev/null
+++ b/tests/common/iregex.out
@@ -0,0 +1,3 @@
+basic/c/d
+basic/e/f
+basic/g/h
diff --git a/tests/common/iregex.sh b/tests/common/iregex.sh
new file mode 100644
index 0000000..fc782f5
--- /dev/null
+++ b/tests/common/iregex.sh
@@ -0,0 +1 @@
+bfs_diff basic -iregex 'basic/[A-Z]/[a-z]'
diff --git a/tests/common/lname.out b/tests/common/lname.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/lname.out
diff --git a/tests/common/lname.sh b/tests/common/lname.sh
new file mode 100644
index 0000000..cf8a2a1
--- /dev/null
+++ b/tests/common/lname.sh
@@ -0,0 +1 @@
+bfs_diff links -lname '[aq]'
diff --git a/tests/common/ls.sh b/tests/common/ls.sh
new file mode 100644
index 0000000..b49a2d5
--- /dev/null
+++ b/tests/common/ls.sh
@@ -0,0 +1 @@
+invoke_bfs rainbow -ls >scratch/ls.out
diff --git a/tests/common/maxdepth.out b/tests/common/maxdepth.out
new file mode 100644
index 0000000..7575ae4
--- /dev/null
+++ b/tests/common/maxdepth.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/common/maxdepth.sh b/tests/common/maxdepth.sh
new file mode 100644
index 0000000..bb47cc9
--- /dev/null
+++ b/tests/common/maxdepth.sh
@@ -0,0 +1 @@
+bfs_diff basic -maxdepth 1
diff --git a/tests/common/mindepth.out b/tests/common/mindepth.out
new file mode 100644
index 0000000..3b461cf
--- /dev/null
+++ b/tests/common/mindepth.out
@@ -0,0 +1,18 @@
+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/common/mindepth.sh b/tests/common/mindepth.sh
new file mode 100644
index 0000000..22d7770
--- /dev/null
+++ b/tests/common/mindepth.sh
@@ -0,0 +1 @@
+bfs_diff basic -mindepth 1
diff --git a/tests/common/mount.out b/tests/common/mount.out
new file mode 100644
index 0000000..f7839fb
--- /dev/null
+++ b/tests/common/mount.out
@@ -0,0 +1,4 @@
+scratch
+scratch/foo
+scratch/foo/bar
+scratch/mnt
diff --git a/tests/common/mount.sh b/tests/common/mount.sh
new file mode 100644
index 0000000..6e20d90
--- /dev/null
+++ b/tests/common/mount.sh
@@ -0,0 +1,13 @@
+skip_unless test "$SUDO"
+skip_if test "$UNAME" = "Darwin"
+
+rm -rf scratch/*
+mkdir scratch/{foo,mnt}
+sudo mount -t tmpfs tmpfs scratch/mnt
+$TOUCH scratch/foo/bar scratch/mnt/baz
+
+bfs_diff scratch -mount
+ret=$?
+
+sudo umount scratch/mnt
+return $ret
diff --git a/tests/common/name_slash.out b/tests/common/name_slash.out
new file mode 100644
index 0000000..b498fd4
--- /dev/null
+++ b/tests/common/name_slash.out
@@ -0,0 +1 @@
+/
diff --git a/tests/common/name_slash.sh b/tests/common/name_slash.sh
new file mode 100644
index 0000000..8d89623
--- /dev/null
+++ b/tests/common/name_slash.sh
@@ -0,0 +1 @@
+bfs_diff / -maxdepth 0 -name /
diff --git a/tests/common/name_slashes.out b/tests/common/name_slashes.out
new file mode 100644
index 0000000..187b81f
--- /dev/null
+++ b/tests/common/name_slashes.out
@@ -0,0 +1 @@
+///
diff --git a/tests/common/name_slashes.sh b/tests/common/name_slashes.sh
new file mode 100644
index 0000000..78d0a84
--- /dev/null
+++ b/tests/common/name_slashes.sh
@@ -0,0 +1 @@
+bfs_diff /// -maxdepth 0 -name /
diff --git a/tests/common/newerma.out b/tests/common/newerma.out
new file mode 100644
index 0000000..7f6c0dd
--- /dev/null
+++ b/tests/common/newerma.out
@@ -0,0 +1,4 @@
+times
+times/b
+times/c
+times/l
diff --git a/tests/common/newerma.sh b/tests/common/newerma.sh
new file mode 100644
index 0000000..b05af8d
--- /dev/null
+++ b/tests/common/newerma.sh
@@ -0,0 +1 @@
+bfs_diff times -newerma times/a
diff --git a/tests/common/newermt.out b/tests/common/newermt.out
new file mode 100644
index 0000000..650e550
--- /dev/null
+++ b/tests/common/newermt.out
@@ -0,0 +1,3 @@
+times
+times/c
+times/l
diff --git a/tests/common/newermt.sh b/tests/common/newermt.sh
new file mode 100644
index 0000000..3c5be68
--- /dev/null
+++ b/tests/common/newermt.sh
@@ -0,0 +1 @@
+bfs_diff times -newermt 1991-12-14T00:01
diff --git a/tests/common/newermt_epoch_minus_one.out b/tests/common/newermt_epoch_minus_one.out
new file mode 100644
index 0000000..f7f63b0
--- /dev/null
+++ b/tests/common/newermt_epoch_minus_one.out
@@ -0,0 +1,5 @@
+times
+times/a
+times/b
+times/c
+times/l
diff --git a/tests/common/newermt_epoch_minus_one.sh b/tests/common/newermt_epoch_minus_one.sh
new file mode 100644
index 0000000..568e2f3
--- /dev/null
+++ b/tests/common/newermt_epoch_minus_one.sh
@@ -0,0 +1 @@
+bfs_diff times -newermt 1969-12-31T23:59:59Z
diff --git a/tests/common/ok_closed_stdin.out b/tests/common/ok_closed_stdin.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/ok_closed_stdin.out
diff --git a/tests/common/ok_closed_stdin.sh b/tests/common/ok_closed_stdin.sh
new file mode 100644
index 0000000..687e998
--- /dev/null
+++ b/tests/common/ok_closed_stdin.sh
@@ -0,0 +1 @@
+bfs_diff basic -ok echo \; <&-
diff --git a/tests/common/okdir_closed_stdin.out b/tests/common/okdir_closed_stdin.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/okdir_closed_stdin.out
diff --git a/tests/common/okdir_closed_stdin.sh b/tests/common/okdir_closed_stdin.sh
new file mode 100644
index 0000000..a515298
--- /dev/null
+++ b/tests/common/okdir_closed_stdin.sh
@@ -0,0 +1 @@
+bfs_diff basic -okdir echo {} \; <&-
diff --git a/tests/common/quit.out b/tests/common/quit.out
new file mode 100644
index 0000000..cf4d5a9
--- /dev/null
+++ b/tests/common/quit.out
@@ -0,0 +1 @@
+basic/g
diff --git a/tests/common/quit.sh b/tests/common/quit.sh
new file mode 100644
index 0000000..46b60c5
--- /dev/null
+++ b/tests/common/quit.sh
@@ -0,0 +1 @@
+bfs_diff basic/g -print -name g -quit
diff --git a/tests/common/quit_after_print.out b/tests/common/quit_after_print.out
new file mode 100644
index 0000000..15a13db
--- /dev/null
+++ b/tests/common/quit_after_print.out
@@ -0,0 +1 @@
+basic
diff --git a/tests/common/quit_after_print.sh b/tests/common/quit_after_print.sh
new file mode 100644
index 0000000..ee5653a
--- /dev/null
+++ b/tests/common/quit_after_print.sh
@@ -0,0 +1 @@
+bfs_diff basic basic -print -quit
diff --git a/tests/common/quit_before_print.out b/tests/common/quit_before_print.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/quit_before_print.out
diff --git a/tests/common/quit_before_print.sh b/tests/common/quit_before_print.sh
new file mode 100644
index 0000000..cda3a2c
--- /dev/null
+++ b/tests/common/quit_before_print.sh
@@ -0,0 +1 @@
+bfs_diff basic basic -quit -print
diff --git a/tests/common/quit_child.out b/tests/common/quit_child.out
new file mode 100644
index 0000000..fb683c7
--- /dev/null
+++ b/tests/common/quit_child.out
@@ -0,0 +1,2 @@
+basic/g
+basic/g/h
diff --git a/tests/common/quit_child.sh b/tests/common/quit_child.sh
new file mode 100644
index 0000000..bd27eff
--- /dev/null
+++ b/tests/common/quit_child.sh
@@ -0,0 +1 @@
+bfs_diff basic/g -print -name h -quit
diff --git a/tests/common/quit_depth.out b/tests/common/quit_depth.out
new file mode 100644
index 0000000..fb683c7
--- /dev/null
+++ b/tests/common/quit_depth.out
@@ -0,0 +1,2 @@
+basic/g
+basic/g/h
diff --git a/tests/common/quit_depth.sh b/tests/common/quit_depth.sh
new file mode 100644
index 0000000..f5f82ba
--- /dev/null
+++ b/tests/common/quit_depth.sh
@@ -0,0 +1 @@
+bfs_diff basic/g -depth -print -name g -quit
diff --git a/tests/common/quit_depth_child.out b/tests/common/quit_depth_child.out
new file mode 100644
index 0000000..72b086d
--- /dev/null
+++ b/tests/common/quit_depth_child.out
@@ -0,0 +1 @@
+basic/g/h
diff --git a/tests/common/quit_depth_child.sh b/tests/common/quit_depth_child.sh
new file mode 100644
index 0000000..dd09d5b
--- /dev/null
+++ b/tests/common/quit_depth_child.sh
@@ -0,0 +1 @@
+bfs_diff basic/g -depth -print -name h -quit
diff --git a/tests/common/regex.out b/tests/common/regex.out
new file mode 100644
index 0000000..cfc113b
--- /dev/null
+++ b/tests/common/regex.out
@@ -0,0 +1,3 @@
+basic/c/d
+basic/e/f
+basic/g/h
diff --git a/tests/common/regex.sh b/tests/common/regex.sh
new file mode 100644
index 0000000..a3bdae8
--- /dev/null
+++ b/tests/common/regex.sh
@@ -0,0 +1 @@
+bfs_diff basic -regex 'basic/./.'
diff --git a/tests/common/regex_parens.out b/tests/common/regex_parens.out
new file mode 100644
index 0000000..0f0971e
--- /dev/null
+++ b/tests/common/regex_parens.out
@@ -0,0 +1 @@
+./(
diff --git a/tests/common/regex_parens.sh b/tests/common/regex_parens.sh
new file mode 100644
index 0000000..fe0abf6
--- /dev/null
+++ b/tests/common/regex_parens.sh
@@ -0,0 +1,2 @@
+cd weirdnames
+bfs_diff . -regex '\./\((\)'
diff --git a/tests/common/samefile.out b/tests/common/samefile.out
new file mode 100644
index 0000000..996ffc8
--- /dev/null
+++ b/tests/common/samefile.out
@@ -0,0 +1,2 @@
+links/file
+links/hardlink
diff --git a/tests/common/samefile.sh b/tests/common/samefile.sh
new file mode 100644
index 0000000..8e51966
--- /dev/null
+++ b/tests/common/samefile.sh
@@ -0,0 +1 @@
+bfs_diff links -samefile links/file
diff --git a/tests/common/samefile_broken.out b/tests/common/samefile_broken.out
new file mode 100644
index 0000000..21d6316
--- /dev/null
+++ b/tests/common/samefile_broken.out
@@ -0,0 +1 @@
+links/broken
diff --git a/tests/common/samefile_broken.sh b/tests/common/samefile_broken.sh
new file mode 100644
index 0000000..1cb52db
--- /dev/null
+++ b/tests/common/samefile_broken.sh
@@ -0,0 +1 @@
+bfs_diff links -samefile links/broken
diff --git a/tests/common/samefile_notdir.out b/tests/common/samefile_notdir.out
new file mode 100644
index 0000000..6e6658d
--- /dev/null
+++ b/tests/common/samefile_notdir.out
@@ -0,0 +1 @@
+links/notdir
diff --git a/tests/common/samefile_notdir.sh b/tests/common/samefile_notdir.sh
new file mode 100644
index 0000000..f274ef6
--- /dev/null
+++ b/tests/common/samefile_notdir.sh
@@ -0,0 +1 @@
+bfs_diff links -samefile links/notdir
diff --git a/tests/common/samefile_symlink.out b/tests/common/samefile_symlink.out
new file mode 100644
index 0000000..299a572
--- /dev/null
+++ b/tests/common/samefile_symlink.out
@@ -0,0 +1 @@
+links/symlink
diff --git a/tests/common/samefile_symlink.sh b/tests/common/samefile_symlink.sh
new file mode 100644
index 0000000..55ccf5c
--- /dev/null
+++ b/tests/common/samefile_symlink.sh
@@ -0,0 +1 @@
+bfs_diff links -samefile links/symlink
diff --git a/tests/common/size_big.out b/tests/common/size_big.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/common/size_big.out
diff --git a/tests/common/size_big.sh b/tests/common/size_big.sh
new file mode 100644
index 0000000..6c100eb
--- /dev/null
+++ b/tests/common/size_big.sh
@@ -0,0 +1 @@
+bfs_diff basic -size 9223372036854775807