diff options
author | Pádraig Brady <P@draigBrady.com> | 2010-07-05 08:53:10 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2010-07-05 15:06:07 +0100 |
commit | 09fcf494a10c4b1ad2b037d093f571e7462e08c4 (patch) | |
tree | b37ab28311bb36e20c3f18f09531196dd70381b1 /tests/tail-2/wait | |
parent | 1d95457b3ecc57df4cd67175abd093b84e29372b (diff) | |
download | coreutils-09fcf494a10c4b1ad2b037d093f571e7462e08c4.tar.xz |
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.
Diffstat (limited to 'tests/tail-2/wait')
-rwxr-xr-x | tests/tail-2/wait | 35 |
1 files changed, 21 insertions, 14 deletions
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 |