提交 91155b7f 编写于 作者: Q Qingtang Zhou

qemu.test.usb_hotplug: Add a negative test

Signed-off-by: NQingtang Zhou <qzhou@redhat.com>
上级 182a344e
......@@ -126,6 +126,17 @@
monitor_type = human
monitors = hmp1
main_monitor = hmp1
variants:
- usb_normal_test:
- usb_negative_test:
only ehci
only usb_hub
only usb_default
# Note: This is a workaround for the multifunction
# code in qemu_vm module.
usb_type_usbtest = usb-ehci
usb_negative_test = "yes"
usb_reply_msg = "Warning: speed mismatch trying to attach usb device"
- usb_storage:
type = usb_storage
images += " stg"
......
import logging, re, uuid
import logging
from autotest.client.shared import error
from autotest.client import utils
@error.context_aware
def run_usb_hotplug(test, params, env):
......@@ -28,6 +27,12 @@ def run_usb_hotplug(test, params, env):
error.context("Plugin usb device", logging.info)
reply = vm.monitor.cmd(monitor_add)
if params.get("usb_negative_test") == "yes":
if params["usb_reply_msg"] not in reply:
raise error.TestFail("Could not get expected warning msg in"
" negative test, monitor returns: '%s'" % reply)
return
if reply.find("Parameter 'driver' expects a driver name") != -1:
raise error.TestNAError("usb device %s not available" % device)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册