2 # nbd client library in userspace
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 # Adapted from copy-sparse.sh.
21 . ..
/tests
/functions.sh
26 requires nbdkit
--version
27 requires nbdkit
--exit-with-parent --version
28 requires nbdkit data
--version
29 requires nbdkit
eval --version
31 out
=copy-sparse-allocated.out
34 $VG nbdcopy
--allocated --request-size=32768 -- \
35 [ nbdkit
--exit-with-parent data data
='
41 [ nbdkit
--exit-with-parent eval \
42 get_size
=' echo 7E ' \
43 pwrite
=" echo \$@ >> $out " \
44 trim
=" echo \$@ >> $out " \
45 zero
=" echo \$@ >> $out " ]
52 if [ "$(cat $out)" != "pwrite 1 4294967296
54 pwrite 32768 1073709056
55 pwrite 32768 4294934528
57 zero 134184960 4160749568
58 zero 134184960 939524096
59 zero 134217728 1073741824
60 zero 134217728 1207959552
61 zero 134217728 134217728
62 zero 134217728 1342177280
63 zero 134217728 1476395008
64 zero 134217728 1610612736
65 zero 134217728 1744830464
66 zero 134217728 1879048192
67 zero 134217728 2013265920
68 zero 134217728 2147483648
69 zero 134217728 2281701376
70 zero 134217728 2415919104
71 zero 134217728 2550136832
72 zero 134217728 268435456
73 zero 134217728 2684354560
74 zero 134217728 2818572288
75 zero 134217728 2952790016
76 zero 134217728 3087007744
77 zero 134217728 3221225472
78 zero 134217728 3355443200
79 zero 134217728 3489660928
80 zero 134217728 3623878656
81 zero 134217728 3758096384
82 zero 134217728 3892314112
83 zero 134217728 402653184
84 zero 134217728 4026531840
85 zero 134217728 536870912
86 zero 134217728 671088640
87 zero 134217728 805306368" ]; then
88 echo "$0: output does not match expected"