accel/tcg: Record mmio bytes during translation
[qemu/kevin.git] / tests / qtest / usb-hcd-xhci-test.c
blob0cccfd85a64ec1e50f86edc89f26097a0b06156d
1 /*
2 * QTest testcase for USB xHCI controller
4 * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO., LTD.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqtest-single.h"
12 #include "libqos/usb.h"
14 static void test_xhci_hotplug(void)
16 usb_test_hotplug(global_qtest, "xhci", "1", NULL);
19 static void test_usb_uas_hotplug(void)
21 QTestState *qts = global_qtest;
23 qtest_qmp_device_add(qts, "usb-uas", "uas", "{}");
24 qtest_qmp_device_add(qts, "scsi-hd", "scsihd", "{'drive': 'drive0'}");
26 /* TODO:
27 UAS HBA driver in libqos, to check that
28 added disk is visible after BUS rescan
31 qtest_qmp_device_del(qts, "scsihd");
32 qtest_qmp_device_del(qts, "uas");
35 static void test_usb_ccid_hotplug(void)
37 QTestState *qts = global_qtest;
39 qtest_qmp_device_add(qts, "usb-ccid", "ccid", "{}");
40 qtest_qmp_device_del(qts, "ccid");
41 /* check the device can be added again */
42 qtest_qmp_device_add(qts, "usb-ccid", "ccid", "{}");
43 qtest_qmp_device_del(qts, "ccid");
46 int main(int argc, char **argv)
48 int ret;
50 g_test_init(&argc, &argv, NULL);
52 qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug);
53 if (qtest_has_device("usb-uas")) {
54 qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
56 if (qtest_has_device("usb-ccid")) {
57 qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
60 qtest_start("-device nec-usb-xhci,id=xhci"
61 " -drive id=drive0,if=none,file=null-co://,"
62 "file.read-zeroes=on,format=raw");
63 ret = g_test_run();
64 qtest_end();
66 return ret;