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
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
33 # Additional test of the offset filter using the pattern plugin.
39 requires qemu-io
--version
42 files
="offset2.out offset2.pid $sock"
44 cleanup_fn
rm -f $files
46 # Run nbdkit with pattern plugin and offset filter in front.
47 # 8070450532247927809 = 7E - 1023
48 start_nbdkit
-P offset2.pid
-U $sock \
51 offset
=8070450532247927809 range
=512
53 qemu-io
-r -f raw
"nbd+unix://?socket=$sock" \
54 -c 'r -v 0 512' |
grep -E '^[[:xdigit:]]+:' > offset2.out
55 if [ "$(cat offset2.out)" != "00000000: ff ff ff ff ff fc 00 6f ff ff ff ff ff fc 08 6f .......o.......o
56 00000010: ff ff ff ff ff fc 10 6f ff ff ff ff ff fc 18 6f .......o.......o
57 00000020: ff ff ff ff ff fc 20 6f ff ff ff ff ff fc 28 6f .......o.......o
58 00000030: ff ff ff ff ff fc 30 6f ff ff ff ff ff fc 38 6f ......0o......8o
59 00000040: ff ff ff ff ff fc 40 6f ff ff ff ff ff fc 48 6f .......o......Ho
60 00000050: ff ff ff ff ff fc 50 6f ff ff ff ff ff fc 58 6f ......Po......Xo
61 00000060: ff ff ff ff ff fc 60 6f ff ff ff ff ff fc 68 6f .......o......ho
62 00000070: ff ff ff ff ff fc 70 6f ff ff ff ff ff fc 78 6f ......po......xo
63 00000080: ff ff ff ff ff fc 80 6f ff ff ff ff ff fc 88 6f .......o.......o
64 00000090: ff ff ff ff ff fc 90 6f ff ff ff ff ff fc 98 6f .......o.......o
65 000000a0: ff ff ff ff ff fc a0 6f ff ff ff ff ff fc a8 6f .......o.......o
66 000000b0: ff ff ff ff ff fc b0 6f ff ff ff ff ff fc b8 6f .......o.......o
67 000000c0: ff ff ff ff ff fc c0 6f ff ff ff ff ff fc c8 6f .......o.......o
68 000000d0: ff ff ff ff ff fc d0 6f ff ff ff ff ff fc d8 6f .......o.......o
69 000000e0: ff ff ff ff ff fc e0 6f ff ff ff ff ff fc e8 6f .......o.......o
70 000000f0: ff ff ff ff ff fc f0 6f ff ff ff ff ff fc f8 6f .......o.......o
71 00000100: ff ff ff ff ff fd 00 6f ff ff ff ff ff fd 08 6f .......o.......o
72 00000110: ff ff ff ff ff fd 10 6f ff ff ff ff ff fd 18 6f .......o.......o
73 00000120: ff ff ff ff ff fd 20 6f ff ff ff ff ff fd 28 6f .......o.......o
74 00000130: ff ff ff ff ff fd 30 6f ff ff ff ff ff fd 38 6f ......0o......8o
75 00000140: ff ff ff ff ff fd 40 6f ff ff ff ff ff fd 48 6f .......o......Ho
76 00000150: ff ff ff ff ff fd 50 6f ff ff ff ff ff fd 58 6f ......Po......Xo
77 00000160: ff ff ff ff ff fd 60 6f ff ff ff ff ff fd 68 6f .......o......ho
78 00000170: ff ff ff ff ff fd 70 6f ff ff ff ff ff fd 78 6f ......po......xo
79 00000180: ff ff ff ff ff fd 80 6f ff ff ff ff ff fd 88 6f .......o.......o
80 00000190: ff ff ff ff ff fd 90 6f ff ff ff ff ff fd 98 6f .......o.......o
81 000001a0: ff ff ff ff ff fd a0 6f ff ff ff ff ff fd a8 6f .......o.......o
82 000001b0: ff ff ff ff ff fd b0 6f ff ff ff ff ff fd b8 6f .......o.......o
83 000001c0: ff ff ff ff ff fd c0 6f ff ff ff ff ff fd c8 6f .......o.......o
84 000001d0: ff ff ff ff ff fd d0 6f ff ff ff ff ff fd d8 6f .......o.......o
85 000001e0: ff ff ff ff ff fd e0 6f ff ff ff ff ff fd e8 6f .......o.......o
86 000001f0: ff ff ff ff ff fd f0 6f ff ff ff ff ff fd f8 6f .......o.......o" ]
88 echo "$0: unexpected pattern:"