target/xtensa: Use tcg_gen_abs_i32
[qemu/ar7.git] / tests / qemu-iotests / 241
blob017a736aabaddb79ee78aef2636613a8762e215a
1 #!/bin/bash
3 # Test qemu-nbd vs. unaligned images
5 # Copyright (C) 2018-2019 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 seq="$(basename $0)"
22 echo "QA output created by $seq"
24 status=1 # failure is the default!
26 nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
28 _cleanup()
30 _cleanup_test_img
31 rm -f "$TEST_DIR/server.log"
32 nbd_server_stop
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39 . ./common.nbd
41 _supported_fmt raw
42 _supported_proto nbd
43 _supported_os Linux
44 _require_command QEMU_NBD
46 # can't use _make_test_img, because qemu-img rounds image size up,
47 # and because we want to use Unix socket rather than TCP port. Likewise,
48 # we have to redirect TEST_IMG to our server.
49 # This tests that we can deal with the hole at the end of an unaligned
50 # raw file (either because the server doesn't advertise alignment too
51 # large, or because the client ignores the server's noncompliance - even
52 # though we can't actually wire iotests into checking trace messages).
53 printf %01000d 0 > "$TEST_IMG_FILE"
54 TEST_IMG="nbd:unix:$nbd_unix_socket"
56 echo
57 echo "=== Exporting unaligned raw image, natural alignment ==="
58 echo
60 nbd_server_start_unix_socket -f $IMGFMT "$TEST_IMG_FILE"
62 $QEMU_NBD_PROG --list -k $nbd_unix_socket | grep '\(size\|min\)'
63 $QEMU_IMG map -f raw --output=json "$TEST_IMG" | _filter_qemu_img_map
64 $QEMU_IO -f raw -c map "$TEST_IMG"
65 nbd_server_stop
67 echo
68 echo "=== Exporting unaligned raw image, forced server sector alignment ==="
69 echo
71 # Intentionally omit '-f' to force image probing, which in turn forces
72 # sector alignment, here at the server.
73 nbd_server_start_unix_socket "$TEST_IMG_FILE" 2> "$TEST_DIR/server.log"
75 $QEMU_NBD_PROG --list -k $nbd_unix_socket | grep '\(size\|min\)'
76 $QEMU_IMG map -f raw --output=json "$TEST_IMG" | _filter_qemu_img_map
77 $QEMU_IO -f raw -c map "$TEST_IMG"
78 nbd_server_stop
79 cat "$TEST_DIR/server.log" | _filter_testdir
81 echo
82 echo "=== Exporting unaligned raw image, forced client sector alignment ==="
83 echo
85 # Now force sector alignment at the client.
86 nbd_server_start_unix_socket -f $IMGFMT "$TEST_IMG_FILE"
88 $QEMU_NBD_PROG --list -k $nbd_unix_socket | grep '\(size\|min\)'
89 $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
90 $QEMU_IO -c map "$TEST_IMG"
91 nbd_server_stop
93 # Not tested yet: we also want to ensure that qemu as NBD client does
94 # not access beyond the end of a server's advertised unaligned size:
95 # nbdkit -U - memory size=513 --run 'qemu-io -f raw -c "r 512 512" $nbd'
96 # However, since qemu as server always rounds up to a sector alignment,
97 # we would have to use nbdkit to provoke the current client failures.
99 # success, all done
100 echo '*** done'
101 rm -f $seq.full
102 status=0