2 # test dd reblocking vs. bs=
4 # Copyright (C) 2008-2010 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 if test "$VERBOSE" = yes; then
26 # 2 short reads -> 1 full write + 1 partial write
27 cat <<\EOF
> exp-reblock || framework_failure
33 # 2 short reads -> 2 partial writes
34 cat <<\EOF
> exp-no-reblock || framework_failure
41 # Use a fifo rather than a pipe in the tests below
42 # so that the producer (printf subshell) will wait
43 # until the consumer (dd) opens the fifo therefore
44 # increasing the chance that dd will read the data
45 # from each printf separately.
46 mkfifo dd.fifo || framework_failure
52 # ensure that dd reblocks when bs= is not specified
53 dd ibs
=3 obs
=3 if=dd.fifo
> out
2> err
&
54 (printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
55 wait #for dd to complete
56 sed 's/,.*//' err
> k
&& mv k err
57 compare err exp-reblock
60 retry_delay_ dd_reblock_1
.1 6 || fail
=1
66 # Demonstrate that bs=N supersedes even following ibs= and obs= settings.
67 dd bs
=3 ibs
=1 obs
=1 if=dd.fifo
> out
2> err
&
68 (printf 'ab'; sleep $delay; printf 'cd') > dd.fifo
69 wait #for dd to complete
70 sed 's/,.*//' err
> k
&& mv k err
71 compare err exp-no-reblock
74 retry_delay_ dd_reblock_2
.1 6 || fail
=1