hw/arm/sbsa-ref: Remove unnecessary check for secure_sysmem == NULL
[qemu/ar7.git] / tests / qemu-iotests / 191
blob528022e8d811221d0122f6ae64f545471bc4b008
1 #!/usr/bin/env bash
3 # Test commit block job where top has two parents
5 # Copyright (C) 2017 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 status=1 # failure is the default!
29 _cleanup()
31 rm -f "${TEST_IMG}.mid"
32 rm -f "${TEST_IMG}.ovl2"
33 rm -f "${TEST_IMG}.ovl3"
34 _cleanup_test_img
35 _cleanup_qemu
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
42 . ./common.qemu
44 _supported_fmt qcow2
45 _supported_proto file
47 size=64M
49 echo
50 echo === Preparing and starting VM ===
51 echo
53 TEST_IMG="${TEST_IMG}.base" _make_test_img $size
54 IMGOPTS=$(_optstr_add "$IMGOPTS" "backing_fmt=$IMGFMT") \
55 TEST_IMG="${TEST_IMG}.mid" _make_test_img -b "${TEST_IMG}.base"
56 _make_test_img -b "${TEST_IMG}.mid"
57 TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid"
59 $QEMU_IO -c 'write -P 0x55 1M 64k' "${TEST_IMG}.mid" | _filter_qemu_io
61 qemu_comm_method="qmp"
62 qmp_pretty="y"
64 _launch_qemu \
65 -blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.base,node-name=base" \
66 -blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.mid,node-name=mid,backing=base" \
67 -blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG},node-name=top,backing=mid" \
68 -blockdev "driver=${IMGFMT},file.driver=file,file.filename=${TEST_IMG}.ovl2,node-name=top2,backing=mid"
69 h=$QEMU_HANDLE
70 _send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" '^}'
72 echo
73 echo === Perform commit job ===
74 echo
76 _send_qemu_cmd $h \
77 "{ 'execute': 'block-commit',
78 'arguments': { 'job-id': 'commit0',
79 'device': 'top',
80 'base':'$TEST_IMG.base',
81 'top': '$TEST_IMG.mid' } }" \
82 '"status": "null"'
83 _send_qemu_cmd $h "" "^}"
85 echo
86 echo === Check that both top and top2 point to base now ===
87 echo
89 _send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" |
90 _filter_generated_node_ids | _filter_actual_image_size | _filter_img_info
92 _send_qemu_cmd $h "{ 'execute': 'quit' }" "^}"
93 wait=1 _cleanup_qemu
95 _img_info
96 TEST_IMG="$TEST_IMG.ovl2" _img_info
99 echo
100 echo === Preparing and starting VM with -drive ===
101 echo
103 TEST_IMG="${TEST_IMG}.base" _make_test_img $size
104 TEST_IMG="${TEST_IMG}.mid" _make_test_img -b "${TEST_IMG}.base"
105 _make_test_img -b "${TEST_IMG}.mid"
106 TEST_IMG="${TEST_IMG}.ovl2" _make_test_img -b "${TEST_IMG}.mid"
107 TEST_IMG="${TEST_IMG}.ovl3" _make_test_img -b "${TEST_IMG}.ovl2"
109 $QEMU_IO -c 'write -P 0x55 1M 64k' "${TEST_IMG}.mid" | _filter_qemu_io
111 qemu_comm_method="qmp"
112 qmp_pretty="y"
114 _launch_qemu \
115 -drive "driver=${IMGFMT},file=${TEST_IMG},node-name=top,backing.node-name=mid" \
116 -drive "driver=${IMGFMT},file=${TEST_IMG}.ovl3,node-name=top2,backing.backing=mid"
117 h=$QEMU_HANDLE
118 _send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" '^}'
120 echo
121 echo === Perform commit job ===
122 echo
124 _send_qemu_cmd $h \
125 "{ 'execute': 'block-commit',
126 'arguments': { 'job-id': 'commit0',
127 'device': 'top',
128 'base':'$TEST_IMG.base',
129 'top': '$TEST_IMG.mid' } }" \
130 '"status": "null"'
131 _send_qemu_cmd $h "" "^}"
133 echo
134 echo === Check that both top and top2 point to base now ===
135 echo
137 _send_qemu_cmd $h "{ 'execute': 'query-named-block-nodes' }" "^}" |
138 _filter_generated_node_ids | _filter_actual_image_size | _filter_img_info
140 _send_qemu_cmd $h "{ 'execute': 'quit' }" "^}"
141 wait=1 _cleanup_qemu
143 _img_info
144 TEST_IMG="$TEST_IMG.ovl2" _img_info
146 # success, all done
147 echo "*** done"
148 rm -f $seq.full
149 status=0