summaryrefslogtreecommitdiff
path: root/tests/tail-2/symlink.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2/symlink.sh')
-rwxr-xr-xtests/tail-2/symlink.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/tail-2/symlink.sh b/tests/tail-2/symlink.sh
index 9f1a2010f..b5dcbbd68 100755
--- a/tests/tail-2/symlink.sh
+++ b/tests/tail-2/symlink.sh
@@ -36,6 +36,9 @@ wait4lines_ ()
[ "$(countlines_)" -ge "$elc" ] || { sleep $delay; return 1; }
}
+# Terminate any background tail process
+cleanup_() { kill $pid 2>/dev/null && wait $pid; }
+
# speedup non inotify case
fastpoll='-s.1 --max-unchanged-stats=1'
@@ -50,8 +53,7 @@ retry_delay_ wait4lines_ .1 6 1 || { cat out; fail=1; }
echo "X" > target || framework_failure_
# Wait for the expected output.
retry_delay_ wait4lines_ .1 6 3 || { cat out; fail=1; }
-kill $pid
-wait $pid
+cleanup_
# Expect 3 lines in the output file.
[ "$(countlines_)" = 3 ] || { fail=1; cat out; }
grep -F 'cannot open' out || { fail=1; cat out; }
@@ -74,8 +76,7 @@ retry_delay_ wait4lines_ .1 6 2 || { cat out; fail=1; }
echo "X2" > target2 || framework_failure_
# Wait for the expected output.
retry_delay_ wait4lines_ .1 6 4 || { cat out; fail=1; }
-kill $pid
-wait $pid
+cleanup_
# Expect 4 lines in the output file.
[ "$(countlines_)" = 4 ] || { fail=1; cat out; }
grep -F 'become inacce' out || { fail=1; cat out; }