diff --git a/qemu/tests/cfg/usb.cfg b/qemu/tests/cfg/usb.cfg index 5971ce052a535a9def8058d7da5dffbbe08ac712..80ce897046249923a1251580878054372efc2e5f 100644 --- a/qemu/tests/cfg/usb.cfg +++ b/qemu/tests/cfg/usb.cfg @@ -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" diff --git a/qemu/tests/usb_hotplug.py b/qemu/tests/usb_hotplug.py index 1ea813ef39b283b026500bf8a8859f4f7b4cd516..6edd194b4796aed11ebf847499d72b5c259f4753 100644 --- a/qemu/tests/usb_hotplug.py +++ b/qemu/tests/usb_hotplug.py @@ -1,6 +1,5 @@ -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)