summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-11-30 18:43:55 +0100
committerJim Meyering <meyering@redhat.com>2008-11-30 19:01:45 +0100
commitbe6b4218e47e27c591f589f27f543079d7930dce (patch)
treefa2ea3a996e63a77e706f67ee41028a441de3ff9 /tests
parent48a05a9ce9f3f9e37ecbef11f563486d44cd2fb4 (diff)
downloadcoreutils-be6b4218e47e27c591f589f27f543079d7930dce.tar.xz
tests: dd/reblock: avoid occasional failure
* tests/dd/reblock: Sleep longer to avoid a race condition. Reported by Bob Proulx.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/dd/reblock5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/dd/reblock b/tests/dd/reblock
index 542529a71..ef9e03613 100755
--- a/tests/dd/reblock
+++ b/tests/dd/reblock
@@ -44,7 +44,10 @@ sed 's/,.*//' err > k && mv k err
compare err exp-reblock || fail=1
# Demonstrate that bs=N supersedes even following ibs= and obs= settings.
-(echo x; sleep .1; echo y) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
+# Choosing a delay of 0.1 would result in an occasional lost race where
+# the consumer's first read would consume 3 bytes rather than the expected 2.
+# Not wanting to sleep a full second, I'll raise that to 0.3.
+(printf ab; sleep .3; printf cd) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
sed 's/,.*//' err > k && mv k err
compare err exp-no-reblock || fail=1