[Top][All Lists]

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

Re: misc/cat-buf test failure

From: Pádraig Brady
Subject: Re: misc/cat-buf test failure
Date: Tue, 8 Sep 2009 00:12:47 +0100
User-agent: Thunderbird (X11/20071008)

Jim Meyering wrote:
> Hi Pádraig,
> On my 6th run of "make check", the cat-buf test failed.
> It's an inherently racy test.
> If the dd process is starved until "2" is printed,
> it will end up printing both lines to "out".

Hmm. 0.2s was too short between writes so.
I've bumped it up to 0.5s since 0.2 failed so infrequently.
I've also changed to just skip on possible failure.


>From 047dae65f432eedec43639afcb9075ea42358c00 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Mon, 7 Sep 2009 23:50:19 +0100
Subject: [PATCH] tests: address a race condition in misc/cat-buf

* tests/misc/cat-buf: Increase the delay between writes
to decrease the chance that dd will read both at once.
Since the test is inherently racy, print a warning via
skip_test_ rather than failing outright.
Reported by Jim Meyering.
 tests/misc/cat-buf |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf
index d37f9f4..9ca2d7b 100755
--- a/tests/misc/cat-buf
+++ b/tests/misc/cat-buf
@@ -30,12 +30,17 @@ fi
 # write separately.
 mkfifo fifo || framework_failure
 echo 1 > exp
 dd count=1 if=fifo > out &
-(echo 1; sleep .2; echo 2) | cat -v > fifo
+(echo 1; sleep .5; echo 2) | cat -v > fifo
 wait # for dd to complete
-compare out exp || fail=1
+# Though unlikely, this test may fail because dd was starved
+# between opening the fifo and reading from it, rather than
+# the failure we're testing where cat doesn't output immediately.
+compare out exp || skip_test_ "possible test failure. Please verify."
 Exit $fail

reply via email to

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