target-arm: get_phys_addr_lpae: more xn control
[qemu/ar7.git] / tests / qemu-iotests / 099
blob80f3d9aaf328966ddc6c829e58e6c898be1d75ed
1 #!/bin/bash
3 # Test valid filenames for blkdebug and blkverify representatively for
4 # other protocols (such as NBD) when queried
6 # Copyright (C) 2014 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=mreitz@redhat.com
25 seq="$(basename $0)"
26 echo "QA output created by $seq"
28 here="$PWD"
29 tmp=/tmp/$$
30 status=1 # failure is the default!
32 _cleanup()
34 _cleanup_test_img
36 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
39 . ./common.rc
40 . ./common.filter
42 # Basically all formats, but "raw" has issues with _filter_imgfmt regarding the
43 # raw comparison image for blkverify; also, all images have to support creation
44 _supported_fmt qcow qcow2 qed vdi vhdx vmdk vpc
45 _supported_proto file
46 _supported_os Linux
47 _unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
48 "subformat=twoGbMaxExtentSparse"
50 function do_run_qemu()
52 $QEMU -nographic -qmp stdio -serial none "$@"
55 function run_qemu()
57 # Get the "file": "foo" entry ($foo may only contain escaped double quotes,
58 # which is how we can extract it)
59 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qmp \
60 | _filter_qemu | grep "drv0" \
61 | sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
64 function test_qemu()
66 run_qemu -drive "if=none,id=drv0,$1" <<EOF
67 { 'execute': 'qmp_capabilities' }
68 { 'execute': 'query-block' }
69 { 'execute': 'quit' }
70 EOF
75 IMG_SIZE=128K
77 _make_test_img $IMG_SIZE
78 $QEMU_IMG create -f raw "$TEST_IMG.compare" $IMG_SIZE \
79 | _filter_testdir | _filter_imgfmt
81 echo
82 echo '=== Testing simple filename for blkverify ==='
83 echo
85 # This should return simply the filename itself
86 test_qemu "file=blkverify:$TEST_IMG.compare:$TEST_IMG"
88 echo
89 echo '=== Testing filename reconstruction for blkverify ==='
90 echo
92 # This should return the same filename as above
93 test_qemu "file.driver=blkverify,file.raw.filename=$TEST_IMG.compare,file.test.file.filename=$TEST_IMG"
95 echo
96 echo '=== Testing JSON filename for blkdebug ==='
97 echo
99 # blkdebug cannot create a configuration file, therefore it is unable to
100 # generate a plain filename here; thus this should return a JSON filename
101 test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=l1_update"
103 echo
104 echo '=== Testing indirectly enforced JSON filename ==='
105 echo
107 # Because blkdebug cannot return a plain filename, blkverify is forced to
108 # generate a JSON object here as well
109 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"
111 echo
112 echo '=== Testing plain filename for blkdebug ==='
113 echo
115 touch "$TEST_DIR/blkdebug.conf"
116 test_qemu "file.driver=blkdebug,file.config=$TEST_DIR/blkdebug.conf,file.image.filename=$TEST_IMG"
118 echo
119 echo '=== Testing plain filename for blkdebug without configuration file ==='
120 echo
122 test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG"
125 rm -f "$TEST_IMG.compare" "$TEST_DIR/blkdebug.conf"
127 # success, all done
128 echo "*** done"
129 rm -f $seq.full
130 status=0