check: Only test ipack when it is compiled in
[qemu/kevin.git] / tests / qemu-iotests / 221
blob41c4e4bdf887fbb2f35a1eb86f704e3d0bcc57cb
1 #!/bin/bash
3 # Test qemu-img vs. unaligned images
5 # Copyright (C) 2018 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 here="$PWD"
25 status=1 # failure is the default!
27 _cleanup()
29 _cleanup_test_img
31 trap "_cleanup; exit \$status" 0 1 2 3 15
33 # get standard environment, filters and checks
34 . ./common.rc
35 . ./common.filter
37 _supported_fmt raw
38 _supported_proto file
39 _supported_os Linux
41 echo
42 echo "=== Check mapping of unaligned raw image ==="
43 echo
45 _make_test_img 43009 # qemu-img create rounds size up
46 $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
48 truncate --size=43009 "$TEST_IMG" # so we resize it and check again
49 $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
51 $QEMU_IO -c 'w 43008 1' "$TEST_IMG" | _filter_qemu_io # writing also rounds up
52 $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
54 truncate --size=43009 "$TEST_IMG" # so we resize it and check again
55 $QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
57 # success, all done
58 echo '*** done'
59 rm -f $seq.full
60 status=0