iotests/129: Do not check @busy
[qemu.git] / tests / qemu-iotests / 247
blobace6dba052a2e53d18a7caebe959d5f0106a22e2
1 #!/usr/bin/env bash
2 # group: rw quick
4 # Test for auto-read-only with commit block job
6 # Copyright (C) 2019 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=kwolf@redhat.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 for img in "$TEST_IMG".[01234]; do
34 _rm_test_img "$img"
35 done
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # get standard environment, filters and checks
40 . ./common.rc
41 . ./common.filter
43 # Requires backing files and .bdrv_change_backing_file support
44 _supported_fmt qcow2 qed
45 _supported_proto file fuse
47 size=128M
49 echo
50 echo "=== Try commit to backing file with auto-read-only ==="
51 echo
52 TEST_IMG="$TEST_IMG.0" _make_test_img $size
53 TEST_IMG="$TEST_IMG.1" _make_test_img $size
54 TEST_IMG="$TEST_IMG.2" _make_test_img $size
55 TEST_IMG="$TEST_IMG.3" _make_test_img $size
56 TEST_IMG="$TEST_IMG.4" _make_test_img $size
58 (cat <<EOF
59 {"execute":"qmp_capabilities"}
60 {"execute":"block-commit",
61 "arguments":{"device":"format-4", "top-node": "format-2", "base-node":"format-0", "job-id":"job0"}}
62 EOF
63 if [ "${VALGRIND_QEMU}" == "y" ]; then
64 sleep 10
65 else
66 sleep 1
68 echo '{"execute":"quit"}'
69 ) | $QEMU -qmp stdio -nographic -nodefaults \
70 -blockdev file,node-name=file-0,filename=$TEST_IMG.0,auto-read-only=on \
71 -blockdev $IMGFMT,node-name=format-0,file=file-0,read-only=on \
72 -blockdev file,node-name=file-1,filename=$TEST_IMG.1,auto-read-only=on \
73 -blockdev $IMGFMT,node-name=format-1,file=file-1,read-only=on,backing=format-0 \
74 -blockdev file,node-name=file-2,filename=$TEST_IMG.2,auto-read-only=on \
75 -blockdev $IMGFMT,node-name=format-2,file=file-2,read-only=on,backing=format-1 \
76 -blockdev file,node-name=file-3,filename=$TEST_IMG.3,auto-read-only=on \
77 -blockdev $IMGFMT,node-name=format-3,file=file-3,read-only=on,backing=format-2 \
78 -blockdev file,node-name=file-4,filename=$TEST_IMG.4,auto-read-only=on \
79 -blockdev $IMGFMT,node-name=format-4,file=file-4,read-only=on,backing=format-3 |
80 _filter_qmp
82 # success, all done
83 echo "*** done"
84 rm -f $seq.full
85 status=0