From 09fcf494a10c4b1ad2b037d093f571e7462e08c4 Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Mon, 5 Jul 2010 08:53:10 +0100 Subject: tests: make tests requiring a delay to pass, more robust * tests/init.cfg: Introduce a retry_delay_() function to repeatedly call a test function that requires a delay. This delay can now be shorter for the common case on fast systems, but will double until a configurable limit it reached before failing on slower systems. * tests/dd/reblock: Use retry_delay_. * tests/misc/cat-buf: Likewise. * tests/misc/stdbuf: Likewise. * tests/tail-2/F-vs-rename: Likewise. * tests/tail-2/flush-initial: Likewise. * tests/tail-2/tail-n0f: Likewise. * tests/tail-2/wait: Likewise. * test/dd/misc: Comment that delay is needed to trigger failure. --- tests/tail-2/wait | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'tests/tail-2/wait') diff --git a/tests/tail-2/wait b/tests/tail-2/wait index 5c9eff0a2..332cfcc09 100755 --- a/tests/tail-2/wait +++ b/tests/tail-2/wait @@ -25,7 +25,6 @@ fi . $srcdir/test-lib.sh touch here || framework_failure -touch k || framework_failure { touch unreadable && chmod a-r unreadable; } || framework_failure @@ -59,19 +58,27 @@ for inotify in ---disable-inotify ''; do test -s tail.err && fail=1 :>tail.err - - tail -s.1 --max-unchanged-stats=2 -F $inotify k > tail.out & - pid=$! - sleep .5 - mv k l - sleep .5 - touch k - mv k l - sleep .5 - echo NO >> l - sleep .5 - kill $pid - test -s tail.out && fail=1 + tail_F() + { + local delay="$1" + + touch k || framework_failure + tail -s.1 --max-unchanged-stats=2 -F $inotify k > tail.out & + pid=$! + sleep $delay + mv k l + sleep $delay + touch k + mv k l + sleep $delay + echo NO >> l + sleep $delay + kill $pid + rm -f k l + + test ! -s tail.out + } + retry_delay_ tail_F .1 4 || fail=1 done Exit $fail -- cgit v1.2.3-70-g09d2