]> git.proxmox.com Git - mirror_qemu.git/blame - tests/qemu-iotests/186
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190903' into staging
[mirror_qemu.git] / tests / qemu-iotests / 186
CommitLineData
11a82d14 1#!/usr/bin/env bash
e1824e58
KW
2#
3# Test 'info block' with all kinds of configurations
4#
5# Copyright (C) 2017 Red Hat, Inc.
6#
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.
11#
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.
16#
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/>.
19#
20
21# creator
22owner=kwolf@redhat.com
23
24seq=`basename $0`
25echo "QA output created by $seq"
26
e1824e58
KW
27status=1 # failure is the default!
28
29_cleanup()
30{
31 _cleanup_test_img
32}
33trap "_cleanup; exit \$status" 0 1 2 3 15
34
35# get standard environment, filters and checks
36. ./common.rc
37. ./common.filter
38
39_supported_fmt qcow2
40_supported_proto file
21b43d00 41_require_drivers null-co
e1824e58
KW
42
43if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
44 _notrun "Requires a PC machine"
45fi
46
8cedcffd 47do_run_qemu()
e1824e58
KW
48{
49 echo Testing: "$@"
50
51 (
52 if ! test -t 0; then
53 while read cmd; do
54 echo $cmd
55 done
56 fi
57 echo quit
05b4cd5d 58 ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
e1824e58
KW
59 echo
60}
61
8cedcffd 62check_info_block()
e1824e58
KW
63{
64 echo "info block" |
05b4cd5d 65 do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
627f607e 66 _filter_generated_node_ids | _filter_qom_path
e1824e58
KW
67}
68
69
70size=64M
71_make_test_img $size
72
73removable="floppy ide-cd scsi-cd"
74fixed="ide-hd scsi-hd virtio-blk-pci"
75
76echo
77echo "=== Empty drives ==="
78echo
79
80for dev in $removable; do
81 check_info_block -device $dev
82 check_info_block -device $dev,id=qdev_id
83done
84
85echo
86echo "=== -blockdev/-device=<node-name> ==="
87echo
88
89for dev in $fixed $removable; do
a6862418
AS
90 check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
91 check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
e1824e58
KW
92done
93
94echo
95echo "=== -drive if=none/-device=<node-name> ==="
96echo
97
98# This creates two BlockBackends that will show up in 'info block'!
99# A monitor-owned one from -drive, and anonymous one from -device
100for dev in $fixed $removable; do
a6862418 101 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
e1824e58
KW
102done
103
104echo
105echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
106echo
107
108for dev in $fixed $removable; do
a6862418
AS
109 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
110 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
e1824e58
KW
111done
112
113echo
114echo "=== -drive if=none/-device=<bb-name> (without medium) ==="
115echo
116
117check_info_block -drive if=none
118
119for dev in $removable; do
120 check_info_block -drive if=none -device $dev,drive=none0
121 check_info_block -drive if=none -device $dev,drive=none0,id=qdev_id
122done
123
124echo
125echo "=== -drive if=... ==="
126echo
127
128check_info_block -drive if=floppy
a6862418 129check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
e1824e58 130
a6862418 131check_info_block -drive if=ide,driver=null-co,read-zeroes=on
e1824e58 132check_info_block -drive if=ide,media=cdrom
a6862418 133check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
e1824e58 134
a6862418 135check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
e1824e58 136
a6862418 137check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
e1824e58
KW
138
139# success, all done
140echo "*** done"
141rm -f $seq.full
142status=0