summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-10-19 14:29:35 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-10-19 15:00:08 -0400
commit9192487a267f7052924db88d88cf381513c773d2 (patch)
tree6b18e91aed54c1477434dfb1c67479e0f26aac7a
parent49a2a2194bfde0b70aac72bd7f2d0e02c62858ef (diff)
downloadbfs-9192487a267f7052924db88d88cf381513c773d2.tar.xz
tests: Coverage number go up
-rw-r--r--tests/bfs/D_incomplete.sh1
-rw-r--r--tests/bfs/D_unknown.out19
-rw-r--r--tests/bfs/D_unknown.sh4
-rw-r--r--tests/bfs/O9.out19
-rw-r--r--tests/bfs/O9.sh4
-rw-r--r--tests/bfs/nocolor.out20
-rw-r--r--tests/bfs/nocolor.sh1
-rw-r--r--tests/bfs/warn_depth_prune.sh (renamed from tests/bfs/warn.sh)0
-rw-r--r--tests/bfs/warn_exclude_path.sh2
-rw-r--r--tests/bsd/f_incomplete.sh2
-rw-r--r--tests/bsd/mtime_bad_unit.sh1
-rw-r--r--tests/bsd/mtime_missing_unit.sh1
-rw-r--r--tests/common/maxdepth_incomplete.sh1
-rw-r--r--tests/common/mindepth_incomplete.sh1
-rw-r--r--tests/gnu/files0_from_error.sh1
-rw-r--r--tests/gnu/fls_nonexistent.sh1
-rw-r--r--tests/gnu/fprint0_nonexistent.sh1
-rw-r--r--tests/gnu/fprintf_nonexistent.sh1
-rw-r--r--tests/gnu/noleaf.out19
-rw-r--r--tests/gnu/noleaf.sh1
-rw-r--r--tests/posix/newer_nonexistent.sh1
-rwxr-xr-xtests/tests.sh2
22 files changed, 101 insertions, 2 deletions
diff --git a/tests/bfs/D_incomplete.sh b/tests/bfs/D_incomplete.sh
new file mode 100644
index 0000000..396d365
--- /dev/null
+++ b/tests/bfs/D_incomplete.sh
@@ -0,0 +1 @@
+fail invoke_bfs -D
diff --git a/tests/bfs/D_unknown.out b/tests/bfs/D_unknown.out
new file mode 100644
index 0000000..a7ccfe4
--- /dev/null
+++ b/tests/bfs/D_unknown.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/bfs/D_unknown.sh b/tests/bfs/D_unknown.sh
new file mode 100644
index 0000000..e3614ba
--- /dev/null
+++ b/tests/bfs/D_unknown.sh
@@ -0,0 +1,4 @@
+stderr=$(invoke_bfs -warn -D unknown basic 2>&1 >"$OUT")
+[ -n "$stderr" ] || return 1
+sort_output
+diff_output
diff --git a/tests/bfs/O9.out b/tests/bfs/O9.out
new file mode 100644
index 0000000..a7ccfe4
--- /dev/null
+++ b/tests/bfs/O9.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/bfs/O9.sh b/tests/bfs/O9.sh
new file mode 100644
index 0000000..12f6c2d
--- /dev/null
+++ b/tests/bfs/O9.sh
@@ -0,0 +1,4 @@
+stderr=$(invoke_bfs -warn -O9 basic 2>&1 >"$OUT")
+[ -n "$stderr" ] || return 1
+sort_output
+diff_output
diff --git a/tests/bfs/nocolor.out b/tests/bfs/nocolor.out
new file mode 100644
index 0000000..b53fe03
--- /dev/null
+++ b/tests/bfs/nocolor.out
@@ -0,0 +1,20 @@
+rainbow
+rainbow/broken
+rainbow/chardev_link
+rainbow/exec.sh
+rainbow/file.dat
+rainbow/file.txt
+rainbow/link.txt
+rainbow/mh1
+rainbow/mh2
+rainbow/ow
+rainbow/pipe
+rainbow/sgid
+rainbow/socket
+rainbow/star.gz
+rainbow/star.tar
+rainbow/star.tar.gz
+rainbow/sticky
+rainbow/sticky_ow
+rainbow/sugid
+rainbow/suid
diff --git a/tests/bfs/nocolor.sh b/tests/bfs/nocolor.sh
new file mode 100644
index 0000000..8dace0b
--- /dev/null
+++ b/tests/bfs/nocolor.sh
@@ -0,0 +1 @@
+bfs_diff rainbow -nocolor
diff --git a/tests/bfs/warn.sh b/tests/bfs/warn_depth_prune.sh
index 0f613c8..0f613c8 100644
--- a/tests/bfs/warn.sh
+++ b/tests/bfs/warn_depth_prune.sh
diff --git a/tests/bfs/warn_exclude_path.sh b/tests/bfs/warn_exclude_path.sh
new file mode 100644
index 0000000..988544e
--- /dev/null
+++ b/tests/bfs/warn_exclude_path.sh
@@ -0,0 +1,2 @@
+stderr=$(invoke_bfs -warn -exclude basic -name '*f*' 2>&1 >/dev/null)
+[ -n "$stderr" ]
diff --git a/tests/bsd/f_incomplete.sh b/tests/bsd/f_incomplete.sh
new file mode 100644
index 0000000..acb63af
--- /dev/null
+++ b/tests/bsd/f_incomplete.sh
@@ -0,0 +1,2 @@
+fail invoke_bfs -f
+
diff --git a/tests/bsd/mtime_bad_unit.sh b/tests/bsd/mtime_bad_unit.sh
new file mode 100644
index 0000000..3921f80
--- /dev/null
+++ b/tests/bsd/mtime_bad_unit.sh
@@ -0,0 +1 @@
+fail 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..3ac4c97
--- /dev/null
+++ b/tests/bsd/mtime_missing_unit.sh
@@ -0,0 +1 @@
+fail invoke_bfs times -mtime +1w2
diff --git a/tests/common/maxdepth_incomplete.sh b/tests/common/maxdepth_incomplete.sh
new file mode 100644
index 0000000..536dcf5
--- /dev/null
+++ b/tests/common/maxdepth_incomplete.sh
@@ -0,0 +1 @@
+fail invoke_bfs basic -maxdepth
diff --git a/tests/common/mindepth_incomplete.sh b/tests/common/mindepth_incomplete.sh
new file mode 100644
index 0000000..19a3b21
--- /dev/null
+++ b/tests/common/mindepth_incomplete.sh
@@ -0,0 +1 @@
+fail invoke_bfs basic -mindepth
diff --git a/tests/gnu/files0_from_error.sh b/tests/gnu/files0_from_error.sh
new file mode 100644
index 0000000..ab27ea2
--- /dev/null
+++ b/tests/gnu/files0_from_error.sh
@@ -0,0 +1 @@
+fail invoke_bfs -files0-from basic
diff --git a/tests/gnu/fls_nonexistent.sh b/tests/gnu/fls_nonexistent.sh
new file mode 100644
index 0000000..4756834
--- /dev/null
+++ b/tests/gnu/fls_nonexistent.sh
@@ -0,0 +1 @@
+fail invoke_bfs rainbow -fls scratch/nonexistent/path
diff --git a/tests/gnu/fprint0_nonexistent.sh b/tests/gnu/fprint0_nonexistent.sh
new file mode 100644
index 0000000..d8e0f30
--- /dev/null
+++ b/tests/gnu/fprint0_nonexistent.sh
@@ -0,0 +1 @@
+fail invoke_bfs basic -fprint0 scratch/nonexistent/path
diff --git a/tests/gnu/fprintf_nonexistent.sh b/tests/gnu/fprintf_nonexistent.sh
new file mode 100644
index 0000000..6ed141a
--- /dev/null
+++ b/tests/gnu/fprintf_nonexistent.sh
@@ -0,0 +1 @@
+fail invoke_bfs basic -fprintf scratch/nonexistent/path '%p\n'
diff --git a/tests/gnu/noleaf.out b/tests/gnu/noleaf.out
new file mode 100644
index 0000000..a7ccfe4
--- /dev/null
+++ b/tests/gnu/noleaf.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/gnu/noleaf.sh b/tests/gnu/noleaf.sh
new file mode 100644
index 0000000..b19438c
--- /dev/null
+++ b/tests/gnu/noleaf.sh
@@ -0,0 +1 @@
+bfs_diff basic -noleaf
diff --git a/tests/posix/newer_nonexistent.sh b/tests/posix/newer_nonexistent.sh
new file mode 100644
index 0000000..789cadf
--- /dev/null
+++ b/tests/posix/newer_nonexistent.sh
@@ -0,0 +1 @@
+fail invoke_bfs times -newer times/nonexistent
diff --git a/tests/tests.sh b/tests/tests.sh
index d957cf1..f6fe506 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -16,8 +16,6 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #
############################################################################
-shopt -s extdebug
-
set -euP
umask 022