ati-vga: Fix check for blt outside vram
[qemu/ar7.git] / tests / qemu-iotests / 240
blob65cc3b39b13fd23becc98ab7eac6e25efa90a5ab
1 #!/bin/bash
3 # Test hot plugging and unplugging with iothreads
5 # Copyright (C) 2019 Igalia, S.L.
6 # Author: Alberto Garcia <berto@igalia.com>
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=berto@igalia.com
25 seq=`basename $0`
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 # get standard environment, filters and checks
31 . ./common.rc
32 . ./common.filter
34 _supported_fmt generic
35 _supported_proto generic
36 _supported_os Linux
38 do_run_qemu()
40 echo Testing: "$@"
41 $QEMU -nographic -qmp stdio -serial none "$@"
42 echo
45 # Remove QMP events from (pretty-printed) output. Doesn't handle
46 # nested dicts correctly, but we don't get any of those in this test.
47 _filter_qmp_events()
49 tr '\n' '\t' | sed -e \
50 's/{\s*"timestamp":\s*{[^}]*},\s*"event":[^,}]*\(,\s*"data":\s*{[^}]*}\)\?\s*}\s*//g' \
51 | tr '\t' '\n'
54 run_qemu()
56 do_run_qemu "$@" 2>&1 | _filter_qmp | _filter_qmp_events
59 case "$QEMU_DEFAULT_MACHINE" in
60 s390-ccw-virtio)
61 virtio_scsi=virtio-scsi-ccw
64 virtio_scsi=virtio-scsi-pci
66 esac
68 echo
69 echo === Unplug a SCSI disk and then plug it again ===
70 echo
72 run_qemu <<EOF
73 { "execute": "qmp_capabilities" }
74 { "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
75 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
76 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
77 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
78 { "execute": "device_del", "arguments": {"id": "scsi-hd0"}}
79 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
80 { "execute": "device_del", "arguments": {"id": "scsi-hd0"}}
81 { "execute": "device_del", "arguments": {"id": "scsi0"}}
82 { "execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
83 { "execute": "quit"}
84 EOF
86 echo
87 echo === Attach two SCSI disks using the same block device and the same iothread ===
88 echo
90 run_qemu <<EOF
91 { "execute": "qmp_capabilities" }
92 { "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
93 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
94 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
95 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
96 { "execute": "device_add", "arguments": {"id": "scsi-hd1", "driver": "scsi-hd", "drive": "hd0"}}
97 { "execute": "device_del", "arguments": {"id": "scsi-hd0"}}
98 { "execute": "device_del", "arguments": {"id": "scsi-hd1"}}
99 { "execute": "device_del", "arguments": {"id": "scsi0"}}
100 { "execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
101 { "execute": "quit"}
104 echo
105 echo === Attach two SCSI disks using the same block device but different iothreads ===
106 echo
108 run_qemu <<EOF
109 { "execute": "qmp_capabilities" }
110 { "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
111 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
112 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
113 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
114 { "execute": "device_add", "arguments": {"id": "scsi1", "driver": "${virtio_scsi}", "iothread": "iothread1"}}
115 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0", "bus": "scsi0.0"}}
116 { "execute": "device_add", "arguments": {"id": "scsi-hd1", "driver": "scsi-hd", "drive": "hd0", "bus": "scsi1.0"}}
117 { "execute": "device_del", "arguments": {"id": "scsi-hd0"}}
118 { "execute": "device_add", "arguments": {"id": "scsi-hd1", "driver": "scsi-hd", "drive": "hd0", "bus": "scsi1.0"}}
119 { "execute": "device_del", "arguments": {"id": "scsi-hd1"}}
120 { "execute": "device_del", "arguments": {"id": "scsi0"}}
121 { "execute": "device_del", "arguments": {"id": "scsi1"}}
122 { "execute": "blockdev-del", "arguments": {"node-name": "hd0"}}
123 { "execute": "quit"}
126 # success, all done
127 echo "*** done"
128 rm -f $seq.full
129 status=0