docs: Move release notes to their own section.
[nbdkit/ericb.git] / tests / test-pattern-largest-for-qemu.sh
blob3011b7a80684baf21c11c9d8074a23430cf728c3
1 #!/usr/bin/env bash
2 # nbdkit
3 # Copyright (C) 2018 Red Hat Inc.
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 pattern plugin with the largest possible size supported
34 # by qemu and nbdkit.
36 source ./functions.sh
37 set -e
39 requires qemu-io --version
41 sock=`mktemp -u`
42 files="pattern-largest-for-qemu.out pattern-largest-for-qemu.pid $sock"
43 rm -f $files
44 cleanup_fn rm -f $files
46 # Run nbdkit with pattern plugin.
47 # size = (2^63-1) & ~511 which is the largest supported by qemu.
48 start_nbdkit -P pattern-largest-for-qemu.pid -U $sock \
49 pattern 9223372036854775296
51 qemu-io -r -f raw "nbd+unix://?socket=$sock" \
52 -c 'r -v 9223372036854774784 512' | grep -E '^[[:xdigit:]]+:' > pattern-largest-for-qemu.out
53 if [ "$(cat pattern-largest-for-qemu.out)" != "7ffffffffffffc00: 7f ff ff ff ff ff fc 00 7f ff ff ff ff ff fc 08 ................
54 7ffffffffffffc10: 7f ff ff ff ff ff fc 10 7f ff ff ff ff ff fc 18 ................
55 7ffffffffffffc20: 7f ff ff ff ff ff fc 20 7f ff ff ff ff ff fc 28 ................
56 7ffffffffffffc30: 7f ff ff ff ff ff fc 30 7f ff ff ff ff ff fc 38 .......0.......8
57 7ffffffffffffc40: 7f ff ff ff ff ff fc 40 7f ff ff ff ff ff fc 48 ...............H
58 7ffffffffffffc50: 7f ff ff ff ff ff fc 50 7f ff ff ff ff ff fc 58 .......P.......X
59 7ffffffffffffc60: 7f ff ff ff ff ff fc 60 7f ff ff ff ff ff fc 68 ...............h
60 7ffffffffffffc70: 7f ff ff ff ff ff fc 70 7f ff ff ff ff ff fc 78 .......p.......x
61 7ffffffffffffc80: 7f ff ff ff ff ff fc 80 7f ff ff ff ff ff fc 88 ................
62 7ffffffffffffc90: 7f ff ff ff ff ff fc 90 7f ff ff ff ff ff fc 98 ................
63 7ffffffffffffca0: 7f ff ff ff ff ff fc a0 7f ff ff ff ff ff fc a8 ................
64 7ffffffffffffcb0: 7f ff ff ff ff ff fc b0 7f ff ff ff ff ff fc b8 ................
65 7ffffffffffffcc0: 7f ff ff ff ff ff fc c0 7f ff ff ff ff ff fc c8 ................
66 7ffffffffffffcd0: 7f ff ff ff ff ff fc d0 7f ff ff ff ff ff fc d8 ................
67 7ffffffffffffce0: 7f ff ff ff ff ff fc e0 7f ff ff ff ff ff fc e8 ................
68 7ffffffffffffcf0: 7f ff ff ff ff ff fc f0 7f ff ff ff ff ff fc f8 ................
69 7ffffffffffffd00: 7f ff ff ff ff ff fd 00 7f ff ff ff ff ff fd 08 ................
70 7ffffffffffffd10: 7f ff ff ff ff ff fd 10 7f ff ff ff ff ff fd 18 ................
71 7ffffffffffffd20: 7f ff ff ff ff ff fd 20 7f ff ff ff ff ff fd 28 ................
72 7ffffffffffffd30: 7f ff ff ff ff ff fd 30 7f ff ff ff ff ff fd 38 .......0.......8
73 7ffffffffffffd40: 7f ff ff ff ff ff fd 40 7f ff ff ff ff ff fd 48 ...............H
74 7ffffffffffffd50: 7f ff ff ff ff ff fd 50 7f ff ff ff ff ff fd 58 .......P.......X
75 7ffffffffffffd60: 7f ff ff ff ff ff fd 60 7f ff ff ff ff ff fd 68 ...............h
76 7ffffffffffffd70: 7f ff ff ff ff ff fd 70 7f ff ff ff ff ff fd 78 .......p.......x
77 7ffffffffffffd80: 7f ff ff ff ff ff fd 80 7f ff ff ff ff ff fd 88 ................
78 7ffffffffffffd90: 7f ff ff ff ff ff fd 90 7f ff ff ff ff ff fd 98 ................
79 7ffffffffffffda0: 7f ff ff ff ff ff fd a0 7f ff ff ff ff ff fd a8 ................
80 7ffffffffffffdb0: 7f ff ff ff ff ff fd b0 7f ff ff ff ff ff fd b8 ................
81 7ffffffffffffdc0: 7f ff ff ff ff ff fd c0 7f ff ff ff ff ff fd c8 ................
82 7ffffffffffffdd0: 7f ff ff ff ff ff fd d0 7f ff ff ff ff ff fd d8 ................
83 7ffffffffffffde0: 7f ff ff ff ff ff fd e0 7f ff ff ff ff ff fd e8 ................
84 7ffffffffffffdf0: 7f ff ff ff ff ff fd f0 7f ff ff ff ff ff fd f8 ................" ]
85 then
86 echo "$0: unexpected pattern:"
87 cat pattern-largest-for-qemu.out
88 exit 1