summaryrefslogtreecommitdiff
path: root/tests/tail-2/retry.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2/retry.sh')
-rw-r--r--tests/tail-2/retry.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tail-2/retry.sh b/tests/tail-2/retry.sh
index 71d101556..d56d4c169 100644
--- a/tests/tail-2/retry.sh
+++ b/tests/tail-2/retry.sh
@@ -76,6 +76,24 @@ grep '^X$' out || { fail=1; cat out; }
rm -f missing out || fail=1
# === Test:
+# Ensure that tail --follow=descriptor --retry exits when the file appears
+# untailable. Expect exit status 1.
+timeout 10 tail -s.1 --follow=descriptor --retry missing >out 2>&1 & pid=$!
+retry_delay_ wait4lines_ .1 6 2 || fail=1 # Wait for "cannot open" error.
+mkdir missing || fail=1 # Create untailable 'missing'.
+retry_delay_ wait4lines_ .1 6 4 || fail=1 # Wait for the expected output.
+wait $pid
+rc=$?
+[ $( wc -l < out ) = 4 ] || { fail=1; cat out; }
+grep -F 'retry only effective for the initial open' out \
+ || { fail=1; cat out; }
+grep -F 'cannot open' out || { fail=1; cat out; }
+grep -F 'replaced with an untailable file' out || { fail=1; cat out; }
+grep -F 'no files remaining' out || { fail=1; cat out; }
+[ $rc = 1 ] || { fail=1; cat out; }
+rm -fd missing out || fail=1
+
+# === Test:
# Ensure that --follow=descriptor (without --retry) does *not wait* for the
# file to appear. Expect 2 lines in the output file ("cannot open" +
# "no files remaining") and exit status 1.