summaryrefslogtreecommitdiff
path: root/tests/misc/cat-buf
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-07-05 08:53:10 +0100
committerPádraig Brady <P@draigBrady.com>2010-07-05 15:06:07 +0100
commit09fcf494a10c4b1ad2b037d093f571e7462e08c4 (patch)
treeb37ab28311bb36e20c3f18f09531196dd70381b1 /tests/misc/cat-buf
parent1d95457b3ecc57df4cd67175abd093b84e29372b (diff)
downloadcoreutils-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/misc/cat-buf')
-rwxr-xr-xtests/misc/cat-buf19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf
index 2dea96cfe..cd6f9df8a 100755
--- a/tests/misc/cat-buf
+++ b/tests/misc/cat-buf
@@ -33,13 +33,16 @@ mkfifo fifo || framework_failure
echo 1 > exp
-dd count=1 if=fifo > out &
-(echo 1; sleep .5; echo 2) | cat -v > fifo
-wait # for dd to complete
-
-# Though unlikely, this test may fail because dd was starved
-# between opening the fifo and reading from it until after the
-# second echo. So ask to double check rather than failing.
-compare out exp || skip_test_ "possible test failure. Please verify."
+cat_buf_1()
+{
+ local delay="$1"
+
+ dd count=1 if=fifo > out &
+ (echo 1; sleep $delay; echo 2) | cat -v > fifo
+ wait # for dd to complete
+ compare out exp
+}
+
+retry_delay_ cat_buf_1 .1 6 || fail=1
Exit $fail