From 46c3a6d6cf5cbcee6add3350b0969578ef09a06b Mon Sep 17 00:00:00 2001
From: Tavian Barnes <tavianator@tavianator.com>
Date: Mon, 19 Aug 2024 12:44:32 -0400
Subject: tests/bfs: Add -noerror tests

---
 tests/bfs/L_noerror.out             | 11 +++++++++++
 tests/bfs/L_noerror.sh              |  1 +
 tests/bfs/noerror.out               |  4 ++++
 tests/bfs/noerror.sh                |  1 +
 tests/bfs/noerror_nowarn.sh         |  2 ++
 tests/bfs/noerror_warn.sh           |  2 ++
 tests/gnu/fprint_noerror.sh         |  3 ---
 tests/gnu/fprint_unreached_error.sh |  3 +++
 8 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 tests/bfs/L_noerror.out
 create mode 100644 tests/bfs/L_noerror.sh
 create mode 100644 tests/bfs/noerror.out
 create mode 100644 tests/bfs/noerror.sh
 create mode 100644 tests/bfs/noerror_nowarn.sh
 create mode 100644 tests/bfs/noerror_warn.sh
 delete mode 100644 tests/gnu/fprint_noerror.sh
 create mode 100644 tests/gnu/fprint_unreached_error.sh

diff --git a/tests/bfs/L_noerror.out b/tests/bfs/L_noerror.out
new file mode 100644
index 0000000..a514555
--- /dev/null
+++ b/tests/bfs/L_noerror.out
@@ -0,0 +1,11 @@
+loops
+loops/broken
+loops/deeply
+loops/deeply/nested
+loops/deeply/nested/dir
+loops/file
+loops/notdir
+loops/skip
+loops/skip/dir
+loops/skip/loop
+loops/symlink
diff --git a/tests/bfs/L_noerror.sh b/tests/bfs/L_noerror.sh
new file mode 100644
index 0000000..7db2a4d
--- /dev/null
+++ b/tests/bfs/L_noerror.sh
@@ -0,0 +1 @@
+bfs_diff -L loops -noerror
diff --git a/tests/bfs/noerror.out b/tests/bfs/noerror.out
new file mode 100644
index 0000000..c4f8ce4
--- /dev/null
+++ b/tests/bfs/noerror.out
@@ -0,0 +1,4 @@
+inaccessible
+inaccessible/dir
+inaccessible/file
+inaccessible/link
diff --git a/tests/bfs/noerror.sh b/tests/bfs/noerror.sh
new file mode 100644
index 0000000..e334f8f
--- /dev/null
+++ b/tests/bfs/noerror.sh
@@ -0,0 +1 @@
+bfs_diff inaccessible -noerror
diff --git a/tests/bfs/noerror_nowarn.sh b/tests/bfs/noerror_nowarn.sh
new file mode 100644
index 0000000..26e7e68
--- /dev/null
+++ b/tests/bfs/noerror_nowarn.sh
@@ -0,0 +1,2 @@
+stderr=$(invoke_bfs inaccessible -noerror -nowarn 2>&1 >/dev/null)
+[ -z "$stderr" ]
diff --git a/tests/bfs/noerror_warn.sh b/tests/bfs/noerror_warn.sh
new file mode 100644
index 0000000..ec85f4c
--- /dev/null
+++ b/tests/bfs/noerror_warn.sh
@@ -0,0 +1,2 @@
+stderr=$(invoke_bfs inaccessible -noerror -warn 2>&1 >/dev/null)
+[ -n "$stderr" ]
diff --git a/tests/gnu/fprint_noerror.sh b/tests/gnu/fprint_noerror.sh
deleted file mode 100644
index f13a62b..0000000
--- a/tests/gnu/fprint_noerror.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# Regression test: /dev/full should not fail until actually written to
-test -e /dev/full || skip
-invoke_bfs basic -false -fprint /dev/full
diff --git a/tests/gnu/fprint_unreached_error.sh b/tests/gnu/fprint_unreached_error.sh
new file mode 100644
index 0000000..f13a62b
--- /dev/null
+++ b/tests/gnu/fprint_unreached_error.sh
@@ -0,0 +1,3 @@
+# Regression test: /dev/full should not fail until actually written to
+test -e /dev/full || skip
+invoke_bfs basic -false -fprint /dev/full
-- 
cgit v1.2.3