summaryrefslogtreecommitdiff
path: root/tests/tail-2/assert.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2/assert.sh')
-rwxr-xr-xtests/tail-2/assert.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/tail-2/assert.sh b/tests/tail-2/assert.sh
index 906e364b5..43bd1e146 100755
--- a/tests/tail-2/assert.sh
+++ b/tests/tail-2/assert.sh
@@ -33,10 +33,12 @@ check_tail_output()
{ sleep $delay; return 1; }
}
+# Terminate any background tail process
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+
# Speedup the non inotify case
fastpoll='-s.1 --max-unchanged-stats=1'
-
for mode in '' '---disable-inotify'; do
rm -f a foo out
touch a foo || framework_failure_
@@ -46,22 +48,21 @@ for mode in '' '---disable-inotify'; do
# Wait up to 12.7s for tail to start.
echo x > a || framework_failure_
tail_re='^x$' retry_delay_ check_tail_output .1 7 ||
- { cat out; fail=1; }
+ { cat out; fail=1; break; }
# Wait 12.7s for this diagnostic:
# tail: foo: No such file or directory
rm foo || framework_failure_
tail_re='No such file' retry_delay_ check_tail_output .1 7 ||
- { cat out; fail=1; }
+ { cat out; fail=1; break; }
# Wait up to 12.7s for tail to notice new foo file
ok='ok ok ok'
echo "$ok" > foo || framework_failure_
tail_re="^$ok$" retry_delay_ check_tail_output .1 7 ||
- { echo "$0: foo: unexpected delay?"; cat out; fail=1; }
+ { echo "$0: foo: unexpected delay?"; cat out; fail=1; break; }
- kill $pid
- wait $pid
+ cleanup_
done
Exit $fail