hw/arm/virt: no ITS on older machine types
[qemu/kevin.git] / tests / qemu-iotests / 137
blobe5e30de2faf4ad8a5427b85765a3babdb3cfb463
1 #!/bin/bash
3 # Test qcow2 reopen
5 # Copyright (C) 2015 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 # creator
22 owner=kwolf@redhat.com
24 seq="$(basename $0)"
25 echo "QA output created by $seq"
27 here="$PWD"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
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.qemu
41 _supported_fmt qcow2
42 _supported_proto generic
43 _supported_os Linux
46 _make_test_img 64M
48 echo === Try setting valid values for all options ===
49 echo
51 # Try all options and then check that all of the basic I/O operations still
52 # work on this image.
53 $QEMU_IO \
54 -c "reopen -o lazy-refcounts=on,pass-discard-request=on" \
55 -c "reopen -o lazy-refcounts=off,pass-discard-request=off" \
56 -c "reopen -o pass-discard-snapshot=on,pass-discard-other=on" \
57 -c "reopen -o pass-discard-snapshot=off,pass-discard-other=off" \
58 -c "reopen -o overlap-check=all" \
59 -c "reopen -o overlap-check=none" \
60 -c "reopen -o overlap-check=cached" \
61 -c "reopen -o overlap-check=constant" \
62 -c "reopen -o overlap-check.template=all" \
63 -c "reopen -o overlap-check.template=none" \
64 -c "reopen -o overlap-check.template=cached" \
65 -c "reopen -o overlap-check.template=constant" \
66 -c "reopen -o overlap-check.main-header=on" \
67 -c "reopen -o overlap-check.main-header=off" \
68 -c "reopen -o overlap-check.active-l1=on" \
69 -c "reopen -o overlap-check.active-l1=off" \
70 -c "reopen -o overlap-check.active-l2=on" \
71 -c "reopen -o overlap-check.active-l2=off" \
72 -c "reopen -o overlap-check.refcount-table=on" \
73 -c "reopen -o overlap-check.refcount-table=off" \
74 -c "reopen -o overlap-check.refcount-block=on" \
75 -c "reopen -o overlap-check.refcount-block=off" \
76 -c "reopen -o overlap-check.snapshot-table=on" \
77 -c "reopen -o overlap-check.snapshot-table=off" \
78 -c "reopen -o overlap-check.inactive-l1=on" \
79 -c "reopen -o overlap-check.inactive-l1=off" \
80 -c "reopen -o overlap-check.inactive-l2=on" \
81 -c "reopen -o overlap-check.inactive-l2=off" \
82 -c "reopen -o cache-size=1M" \
83 -c "reopen -o l2-cache-size=512k" \
84 -c "reopen -o refcount-cache-size=128k" \
85 -c "reopen -o cache-clean-interval=5" \
86 -c "reopen -o cache-clean-interval=0" \
87 -c "reopen -o cache-clean-interval=10" \
89 -c "write -P 55 0 32M" \
90 -c "read -P 55 0 32M" \
91 -c "discard 0 32M" \
92 -c "write -z 0 32M" \
93 -c "read -P 0 0 32M" \
95 "$TEST_IMG" | _filter_qemu_io
98 echo
99 echo === Try setting some invalid values ===
100 echo
102 $QEMU_IO \
103 -c "reopen -o lazy-refcounts=42" \
104 -c "reopen -o cache-size=1M,l2-cache-size=64k,refcount-cache-size=64k" \
105 -c "reopen -o cache-size=1M,l2-cache-size=2M" \
106 -c "reopen -o cache-size=1M,refcount-cache-size=2M" \
107 -c "reopen -o l2-cache-size=256T" \
108 -c "reopen -o refcount-cache-size=256T" \
109 -c "reopen -o overlap-check=constant,overlap-check.template=all" \
110 -c "reopen -o overlap-check=blubb" \
111 -c "reopen -o overlap-check.template=blubb" \
112 -c "reopen -o cache-clean-interval=-1" \
113 "$TEST_IMG" | _filter_qemu_io
115 echo
116 echo === Test transaction semantics ===
117 echo
119 # Whether lazy-refcounts was actually enabled can easily be tested: Check if
120 # the dirty bit is set after a crash
121 $QEMU_IO \
122 -c "reopen -o lazy-refcounts=on,overlap-check=blubb" \
123 -c "write -P 0x5a 0 512" \
124 -c "sigraise $(kill -l KILL)" \
125 "$TEST_IMG" 2>&1 | _filter_qemu_io
127 # The dirty bit must not be set
128 $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
130 # Similarly we can test whether corruption detection has been enabled:
131 # Create L1/L2, overwrite first entry in refcount block, allocate something.
132 # Disabling the checks should fail, so the corruption must be detected.
133 _make_test_img 64M
134 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
135 poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00"
136 $QEMU_IO \
137 -c "reopen -o overlap-check=none,lazy-refcounts=42" \
138 -c "write 64k 64k" \
139 "$TEST_IMG" 2>&1 | _filter_qemu_io
141 # success, all done
142 echo '*** done'
143 rm -f $seq.full
144 status=0