From nobody Sun Nov 9 22:28:29 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 1551982073723521.5989888710324; Thu, 7 Mar 2019 10:07:53 -0800 (PST) Received: from localhost ([127.0.0.1]:56621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xQq-000067-74 for importer@patchew.org; Thu, 07 Mar 2019 13:07:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrI-0003n8-IX for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrH-00007u-IE for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:04 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:50678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrH-00006Q-Av for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:03 -0500 Received: by mail-wm1-x32f.google.com with SMTP id x7so10093549wmj.0 for ; Thu, 07 Mar 2019 09:31:03 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:31:00 -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=nNnxvyXGn0US9Zwxst0ybcXXkmrc6BG7tH6gTKYJkEM=; b=lJ9F+0XFKb9H6m/tyUvtrkxN8pbNhul+23aH1u0dCV05IVGQnESnXHA0U3qoztGfe8 poNDV8cBvqHhCPV+/PZlKrvyXv95Mq8oJLQpJZa/LW/lFSG8tI1BM9sPXKgN+iFVPtCJ iyu0HmFa4i7ci3RJYDS4QTTkjHvDc2zBmUKFO2xqpc9gJySGX9p2MkP7b+/kYZ9nsgvF f359EFD7opf1dmpv5UUE/6H4WkK8NKUxx76VxAi/d5+O3GjlU2CZ+2PRDa4EokdaJ3pk dj144yYc6WoWzZEe77o3aqI8yrFcCs99AEOIc/fK8i2adm6yih8E8gBOrVS1w3/esYcY EBrg== 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=nNnxvyXGn0US9Zwxst0ybcXXkmrc6BG7tH6gTKYJkEM=; b=QwMfzpRjeh5s6CTNYmbR3Xrl59FMkpZpPQq61BKHqeciZUhv0E0mLFymM4hGy5eo/g XbdDmYOfCt1IVrKP8ksc3zoMwpP7H3bg+ZHLp3OgXP2962noaj+Z8AxRikxkLi3iodCg XUihB7AMvK0S2qkC9c7/NgyGZpNBRrKywAQEaYi39rdynOionSTJgb0NZxyjfX6LRiWN HVrNcBhfLbuySVyhR8Ls4v17CziwgXIGHDoVbLTuSaz/6uNe/UObamD5pcNV0Nv94X7R rIjMtSdWRakTq0+tg314MvHuvpG0j71A65rfF6aGzzhVJq8bkcBMuP0IqnJoeHQAJSjF 5gLQ== X-Gm-Message-State: APjAAAUXcDwcRluV52KGqJCf1+Ye2tkEpRryy+ocWEu11gCWVCJzv1Oj AZO0nR0ZM07RiCK1BKia20PnC5pp X-Google-Smtp-Source: APXvYqynqfCSk51bJXdRlFcXjcvP35skffu1Q/H4nP0f6YUXOs6ZYEJqwIO8Hm0edry8dZX5hNEW+g== X-Received: by 2002:a1c:2947:: with SMTP id p68mr6475151wmp.104.1551979861922; Thu, 07 Mar 2019 09:31:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:55 +0100 Message-Id: <1551979804-6060-49-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::32f Subject: [Qemu-devel] [PULL 48/57] qos-test: ne2k_pci 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/ne2000-test to a driver node; currently it runs the PCI nop test only, therefore we're not placing it in tests/libqos. The actual device consumed by the test is ne2k_pci. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 3 +-- tests/ne2000-test.c | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 3eaa888..0d06490 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -155,7 +155,6 @@ check-qtest-pci-y +=3D tests/e1000-test$(EXESUF) check-qtest-pci-$(CONFIG_RTL8139_PCI) +=3D tests/rtl8139-test$(EXESUF) check-qtest-pci-$(CONFIG_PCNET_PCI) +=3D tests/pcnet-test$(EXESUF) check-qtest-pci-$(CONFIG_EEPRO100_PCI) +=3D tests/eepro100-test$(EXESUF) -check-qtest-pci-$(CONFIG_NE2000_PCI) +=3D tests/ne2000-test$(EXESUF) check-qtest-pci-$(CONFIG_NVME_PCI) +=3D tests/nvme-test$(EXESUF) check-qtest-pci-$(CONFIG_ES1370) +=3D tests/es1370-test$(EXESUF) check-qtest-pci-$(CONFIG_VGA) +=3D tests/display-vga-test$(EXESUF) @@ -753,6 +752,7 @@ qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o qos-test-obj-y +=3D tests/ac97-test.o qos-test-obj-y +=3D tests/e1000e-test.o qos-test-obj-y +=3D tests/ipoctal232-test.o +qos-test-obj-y +=3D tests/ne2000-test.o qos-test-obj-y +=3D tests/pci-test.o qos-test-obj-y +=3D tests/sdhci-test.o qos-test-obj-$(CONFIG_VHOST_NET_USER) +=3D tests/vhost-user-test.o $(chard= ev-obj-y) $(test-io-obj-y) @@ -805,7 +805,6 @@ tests/pcnet-test$(EXESUF): tests/pcnet-test.o tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o -tests/ne2000-test$(EXESUF): tests/ne2000-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o diff --git a/tests/ne2000-test.c b/tests/ne2000-test.c index b7cf3dd..097c2ee 100644 --- a/tests/ne2000-test.c +++ b/tests/ne2000-test.c @@ -9,23 +9,49 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" +#include "libqos/pci.h" =20 -/* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop(void) +typedef struct QNe2k_pci QNe2k_pci; + +struct QNe2k_pci { + QOSGraphObject obj; + QPCIDevice dev; +}; + +static void *ne2k_pci_get_driver(void *obj, const char *interface) { + QNe2k_pci *ne2k_pci =3D obj; + + if (!g_strcmp0(interface, "pci-device")) { + return &ne2k_pci->dev; + } + + fprintf(stderr, "%s not present in ne2k_pci\n", interface); + g_assert_not_reached(); } =20 -int main(int argc, char **argv) +static void *ne2k_pci_create(void *pci_bus, QGuestAllocator *alloc, void *= addr) { - int ret; + QNe2k_pci *ne2k_pci =3D g_new0(QNe2k_pci, 1); + QPCIBus *bus =3D pci_bus; =20 - g_test_init(&argc, &argv, NULL); - qtest_add_func("/ne2000/pci/nop", pci_nop); + qpci_device_init(&ne2k_pci->dev, bus, addr); + ne2k_pci->obj.get_driver =3D ne2k_pci_get_driver; =20 - qtest_start("-device ne2k_pci"); - ret =3D g_test_run(); + return &ne2k_pci->obj; +} =20 - qtest_end(); +static void ne2000_register_nodes(void) +{ + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D "addr=3D04.0", + }; + add_qpci_address(&opts, &(QPCIAddress) { .devfn =3D QPCI_DEVFN(4, 0) }= ); =20 - return ret; + qos_node_create_driver("ne2k_pci", ne2k_pci_create); + qos_node_consumes("ne2k_pci", "pci-bus", &opts); + qos_node_produces("ne2k_pci", "pci-device"); } + +libqos_init(ne2000_register_nodes); --=20 1.8.3.1