3 # qcow2 error path testing
5 # Copyright (C) 2010 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/>.
22 owner
=kwolf@redhat.com
25 echo "QA output created by $seq"
29 status
=1 # failure is the default!
34 rm $TEST_DIR/blkdebug.conf
36 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
43 # Currently only qcow2 supports rebasing
48 echo "Errors while writing 128 kB"
53 BLKDBG_TEST_IMG
="blkdebug:$TEST_DIR/blkdebug.conf:$TEST_IMG"
65 refblock_update_part \
74 for once
in on off
; do
75 for vmstate
in "" "-b"; do
77 cat > $TEST_DIR/blkdebug.conf
<<EOF
88 echo "Event: $event; errno: $errno; imm: $imm; once: $once; write $vmstate"
89 $QEMU_IO -c "write $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
91 # l2_load is not called on allocation, so issue a second write
92 # Reads are another path to trigger l2_load, so do a read, too
93 if [ "$event" == "l2_load" ]; then
94 $QEMU_IO -c "write $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
95 $QEMU_IO -c "read $vmstate 0 128k " $BLKDBG_TEST_IMG | _filter_qemu_io
98 $QEMU_IMG check
$TEST_IMG 2>&1 |
grep -v "refcount=1 reference=0"
108 echo === Refcout table growth tests
===
114 refblock_alloc.hookup \
115 refblock_alloc.
write \
116 refblock_alloc.write_blocks \
117 refblock_alloc.write_table \
118 refblock_alloc.switch_table \
122 # This one takes a while, so let's test only one error code (ENOSPC should
123 # never be generated by qemu, so it's probably a good choice)
126 for once
in on off
; do
127 for vmstate
in "" "-b"; do
129 cat > $TEST_DIR/blkdebug.conf
<<EOF
140 echo "Event: $event; errno: $errno; imm: $imm; once: $once; write $vmstate"
141 $QEMU_IO -c "write $vmstate 0 64M" $BLKDBG_TEST_IMG | _filter_qemu_io
143 $QEMU_IMG check
$TEST_IMG 2>&1 |
grep -v "refcount=1 reference=0"
152 echo === L1 growth tests
===
158 l1_grow.alloc_table \
159 l1_grow.write_table \
160 l1_grow.activate_table \
164 for errno
in 5 28; do
166 for once
in on off
; do
168 cat > $TEST_DIR/blkdebug.conf
<<EOF
179 echo "Event: $event; errno: $errno; imm: $imm; once: $once"
180 $QEMU_IO -c "write -b 0 64k" $BLKDBG_TEST_IMG | _filter_qemu_io
182 $QEMU_IMG check
$TEST_IMG 2>&1 |
grep -v "refcount=1 reference=0"