]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-iotests: Test unplug of -device without drive
authorKevin Wolf <kwolf@redhat.com>
Wed, 12 Jul 2017 11:53:03 +0000 (13:53 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 Jul 2017 13:14:36 +0000 (15:14 +0200)
This caused an assertion failure until recently because the BlockBackend
would be detached on unplug, but was in fact never attached in the first
place. Add a regression test.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
tests/qemu-iotests/067
tests/qemu-iotests/067.out

index 38d23fce6b5fc20379956223745d09cf87df8c86..5d4ca4bc6155777f6b77eaac5b8f05db47106251 100755 (executable)
@@ -137,6 +137,19 @@ run_qemu <<EOF
 { "execute": "quit" }
 EOF
 
+echo
+echo === Empty drive with -device and device_del ===
+echo
+
+run_qemu -device virtio-scsi-pci -device scsi-cd,id=cd0 <<EOF
+{ "execute": "qmp_capabilities" }
+{ "execute": "query-block" }
+{ "execute": "device_del", "arguments": { "id": "cd0" } }
+{ "execute": "system_reset" }
+{ "execute": "query-block" }
+{ "execute": "quit" }
+EOF
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
index e3c4496a9d986d6280b89ed9dc455c761e384b53..bd70557ddc0026a254a0f852366280b72512bf26 100644 (file)
@@ -416,4 +416,43 @@ Testing:
     "return": {
     }
 }
+
+=== Empty drive with -device and device_del ===
+
+Testing: -device virtio-scsi-pci -device scsi-cd,id=cd0
+{
+    QMP_VERSION
+}
+{
+    "return": {
+    }
+}
+{
+    "return": [
+        {
+            "device": "",
+            "locked": false,
+            "removable": true,
+            "qdev": "cd0",
+            "tray_open": false,
+            "type": "unknown"
+        }
+    ]
+}
+{
+    "return": {
+    }
+}
+{
+    "return": {
+    }
+}
+{
+    "return": [
+    ]
+}
+{
+    "return": {
+    }
+}
 *** done