3 # Test 'info block' with all kinds of configurations
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/>.
22 owner
=kwolf@redhat.com
25 echo "QA output created by $seq"
28 status
=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
44 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
45 _notrun
"Requires a PC machine"
48 function do_run_qemu
()
59 ) |
$QEMU -S -nodefaults -display none
-device virtio-scsi-pci
-monitor stdio
"$@" 2>&1
63 function check_info_block
()
66 QEMU_OPTIONS
="" do_run_qemu
"$@" | _filter_win32 | _filter_hmp |
67 _filter_qemu | _filter_generated_node_ids
74 removable
="floppy ide-cd scsi-cd"
75 fixed
="ide-hd scsi-hd virtio-blk-pci"
78 echo "=== Empty drives ==="
81 for dev
in $removable; do
82 check_info_block
-device $dev
83 check_info_block
-device $dev,id
=qdev_id
87 echo "=== -blockdev/-device=<node-name> ==="
90 for dev
in $fixed $removable; do
91 check_info_block
-blockdev driver
=null-co
,node-name
=null
-device $dev,drive
=null
92 check_info_block
-blockdev driver
=null-co
,node-name
=null
-device $dev,drive
=null
,id
=qdev_id
96 echo "=== -drive if=none/-device=<node-name> ==="
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
,node-name
=null
-device $dev,drive
=null
,id
=qdev_id
106 echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
109 for dev
in $fixed $removable; do
110 check_info_block
-drive if=none
,driver
=null-co
,node-name
=null
-device $dev,drive
=none0
111 check_info_block
-drive if=none
,driver
=null-co
,node-name
=null
-device $dev,drive
=none0
,id
=qdev_id
115 echo "=== -drive if=none/-device=<bb-name> (without medium) ==="
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
126 echo "=== -drive if=... ==="
129 check_info_block
-drive if=floppy
130 check_info_block
-drive if=floppy
,driver
=null-co
132 check_info_block
-drive if=ide
,driver
=null-co
133 check_info_block
-drive if=ide
,media
=cdrom
134 check_info_block
-drive if=ide
,driver
=null-co
,media
=cdrom
136 check_info_block
-drive if=scsi
,driver
=null-co
137 check_info_block
-drive if=scsi
,media
=cdrom
138 check_info_block
-drive if=scsi
,driver
=null-co
,media
=cdrom
140 check_info_block
-drive if=virtio
,driver
=null-co
142 check_info_block
-drive if=pflash
,driver
=null-co
,size
=1M