target/i386/kvm: Free xsave_buf when destroying vCPU
[qemu/rayw.git] / tests / qemu-iotests / 099
blob2f1199ce04f999c2ce7470e188dee88b85aebd49
1 #!/usr/bin/env bash
2 # group: rw auto quick
4 # Test valid filenames for blkdebug and blkverify representatively for
5 # other protocols (such as NBD) when queried
7 # Copyright (C) 2014 Red Hat, Inc.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # creator
24 owner=mreitz@redhat.com
26 seq="$(basename $0)"
27 echo "QA output created by $seq"
29 status=1 # failure is the default!
31 _cleanup()
33 _cleanup_test_img
34 _rm_test_img "$TEST_IMG.compare"
35 rm -f "$TEST_DIR/blkdebug.conf"
38 trap "_cleanup; exit \$status" 0 1 2 3 15
40 # get standard environment, filters and checks
41 . ./common.rc
42 . ./common.filter
44 # Basically all formats, but "raw" has issues with _filter_imgfmt regarding the
45 # raw comparison image for blkverify; also, all images have to support creation
46 _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
47 _supported_proto file
48 _supported_os Linux
49 _require_drivers blkdebug blkverify
50 # data_file would change the json:{} filenames
51 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
52 "subformat=twoGbMaxExtentSparse" data_file
54 do_run_qemu()
56 $QEMU -nographic -qmp stdio -serial none "$@"
59 run_qemu()
61 # Get the "file": "foo" entry ($foo may only contain escaped double quotes,
62 # which is how we can extract it)
63 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qmp \
64 | _filter_qemu | grep "drv0" \
65 | sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
68 test_qemu()
70 run_qemu -drive "if=none,id=drv0,$1" <<EOF
71 { 'execute': 'qmp_capabilities' }
72 { 'execute': 'query-block' }
73 { 'execute': 'quit' }
74 EOF
79 IMG_SIZE=128K
81 _make_test_img $IMG_SIZE
82 $QEMU_IMG create -f raw "$TEST_IMG.compare" $IMG_SIZE \
83 | _filter_testdir | _filter_imgfmt
85 echo
86 echo '=== Testing simple filename for blkverify ==='
87 echo
89 # This should return simply the filename itself
90 test_qemu "file=blkverify:$TEST_IMG.compare:$TEST_IMG"
92 echo
93 echo '=== Testing filename reconstruction for blkverify ==='
94 echo
96 # This should return the same filename as above
97 test_qemu "file.driver=blkverify,file.raw.filename=$TEST_IMG.compare,file.test.file.filename=$TEST_IMG"
99 echo
100 echo '=== Testing JSON filename for blkdebug ==='
101 echo
103 # blkdebug cannot create a configuration file, therefore it is unable to
104 # generate a plain filename here; thus this should return a JSON filename
105 test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=l1_update"
107 echo
108 echo '=== Testing indirectly enforced JSON filename ==='
109 echo
111 # Because blkdebug cannot return a plain filename, blkverify is forced to
112 # generate a JSON object here as well
113 test_qemu "file.driver=blkverify,file.raw.filename=$TEST_IMG.compare,file.test.file.driver=blkdebug,file.test.file.image.filename=$TEST_IMG,file.test.file.inject-error.0.event=l1_update"
115 echo
116 echo '=== Testing plain filename for blkdebug ==='
117 echo
119 touch "$TEST_DIR/blkdebug.conf"
120 test_qemu "file.driver=blkdebug,file.config=$TEST_DIR/blkdebug.conf,file.image.filename=$TEST_IMG"
122 echo
123 echo '=== Testing plain filename for blkdebug without configuration file ==='
124 echo
126 test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG"
129 # success, all done
130 echo "*** done"
131 rm -f $seq.full
132 status=0