hw/core/qdev-properties: Use qemu_strtol() in set_mac() handler
[qemu/ar7.git] / tests / qemu-iotests / 186
blob3ea0442d44fcaa7d079f080baf2730281ac96d99
1 #!/usr/bin/env bash
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/>.
21 # creator
22 owner=kwolf@redhat.com
24 seq=`basename $0`
25 echo "QA output created by $seq"
27 status=1 # failure is the default!
29 _cleanup()
31 _cleanup_test_img
33 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
36 . ./common.rc
37 . ./common.filter
39 _supported_fmt qcow2
40 _supported_proto file
41 _require_drivers null-co
43 if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
44 _notrun "Requires a PC machine"
47 do_run_qemu()
49 echo Testing: "$@"
52 if ! test -t 0; then
53 while read cmd; do
54 echo $cmd
55 done
57 echo quit
58 ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
59 echo
62 check_info_block()
64 echo "info block" |
65 do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
66 _filter_generated_node_ids | _filter_qom_path
70 size=64M
71 _make_test_img $size
73 removable="floppy ide-cd scsi-cd"
74 fixed="ide-hd scsi-hd virtio-blk-pci"
76 echo
77 echo "=== Empty drives ==="
78 echo
80 for dev in $removable; do
81 check_info_block -device $dev
82 check_info_block -device $dev,id=qdev_id
83 done
85 echo
86 echo "=== -blockdev/-device=<node-name> ==="
87 echo
89 for dev in $fixed $removable; do
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
92 done
94 echo
95 echo "=== -drive if=none/-device=<node-name> ==="
96 echo
98 # This creates two BlockBackends that will show up in 'info block'!
99 # A monitor-owned one from -drive, and anonymous one from -device
100 for dev in $fixed $removable; do
101 check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
102 done
104 echo
105 echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
106 echo
108 for dev in $fixed $removable; do
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
111 done
113 echo
114 echo "=== -drive if=none/-device=<bb-name> (without medium) ==="
115 echo
117 check_info_block -drive if=none
119 for 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
122 done
124 echo
125 echo "=== -drive if=... ==="
126 echo
128 check_info_block -drive if=floppy
129 check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
131 check_info_block -drive if=ide,driver=null-co,read-zeroes=on
132 check_info_block -drive if=ide,media=cdrom
133 check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
135 check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
137 check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
139 # success, all done
140 echo "*** done"
141 rm -f $seq.full
142 status=0