summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-25 20:43:13 +0200
committerJim Meyering <meyering@redhat.com>2009-08-26 09:25:21 +0200
commitbe8531206b0554bdac6cfb8809c4a2dab56b5a52 (patch)
tree6ac56f4668f9cbb0941563e254f3d6857b4217ca
parent899c1d00fa19864a97e554f9baa62332807529ee (diff)
downloadcoreutils-be8531206b0554bdac6cfb8809c4a2dab56b5a52.tar.xz
tests: tail-2/assert: avoid risk of race condition
* tests/tail-2/assert: Avoid spurious failure due to race condition. Rather than sleeping for 1 second and crossing fingers, wait explicitly for backgrounded tail process to start. Otherwise, this test would fail under heavy load.
-rwxr-xr-xtests/tail-2/assert8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/tail-2/assert b/tests/tail-2/assert
index 416f206a1..623c3684f 100755
--- a/tests/tail-2/assert
+++ b/tests/tail-2/assert
@@ -42,9 +42,13 @@ tail_pid=$!
echo sleeping for 7 seconds...
-# Give the backgrounded `tail' a chance to start before removing foo.
+# Wait for the backgrounded `tail' to start before removing foo.
# Otherwise, without --retry, tail wouldn't try to open `foo' again.
-sleep 1
+while :; do
+ env kill -0 $tail_pid && break
+ echo sleep .1
+ sleep .1
+done
rm -f foo
sleep 6