Update Red Hat Copyright Notices
[nbdkit.git] / tests / test-data-7E.sh
blob964fb2658d6af463b8098cad21834787eec47a60
1 #!/usr/bin/env bash
2 # nbdkit
3 # Copyright Red Hat
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of Red Hat nor the names of its contributors may be
17 # used to endorse or promote products derived from this software without
18 # specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
21 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
33 # Test the data plugin creating a 7 EB partitioned disk, and
34 # the partition filter on top.
36 source ./functions.sh
37 set -e
38 set -x
40 requires_nbdsh_uri
42 sock=$(mktemp -u /tmp/nbdkit-test-sock.XXXXXX)
43 files="data-7E.pid $sock"
44 rm -f $files
45 cleanup_fn rm -f $files
47 # Run nbdkit.
48 start_nbdkit -P data-7E.pid -U $sock \
49 --filter=partition \
50 data size=7E partition=1 \
52 @0x1c0 2 0 0xee 0xfe 0xff 0xff 0x01 0 0 0 0xff 0xff 0xff 0xff
53 @0x1fe 0x55 0xaa
54 @0x200 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54
55 0 0 1 0 0x5c 0 0 0
56 0x9b 0xe5 0x6a 0xc5 0 0 0 0 1 0 0 0 0 0 0 0
57 0xff 0xff 0xff 0xff 0xff 0xff 0x37 0 0x22 0 0 0 0 0 0 0
58 0xde 0xff 0xff 0xff 0xff 0xff 0x37 0
59 0x72 0xb6 0x9e 0x0c 0x6b 0x76 0xb0 0x4f
60 0xb3 0x94 0xb2 0xf1 0x61 0xec 0xdd 0x3c 2 0 0 0 0 0 0 0
61 0x80 0 0 0 0x80 0 0 0 0x79 0x8a 0xd0 0x7e 0 0 0 0
62 @0x400 0xaf 0x3d 0xc6 0x0f 0x83 0x84 0x72 0x47
63 0x8e 0x79 0x3d 0x69 0xd8 0x47 0x7d 0xe4
64 0xd5 0x19 0x46 0x95 0xe3 0x82 0xa8 0x4c
65 0x95 0x82 0x7a 0xbe 0x1c 0xfc 0x62 0x90
66 0x80 0 0 0 0 0 0 0 0x80 0xff 0xff 0xff 0xff 0xff 0x37 0
67 0 0 0 0 0 0 0 0 0x70 0 0x31 0 0 0 0 0
68 @0x6fffffffffffbe00
69 0xaf 0x3d 0xc6 0x0f 0x83 0x84 0x72 0x47
70 0x8e 0x79 0x3d 0x69 0xd8 0x47 0x7d 0xe4
71 0xd5 0x19 0x46 0x95 0xe3 0x82 0xa8 0x4c
72 0x95 0x82 0x7a 0xbe 0x1c 0xfc 0x62 0x90
73 0x80 0 0 0 0 0 0 0 0x80 0xff 0xff 0xff 0xff 0xff 0x37 0
74 0 0 0 0 0 0 0 0 0x70 0 0x31 0 0 0 0 0
75 @0x6ffffffffffffe00
76 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54
77 0 0 1 0 0x5c 0 0 0
78 0x6c 0x76 0xa1 0xa0 0 0 0 0
79 0xff 0xff 0xff 0xff 0xff 0xff 0x37 0
80 1 0 0 0 0 0 0 0 0x22 0 0 0 0 0 0 0
81 0xde 0xff 0xff 0xff 0xff 0xff 0x37 0
82 0x72 0xb6 0x9e 0x0c 0x6b 0x76 0xb0 0x4f
83 0xb3 0x94 0xb2 0xf1 0x61 0xec 0xdd 0x3c
84 0xdf 0xff 0xff 0xff 0xff 0xff 0x37 0
85 0x80 0 0 0 0x80 0 0 0 0x79 0x8a 0xd0 0x7e 0 0 0 0
88 # Since we're reading the empty first partition, any read returns zeroes.
89 nbdsh --connect "nbd+unix://?socket=$sock" \
90 -c '
91 buf = h.pread(16, 498)
92 assert buf == bytearray(16)