Merge remote-tracking branch 'remotes/kraxel/tags/ui-20210311-pull-request' into...
[qemu/ar7.git] / tests / qemu-iotests / 186
blob072e54e62bd2c2f73d3ae3f2abf4744cc64f3cb4
1 #!/usr/bin/env bash
2 # group: rw auto
4 # Test 'info block' with all kinds of configurations
6 # Copyright (C) 2017 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
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
40 _supported_fmt qcow2
41 _supported_proto file fuse
42 _require_drivers null-co
44 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
45 _notrun "Requires a PC machine"
48 do_run_qemu()
50 echo Testing: "$@"
53 if ! test -t 0; then
54 while read cmd; do
55 echo $cmd
56 done
58 echo quit
59 ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
60 echo
63 check_info_block()
65 echo "info block" |
66 do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
67 _filter_generated_node_ids | _filter_qom_path
71 size=64M
72 _make_test_img $size
74 removable="floppy ide-cd scsi-cd"
75 fixed="ide-hd scsi-hd virtio-blk-pci"
77 echo
78 echo "=== Empty drives ==="
79 echo
81 for dev in $removable; do
82 check_info_block -device $dev
83 check_info_block -device $dev,id=qdev_id
84 done
86 echo
87 echo "=== -blockdev/-device=<node-name> ==="
88 echo
90 for dev in $fixed $removable; do
91 check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
92 check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
93 done
95 echo
96 echo "=== -drive if=none/-device=<node-name> ==="
97 echo
99 # This creates two BlockBackends that will show up in 'info block'!
100 # A monitor-owned one from -drive, and anonymous one from -device
101 for dev in $fixed $removable; do
102 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
103 done
105 echo
106 echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
107 echo
109 for dev in $fixed $removable; do
110 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
111 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
112 done
114 echo
115 echo "=== -drive if=none/-device=<bb-name> (without medium) ==="
116 echo
118 check_info_block -drive if=none
120 for dev in $removable; do
121 check_info_block -drive if=none -device $dev,drive=none0
122 check_info_block -drive if=none -device $dev,drive=none0,id=qdev_id
123 done
125 echo
126 echo "=== -drive if=... ==="
127 echo
129 check_info_block -drive if=floppy
130 check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
132 check_info_block -drive if=ide,driver=null-co,read-zeroes=on
133 check_info_block -drive if=ide,media=cdrom
134 check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
136 check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
138 check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
140 # success, all done
141 echo "*** done"
142 rm -f $seq.full
143 status=0