summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-09-07 23:50:19 +0100
committerPádraig Brady <P@draigBrady.com>2009-09-08 01:43:31 +0100
commita863644397a66308d60464bace26da857f494f8c (patch)
treeaac6ce0079596465d414425085fe7a466daec7ab
parentf6d1f70183709124afd67462c05f82bb8d116165 (diff)
downloadcoreutils-a863644397a66308d60464bace26da857f494f8c.tar.xz
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.
-rwxr-xr-xtests/misc/cat-buf9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf
index d37f9f436..11d553a2b 100755
--- a/tests/misc/cat-buf
+++ b/tests/misc/cat-buf
@@ -30,12 +30,17 @@ fi
# write separately.
mkfifo fifo || framework_failure
+fail=0
+
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 until after the
+# second echo. So ask to double check rather than failing.
+compare out exp || skip_test_ "possible test failure. Please verify."
Exit $fail