coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: inotify-rotate: avoid false positive under heavy load


From: Jim Meyering
Subject: [PATCH] tests: inotify-rotate: avoid false positive under heavy load
Date: Sat, 11 Jun 2011 13:56:02 +0200

FYI, I've been consistently hitting a failure of this test
when running massively (perhaps overly) parallel "make check".
This fixed it:

>From 7c77c93dc5482d98b225242ea0300021ce6d4eae Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 11 Jun 2011 13:53:58 +0200
Subject: [PATCH] tests: inotify-rotate: avoid false positive under heavy load

* tests/tail-2/inotify-rotate: Increase timeout from 10s to 40s
to avoid load-induced false positive.
---
 tests/tail-2/inotify-rotate |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/tail-2/inotify-rotate b/tests/tail-2/inotify-rotate
index f9aa80f..900e214 100755
--- a/tests/tail-2/inotify-rotate
+++ b/tests/tail-2/inotify-rotate
@@ -44,7 +44,10 @@ grep_timeout()
 for i in $(seq 50); do
     echo $i
     rm -rf k x out
-    :>k && :>x && timeout 10 tail -F k > out 2>&1 &
+    # Normally less than a second is required here, but with heavy load
+    # and a lot of disk activity, even 20 seconds is insufficient, which
+    # leads to this timeout killing tail before the "ok" is written below.
+    :>k && :>x && timeout 40 tail -F k > out 2>&1 &
     pid=$!
     sleep .1
     echo b > k;
@@ -53,13 +56,13 @@ for i in $(seq 50); do
     while :; do grep b out > /dev/null && break; done
     mv x k
     # wait for tail to detect the rename
-    grep_timeout tail: out || fail_ failed to detect rename
+    grep_timeout tail: out || { cat out; fail_ failed to detect rename; }
     echo ok >> k
     found=0
     # wait up to 10 seconds for "ok" to appear in out
     grep_timeout ok out && found=1
     kill $pid
-    test $found = 0 && { fail=1; cat out; break; }
+    test $found = 0 && { cat out; fail_ failed to detect echoed '"ok"'; }
 done

 Exit $fail
--
1.7.6.rc0.293.g40857



reply via email to

[Prev in Thread] Current Thread [Next in Thread]