target/arm: Convert VMOV (register) to decodetree
[qemu/ar7.git] / tests / qemu-iotests / 249
blobe4650ecf6b11f5f8f51fc52549e71fc86a5530af
1 #!/usr/bin/env bash
3 # Test that a backing image is put back in read-only mode after
4 # block-commit (both when it fails and when it succeeds).
6 # Copyright (C) 2019 Igalia, S.L.
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=berto@igalia.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
33 rm -f "$TEST_IMG.base"
34 rm -f "$TEST_IMG.int"
36 trap "_cleanup; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
39 . ./common.rc
40 . ./common.filter
41 . ./common.qemu
43 # Any format implementing BlockDriver.bdrv_change_backing_file
44 _supported_fmt qcow2 qed
45 _supported_proto file
46 _supported_os Linux
48 IMG_SIZE=1M
50 # Create the images: base <- int <- active
51 TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE | _filter_imgfmt
52 TEST_IMG="$TEST_IMG.int" _make_test_img -b "$TEST_IMG.base" | _filter_imgfmt
53 _make_test_img -b "$TEST_IMG.int" | _filter_imgfmt
55 # Launch QEMU with these two drives:
56 # none0: base (read-only)
57 # none1: base <- int <- active
58 _launch_qemu -drive if=none,file="${TEST_IMG}.base",node-name=base,read-only=on \
59 -drive if=none,file="${TEST_IMG}",backing.node-name=int,backing.backing=base
61 _send_qemu_cmd $QEMU_HANDLE \
62 "{ 'execute': 'qmp_capabilities' }" \
63 'return'
65 echo
66 echo '=== Send a write command to a drive opened in read-only mode (1)'
67 echo
68 _send_qemu_cmd $QEMU_HANDLE \
69 "{ 'execute': 'human-monitor-command',
70 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
71 'return'
73 echo
74 echo '=== Run block-commit on base using an invalid filter node name'
75 echo
76 _send_qemu_cmd $QEMU_HANDLE \
77 "{ 'execute': 'block-commit',
78 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int',
79 'filter-node-name': '1234'}}" \
80 'error'
82 echo
83 echo '=== Send a write command to a drive opened in read-only mode (2)'
84 echo
85 _send_qemu_cmd $QEMU_HANDLE \
86 "{ 'execute': 'human-monitor-command',
87 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
88 'return'
90 echo
91 echo '=== Run block-commit on base using the default filter node name'
92 echo
93 _send_qemu_cmd $QEMU_HANDLE \
94 "{ 'execute': 'block-commit',
95 'arguments': {'job-id': 'job0', 'device': 'none1', 'top-node': 'int'}}" \
96 'return'
98 # Wait for block-commit to finish
99 _send_qemu_cmd $QEMU_HANDLE '' \
100 '"status": "null"'
102 echo
103 echo '=== Send a write command to a drive opened in read-only mode (3)'
104 echo
105 _send_qemu_cmd $QEMU_HANDLE \
106 "{ 'execute': 'human-monitor-command',
107 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \
108 'return'
110 _cleanup_qemu
112 # success, all done
113 echo "*** done"
114 rm -f $seq.full
115 status=0