hw/ssi: xilinx_spips: Remove DMA related dead codes from zynqmp_spips
[qemu/ar7.git] / tests / qemu-iotests / 137
blob4680d5df3d0fe8be4041f4df38332ecadb75ca7e
1 #!/usr/bin/env bash
2 # group: rw auto
4 # Test qcow2 reopen
6 # Copyright (C) 2015 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # creator
23 owner=kwolf@redhat.com
25 seq="$(basename $0)"
26 echo "QA output created by $seq"
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 file fuse
43 _supported_os Linux
44 # We are going to use lazy-refcounts
45 _unsupported_imgopts 'compat=0.10'
48 _make_test_img 64M
50 echo === Try setting valid values for all options ===
51 echo
53 # Try all options and then check that all of the basic I/O operations still
54 # work on this image.
55 $QEMU_IO \
56 -c "reopen -o lazy-refcounts=on,pass-discard-request=on" \
57 -c "reopen -o lazy-refcounts=off,pass-discard-request=off" \
58 -c "reopen -o pass-discard-snapshot=on,pass-discard-other=on" \
59 -c "reopen -o pass-discard-snapshot=off,pass-discard-other=off" \
60 -c "reopen -o overlap-check=all" \
61 -c "reopen -o overlap-check=none" \
62 -c "reopen -o overlap-check=cached" \
63 -c "reopen -o overlap-check=constant" \
64 -c "reopen -o overlap-check.template=all" \
65 -c "reopen -o overlap-check.template=none" \
66 -c "reopen -o overlap-check.template=cached" \
67 -c "reopen -o overlap-check.template=constant" \
68 -c "reopen -o overlap-check.main-header=on" \
69 -c "reopen -o overlap-check.main-header=off" \
70 -c "reopen -o overlap-check.active-l1=on" \
71 -c "reopen -o overlap-check.active-l1=off" \
72 -c "reopen -o overlap-check.active-l2=on" \
73 -c "reopen -o overlap-check.active-l2=off" \
74 -c "reopen -o overlap-check.refcount-table=on" \
75 -c "reopen -o overlap-check.refcount-table=off" \
76 -c "reopen -o overlap-check.refcount-block=on" \
77 -c "reopen -o overlap-check.refcount-block=off" \
78 -c "reopen -o overlap-check.snapshot-table=on" \
79 -c "reopen -o overlap-check.snapshot-table=off" \
80 -c "reopen -o overlap-check.inactive-l1=on" \
81 -c "reopen -o overlap-check.inactive-l1=off" \
82 -c "reopen -o overlap-check.inactive-l2=on" \
83 -c "reopen -o overlap-check.inactive-l2=off" \
84 -c "reopen -o cache-size=1M" \
85 -c "reopen -o l2-cache-size=512k" \
86 -c "reopen -o l2-cache-entry-size=512" \
87 -c "reopen -o l2-cache-entry-size=4k" \
88 -c "reopen -o l2-cache-entry-size=64k" \
89 -c "reopen -o refcount-cache-size=128k" \
90 -c "reopen -o cache-clean-interval=5" \
91 -c "reopen -o cache-clean-interval=0" \
92 -c "reopen -o cache-clean-interval=10" \
94 -c "write -P 55 0 32M" \
95 -c "read -P 55 0 32M" \
96 -c "discard 0 32M" \
97 -c "write -z 0 32M" \
98 -c "read -P 0 0 32M" \
100 "$TEST_IMG" | _filter_qemu_io
103 echo
104 echo === Try setting some invalid values ===
105 echo
107 $QEMU_IO \
108 -c "reopen -o lazy-refcounts=42" \
109 -c "reopen -o cache-size=1M,l2-cache-size=64k,refcount-cache-size=64k" \
110 -c "reopen -o cache-size=1M,l2-cache-size=2M" \
111 -c "reopen -o cache-size=1M,refcount-cache-size=2M" \
112 -c "reopen -o l2-cache-entry-size=33k" \
113 -c "reopen -o l2-cache-entry-size=128k" \
114 -c "reopen -o refcount-cache-size=256T" \
115 -c "reopen -o overlap-check=constant,overlap-check.template=all" \
116 -c "reopen -o overlap-check=blubb" \
117 -c "reopen -o overlap-check.template=blubb" \
118 -c "reopen -o cache-clean-interval=-1" \
119 "$TEST_IMG" | _filter_qemu_io
121 _make_test_img -o "cluster_size=256k" 32P
122 $QEMU_IO \
123 -c "reopen -o l2-cache-entry-size=512,l2-cache-size=1T" \
124 "$TEST_IMG" | _filter_qemu_io
126 _make_test_img 64M
128 echo
129 echo === Test transaction semantics ===
130 echo
132 # Whether lazy-refcounts was actually enabled can easily be tested: Check if
133 # the dirty bit is set after a crash
134 _NO_VALGRIND \
135 $QEMU_IO \
136 -c "reopen -o lazy-refcounts=on,overlap-check=blubb" \
137 -c "write -P 0x5a 0 512" \
138 -c "sigraise $(kill -l KILL)" \
139 "$TEST_IMG" 2>&1 | _filter_qemu_io
141 # The dirty bit must not be set
142 # (Filter the external data file bit)
143 if $PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features \
144 | grep -q '\<0\>'
145 then
146 echo 'ERROR: Dirty bit set'
147 else
148 echo 'OK: Dirty bit not set'
151 # Similarly we can test whether corruption detection has been enabled:
152 # Create L1, overwrite refcounts, force allocation of L2 by writing
153 # data.
154 # Disabling the checks should fail, so the corruption must be detected.
155 _make_test_img 64M
156 poke_file "$TEST_IMG" "$((0x20000))" "\x00\x00\x00\x00\x00\x00\x00\x00"
157 $QEMU_IO \
158 -c "reopen -o overlap-check=none,lazy-refcounts=42" \
159 -c "write 64k 64k" \
160 "$TEST_IMG" 2>&1 | _filter_qemu_io
162 # success, all done
163 echo '*** done'
164 rm -f $seq.full
165 status=0