From nobody Sun Nov 9 22:26:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155198391744033.01821186988025; Thu, 7 Mar 2019 10:38:37 -0800 (PST) Received: from localhost ([127.0.0.1]:57117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xuZ-0000rr-8e for importer@patchew.org; Thu, 07 Mar 2019 13:38:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrN-0003r6-Go for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrM-0000B7-GB for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:09 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40971) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrM-0000Ah-8C for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:08 -0500 Received: by mail-wr1-x42d.google.com with SMTP id n2so18409293wrw.8 for ; Thu, 07 Mar 2019 09:31:08 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.31.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DGXxvXU0NK3O86DvF8+UlN4hEwOGAaNFtVE522QlH2s=; b=X8HWeOmEDcGgiuweCg4s4nKQ3Wf7kD/Xxx/sRm1+SuVsJVk7hFbqoXBwa2h+F0OUWJ Au1D9Xh1qLQDNZJ9kuB7kjdiH2BvDavjV6uB6XxW0RR4qQGikN0l6dP9st2yHa9CCI+v GLwQS4ury6XxffFewN4wrTC+Qgel5LZfvOVWtPmirDNDB/Xp499bZB21L0lfBuZBrIeo 0bCcVLUOMwI9906NszLL2BjyrvbwdeJ3gmkjdHCP0V5SDr3tDU4WQurgIn06pfxVReIh PCPGe5Sh5lJs0fOWaLpoE/TXkNe5CfszImQf8TfFjVE4bOx4oo6SBeUDwNmichfScrC3 CLNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DGXxvXU0NK3O86DvF8+UlN4hEwOGAaNFtVE522QlH2s=; b=TfDnbpOd7Le4pHyGJCW4tEqg3Ir+o3fCto47eYfGpaHy8R3sMA7z4ldF+QElb1A3gj UE7Jqw86fBnvkR06HlpSe6jJu3Ygim+5RpbkxsHeY+6MI4E9FEYHBAt1yTj7zBbw2PIF hyf0YowO+n5s8/5YkFgM6eage/LnRWC+KklABQXlorLV4do0cEBINEoHHSmbhtBXeC4z AdZGCjP8GpauxsDNcyaEYAcbAeVN80a1Be86w+jt/zzksLOrgxsFpBk/iuM70MUsw/ny kmVgxpdKV8GGMt6CktJ3yU0Gryo8QIU7X7LLD9vE6+m9ZxNNtf8HiXTuiY/20yeH05Sx XeqQ== X-Gm-Message-State: APjAAAXI9tqUywy/Wjvo6ede/ic33oIRiNoK5vFvUVCJ8TbL12g64Ypx QgBkKnwLxAkI18GktQnh1Ts64pdE X-Google-Smtp-Source: APXvYqxPsEiAZoLgGfush488pCpXTOofckgCw8vJ31Hl32b0AVczdsaYCXj+zgEt2va0FmVOcdWODg== X-Received: by 2002:adf:ef05:: with SMTP id e5mr7955627wro.153.1551979867074; Thu, 07 Mar 2019 09:31:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:59 +0100 Message-Id: <1551979804-6060-53-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> References: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d Subject: [Qemu-devel] [PULL 52/57] qos-test: usb-hcd-ohci test node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Emanuele Giuseppe Esposito , lviver@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Emanuele Giuseppe Esposito Convert tests/usb-hcd-ohci-test to a driver node; currently it runs the PCI nop test only, therefore we're not placing it in tests/libqos. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 4 +--- tests/usb-hcd-ohci-test.c | 54 +++++++++++++++++++++++++++++++++++--------= ---- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index f257b50..8ba8e27 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -184,7 +184,6 @@ check-qtest-i386-$(CONFIG_VMXNET3_PCI) +=3D tests/vmxne= t3-test$(EXESUF) check-qtest-i386-$(CONFIG_PVPANIC) +=3D tests/pvpanic-test$(EXESUF) check-qtest-i386-$(CONFIG_I82801B11) +=3D tests/i82801b11-test$(EXESUF) check-qtest-i386-$(CONFIG_IOH3420) +=3D tests/ioh3420-test$(EXESUF) -check-qtest-i386-$(CONFIG_USB_OHCI) +=3D tests/usb-hcd-ohci-test$(EXESUF) check-qtest-i386-$(CONFIG_USB_UHCI) +=3D tests/usb-hcd-uhci-test$(EXESUF) ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy) check-qtest-i386-y +=3D tests/usb-hcd-ehci-test$(EXESUF) @@ -241,7 +240,6 @@ check-qtest-ppc64-y +=3D tests/migration-test$(EXESUF) check-qtest-ppc64-y +=3D tests/test-announce-self$(EXESUF) check-qtest-ppc64-$(CONFIG_PSERIES) +=3D tests/rtas-test$(EXESUF) check-qtest-ppc64-$(CONFIG_SLIRP) +=3D tests/pxe-test$(EXESUF) -check-qtest-ppc64-$(CONFIG_USB_OHCI) +=3D tests/usb-hcd-ohci-test$(EXESUF) check-qtest-ppc64-$(CONFIG_USB_UHCI) +=3D tests/usb-hcd-uhci-test$(EXESUF) check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) +=3D tests/usb-hcd-xhci-test$(EXE= SUF) check-qtest-ppc64-$(CONFIG_SLIRP) +=3D tests/test-netfilter$(EXESUF) @@ -755,6 +753,7 @@ qos-test-obj-y +=3D tests/pci-test.o qos-test-obj-y +=3D tests/pcnet-test.o qos-test-obj-y +=3D tests/sdhci-test.o qos-test-obj-y +=3D tests/spapr-phb-test.o +qos-test-obj-y +=3D tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y) qos-test-obj-$(CONFIG_VHOST_NET_USER) +=3D tests/vhost-user-test.o $(chard= ev-obj-y) $(test-io-obj-y) qos-test-obj-y +=3D tests/virtio-test.o qos-test-obj-$(CONFIG_VIRTFS) +=3D tests/virtio-9p-test.o @@ -817,7 +816,6 @@ tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o -tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-o= bj-y) tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-o= bj-y) tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-o= bj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-o= bj-y) diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c index 48ddbfd..98af02e 100644 --- a/tests/usb-hcd-ohci-test.c +++ b/tests/usb-hcd-ohci-test.c @@ -10,30 +10,58 @@ #include "qemu/osdep.h" #include "libqtest.h" #include "libqos/usb.h" +#include "libqos/qgraph.h" +#include "libqos/pci.h" =20 +typedef struct QOHCI_PCI QOHCI_PCI; =20 -static void test_ohci_init(void) -{ +struct QOHCI_PCI { + QOSGraphObject obj; + QPCIDevice dev; +}; =20 +static void test_ohci_hotplug(void *obj, void *data, QGuestAllocator *allo= c) +{ + usb_test_hotplug("ohci", "1", NULL); } =20 -static void test_ohci_hotplug(void) +static void *ohci_pci_get_driver(void *obj, const char *interface) { - usb_test_hotplug("ohci", "1", NULL); + QOHCI_PCI *ohci_pci =3D obj; + + if (!g_strcmp0(interface, "pci-device")) { + return &ohci_pci->dev; + } + + fprintf(stderr, "%s not present in pci-ohci\n", interface); + g_assert_not_reached(); } =20 -int main(int argc, char **argv) +static void *ohci_pci_create(void *pci_bus, QGuestAllocator *alloc, void *= addr) { - int ret; + QOHCI_PCI *ohci_pci =3D g_new0(QOHCI_PCI, 1); + ohci_pci->obj.get_driver =3D ohci_pci_get_driver; =20 - g_test_init(&argc, &argv, NULL); + return &ohci_pci->obj; +} + +static void ohci_pci_register_nodes(void) +{ + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D "addr=3D04.0,id=3Dohci", + }; + add_qpci_address(&opts, &(QPCIAddress) { .devfn =3D QPCI_DEVFN(4, 0) }= ); =20 - qtest_add_func("/ohci/pci/init", test_ohci_init); - qtest_add_func("/ohci/pci/hotplug", test_ohci_hotplug); + qos_node_create_driver("pci-ohci", ohci_pci_create); + qos_node_consumes("pci-ohci", "pci-bus", &opts); + qos_node_produces("pci-ohci", "pci-device"); +} =20 - qtest_start("-device pci-ohci,id=3Dohci"); - ret =3D g_test_run(); - qtest_end(); +libqos_init(ohci_pci_register_nodes); =20 - return ret; +static void register_ohci_pci_test(void) +{ + qos_add_test("ohci_pci-test-hotplug", "pci-ohci", test_ohci_hotplug, N= ULL); } + +libqos_init(register_ohci_pci_test); --=20 1.8.3.1