summaryrefslogtreecommitdiff
path: root/tests/dd
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dd')
-rwxr-xr-xtests/dd/misc2
-rwxr-xr-xtests/dd/reblock40
2 files changed, 29 insertions, 13 deletions
diff --git a/tests/dd/misc b/tests/dd/misc
index 7caacbc7b..ddd7bbd9e 100755
--- a/tests/dd/misc
+++ b/tests/dd/misc
@@ -87,6 +87,8 @@ fi
outbytes=`echo x | dd bs=3 ibs=10 obs=10 conv=sync 2>/dev/null | wc -c`
test "$outbytes" -eq 3 || fail=1
+# A delay is required to trigger a failure.
+# There might be some missed failures but it's unlikely.
(echo a; sleep .1; echo b) \
| env LC_ALL=C dd bs=4 status=noxfer iflag=fullblock >out 2>err || fail=1
printf 'a\nb\n' > out_ok || framework_failure
diff --git a/tests/dd/reblock b/tests/dd/reblock
index 4a487663b..9c9b0f85f 100755
--- a/tests/dd/reblock
+++ b/tests/dd/reblock
@@ -45,18 +45,32 @@ EOF
# from each printf separately.
mkfifo dd.fifo || framework_failure
-# ensure that dd reblocks when bs= is not specified
-dd ibs=3 obs=3 if=dd.fifo > out 2> err&
-(printf 'ab'; sleep .2; printf 'cd') > dd.fifo
-wait #for dd to complete
-sed 's/,.*//' err > k && mv k err
-compare err exp-reblock || fail=1
-
-# Demonstrate that bs=N supersedes even following ibs= and obs= settings.
-dd bs=3 ibs=1 obs=1 if=dd.fifo > out 2> err&
-(printf 'ab'; sleep .2; printf 'cd') > dd.fifo
-wait #for dd to complete
-sed 's/,.*//' err > k && mv k err
-compare err exp-no-reblock || fail=1
+dd_reblock_1()
+{
+ local delay="$1"
+
+ # ensure that dd reblocks when bs= is not specified
+ dd ibs=3 obs=3 if=dd.fifo > out 2> err&
+ (printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
+ wait #for dd to complete
+ sed 's/,.*//' err > k && mv k err
+ compare err exp-reblock
+}
+
+retry_delay_ dd_reblock_1 .1 6 || fail=1
+
+dd_reblock_2()
+{
+ local delay="$1"
+
+ # Demonstrate that bs=N supersedes even following ibs= and obs= settings.
+ dd bs=3 ibs=1 obs=1 if=dd.fifo > out 2> err&
+ (printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
+ wait #for dd to complete
+ sed 's/,.*//' err > k && mv k err
+ compare err exp-no-reblock
+}
+
+retry_delay_ dd_reblock_2 .1 6 || fail=1
Exit $fail