From nobody Wed Nov 5 10:47:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534156372430245.1203451082754; Mon, 13 Aug 2018 03:32:52 -0700 (PDT) Received: from localhost ([::1]:38621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpA9b-0006cU-6f for importer@patchew.org; Mon, 13 Aug 2018 06:32:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9sp-0007NM-Ci for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9sn-0002Cs-3p for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:31 -0400 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]:41405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9sm-0002BI-MH; Mon, 13 Aug 2018 06:15:29 -0400 Received: by mail-ed1-x544.google.com with SMTP id s24-v6so7939720edr.8; Mon, 13 Aug 2018 03:15:28 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.125]) by smtp.gmail.com with ESMTPSA id s27-v6sm11670006edb.73.2018.08.13.03.15.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tUrDApybx/A7bMKl7Oyh24GaMd9wUV73igy7BuPp6mY=; b=rfBe3anrf/s9cmBT9pCAl13Jo45cAL2EHk/sUDbs+oXyWEKyFowEv41/bRldap0A3i bPU1KtE8KBUI7PaU5h5aN4zXYCb3XXDKjoGwuQlQMDyVY4+Ukb3SvYjf9UAXtfjABXEo iCpBCKPoPuCsajrhqzd3EU4eaq6fUvv4i1MquZtesSgDW3JVd2EhDYpPDYftYWGgQ7GL dI7Qk8hwGneet9EZs2gi4Ptl0N1JIf84p8qLpYrA/BFRZf8zJwZi+ILN5E5IK3n/XdnM aau+94pmHhmY1JKLXk/mZhmJ4fDVFlweNOkyQ0ZUOw/gWf4R/9Ozcwg2FlYHRn9kxtF3 +0ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tUrDApybx/A7bMKl7Oyh24GaMd9wUV73igy7BuPp6mY=; b=h7aSY6DtxF36iVJszB8RmNmAn1eKIvLyB4cyhnvbl7sKTvrtShWJFdXbAOU1VpQudO 3zcgg7DHJiZBsZ9PRGJ+mk7jgMEK4mA2djniYakG/agDEUBJFcLh8ICkEe4Y4OlAuK/0 X560OYhSCHAhMNIn8Fxgyzl7U/CT0cergwkwsuSp3roWv9qwwErIPLd6qz6rLPc1cEVJ 7/QF939XJogZs8+ruycEAXiLyyupklLxw4oZgFL0JNt7is+3p3lMXfwQNT7A/Ca7CG/3 ZhC/ha9F1LkMXH+erGPIDZEmfR8oUzSzTRDhjEGciezxxwUmEZW12VTagP+EY8yGDwq9 0Jrw== X-Gm-Message-State: AOUpUlGohc1/SEaLzLDKFwWxG34OrM2SkT5CJHc61ClNcCZq/6qKTYme fqgFjwGeqe6ZGlOaBn86AMPrhPJ2oOw= X-Google-Smtp-Source: AA+uWPx94fdH6ipn5FLAQx93KAd++BtXuw1YInTobNyXdT2OAtEcZDD8kEA2H2WKQfH7EMqrUwBMHA== X-Received: by 2002:a50:a7e2:: with SMTP id i89-v6mr21409507edc.176.1534155327285; Mon, 13 Aug 2018 03:15:27 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:32 +0200 Message-Id: <20180813101453.10200-13-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> References: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::544 Subject: [Qemu-devel] [PATCH 12/33] tests/qgraph: e1000e-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: Laurent Vivier , Fam Zheng , qemu-block@nongnu.org, "Michael S. Tsirkin" , Jason Wang , Amit Shah , Emanuele Giuseppe Esposito , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Convert tests/e1000e-test in qgraph test node, e1000e-test. This test consumes an e1000e interface and checks that its function return the expected values. Note that this test does not allocate any e1000e structure, it's all done b= y the qtest walking graph mechanism Signed-off-by: Emanuele Giuseppe Esposito --- tests/Makefile.include | 3 +- tests/e1000e-test.c | 354 +++++++++-------------------------------- 2 files changed, 78 insertions(+), 279 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 9f0d64f4ae..e18796d8d8 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -213,7 +213,6 @@ gcov-files-virtio-y +=3D $(gcov-files-virtioserial-y) =20 check-qtest-pci-y +=3D tests/e1000-test$(EXESUF) gcov-files-pci-y +=3D hw/net/e1000.c -check-qtest-pci-y +=3D tests/e1000e-test$(EXESUF) gcov-files-pci-y +=3D hw/net/e1000e.c hw/net/e1000e_core.c check-qtest-pci-y +=3D tests/rtl8139-test$(EXESUF) gcov-files-pci-y +=3D hw/net/rtl8139.c @@ -779,6 +778,7 @@ libqgraph-pci-obj-y +=3D tests/libqos/e1000e.o =20 libqgraph-tests-obj-y =3D $(libqgraph-pci-obj-y) libqgraph-tests-obj-y +=3D tests/sdhci-test.o +libqgraph-tests-obj-y +=3D tests/e1000e-test.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y) @@ -813,7 +813,6 @@ tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqo= s-pc-obj-y) tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y) tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o -tests/e1000e-test$(EXESUF): tests/e1000e-test.o $(libqos-pc-obj-y) tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) tests/pcnet-test$(EXESUF): tests/pcnet-test.o tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c index 574801fd38..4c4f1e24ae 100644 --- a/tests/e1000e-test.c +++ b/tests/e1000e-test.c @@ -34,208 +34,11 @@ #include "libqos/malloc.h" #include "libqos/malloc-pc.h" #include "libqos/malloc-generic.h" - -#define E1000E_IMS (0x00d0) - -#define E1000E_STATUS (0x0008) -#define E1000E_STATUS_LU BIT(1) -#define E1000E_STATUS_ASDV1000 BIT(9) - -#define E1000E_CTRL (0x0000) -#define E1000E_CTRL_RESET BIT(26) - -#define E1000E_RCTL (0x0100) -#define E1000E_RCTL_EN BIT(1) -#define E1000E_RCTL_UPE BIT(3) -#define E1000E_RCTL_MPE BIT(4) - -#define E1000E_RFCTL (0x5008) -#define E1000E_RFCTL_EXTEN BIT(15) - -#define E1000E_TCTL (0x0400) -#define E1000E_TCTL_EN BIT(1) - -#define E1000E_CTRL_EXT (0x0018) -#define E1000E_CTRL_EXT_DRV_LOAD BIT(28) -#define E1000E_CTRL_EXT_TXLSFLOW BIT(22) - -#define E1000E_RX0_MSG_ID (0) -#define E1000E_TX0_MSG_ID (1) -#define E1000E_OTHER_MSG_ID (2) - -#define E1000E_IVAR (0x00E4) -#define E1000E_IVAR_TEST_CFG ((E1000E_RX0_MSG_ID << 0) | BIT(3) = | \ - (E1000E_TX0_MSG_ID << 8) | BIT(11)= | \ - (E1000E_OTHER_MSG_ID << 16) | BIT(19)= | \ - BIT(31)) - -#define E1000E_RING_LEN (0x1000) -#define E1000E_TXD_LEN (16) -#define E1000E_RXD_LEN (16) - -#define E1000E_TDBAL (0x3800) -#define E1000E_TDBAH (0x3804) -#define E1000E_TDLEN (0x3808) -#define E1000E_TDH (0x3810) -#define E1000E_TDT (0x3818) - -#define E1000E_RDBAL (0x2800) -#define E1000E_RDBAH (0x2804) -#define E1000E_RDLEN (0x2808) -#define E1000E_RDH (0x2810) -#define E1000E_RDT (0x2818) - -typedef struct e1000e_device { - QPCIDevice *pci_dev; - QPCIBar mac_regs; - - uint64_t tx_ring; - uint64_t rx_ring; -} e1000e_device; +#include "libqos/e1000e.h" =20 static int test_sockets[2]; -static QGuestAllocator *test_alloc; -static QPCIBus *test_bus; - -static void e1000e_pci_foreach_callback(QPCIDevice *dev, int devfn, void *= data) -{ - QPCIDevice **res =3D data; - - g_assert_null(*res); - *res =3D dev; -} - -static QPCIDevice *e1000e_device_find(QPCIBus *bus) -{ - static const int e1000e_vendor_id =3D 0x8086; - static const int e1000e_dev_id =3D 0x10D3; - - QPCIDevice *e1000e_dev =3D NULL; - - qpci_device_foreach(bus, e1000e_vendor_id, e1000e_dev_id, - e1000e_pci_foreach_callback, &e1000e_dev); - - g_assert_nonnull(e1000e_dev); - - return e1000e_dev; -} =20 -static void e1000e_macreg_write(e1000e_device *d, uint32_t reg, uint32_t v= al) -{ - qpci_io_writel(d->pci_dev, d->mac_regs, reg, val); -} - -static uint32_t e1000e_macreg_read(e1000e_device *d, uint32_t reg) -{ - return qpci_io_readl(d->pci_dev, d->mac_regs, reg); -} - -static void e1000e_device_init(QPCIBus *bus, e1000e_device *d) -{ - uint32_t val; - - d->pci_dev =3D e1000e_device_find(bus); - - /* Enable the device */ - qpci_device_enable(d->pci_dev); - - /* Map BAR0 (mac registers) */ - d->mac_regs =3D qpci_iomap(d->pci_dev, 0, NULL); - - /* Reset the device */ - val =3D e1000e_macreg_read(d, E1000E_CTRL); - e1000e_macreg_write(d, E1000E_CTRL, val | E1000E_CTRL_RESET); - - /* Enable and configure MSI-X */ - qpci_msix_enable(d->pci_dev); - e1000e_macreg_write(d, E1000E_IVAR, E1000E_IVAR_TEST_CFG); - - /* Check the device status - link and speed */ - val =3D e1000e_macreg_read(d, E1000E_STATUS); - g_assert_cmphex(val & (E1000E_STATUS_LU | E1000E_STATUS_ASDV1000), - =3D=3D, E1000E_STATUS_LU | E1000E_STATUS_ASDV1000); - - /* Initialize TX/RX logic */ - e1000e_macreg_write(d, E1000E_RCTL, 0); - e1000e_macreg_write(d, E1000E_TCTL, 0); - - /* Notify the device that the driver is ready */ - val =3D e1000e_macreg_read(d, E1000E_CTRL_EXT); - e1000e_macreg_write(d, E1000E_CTRL_EXT, - val | E1000E_CTRL_EXT_DRV_LOAD | E1000E_CTRL_EXT_TXLSFLOW); - - /* Allocate and setup TX ring */ - d->tx_ring =3D guest_alloc(test_alloc, E1000E_RING_LEN); - g_assert(d->tx_ring !=3D 0); - - e1000e_macreg_write(d, E1000E_TDBAL, (uint32_t) d->tx_ring); - e1000e_macreg_write(d, E1000E_TDBAH, (uint32_t) (d->tx_ring >> 32)); - e1000e_macreg_write(d, E1000E_TDLEN, E1000E_RING_LEN); - e1000e_macreg_write(d, E1000E_TDT, 0); - e1000e_macreg_write(d, E1000E_TDH, 0); - - /* Enable transmit */ - e1000e_macreg_write(d, E1000E_TCTL, E1000E_TCTL_EN); - - /* Allocate and setup RX ring */ - d->rx_ring =3D guest_alloc(test_alloc, E1000E_RING_LEN); - g_assert(d->rx_ring !=3D 0); - - e1000e_macreg_write(d, E1000E_RDBAL, (uint32_t)d->rx_ring); - e1000e_macreg_write(d, E1000E_RDBAH, (uint32_t)(d->rx_ring >> 32)); - e1000e_macreg_write(d, E1000E_RDLEN, E1000E_RING_LEN); - e1000e_macreg_write(d, E1000E_RDT, 0); - e1000e_macreg_write(d, E1000E_RDH, 0); - - /* Enable receive */ - e1000e_macreg_write(d, E1000E_RFCTL, E1000E_RFCTL_EXTEN); - e1000e_macreg_write(d, E1000E_RCTL, E1000E_RCTL_EN | - E1000E_RCTL_UPE | - E1000E_RCTL_MPE); - - /* Enable all interrupts */ - e1000e_macreg_write(d, E1000E_IMS, 0xFFFFFFFF); -} - -static void e1000e_tx_ring_push(e1000e_device *d, void *descr) -{ - uint32_t tail =3D e1000e_macreg_read(d, E1000E_TDT); - uint32_t len =3D e1000e_macreg_read(d, E1000E_TDLEN) / E1000E_TXD_LEN; - - memwrite(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); - e1000e_macreg_write(d, E1000E_TDT, (tail + 1) % len); - - /* Read WB data for the packet transmitted */ - memread(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); -} - -static void e1000e_rx_ring_push(e1000e_device *d, void *descr) -{ - uint32_t tail =3D e1000e_macreg_read(d, E1000E_RDT); - uint32_t len =3D e1000e_macreg_read(d, E1000E_RDLEN) / E1000E_RXD_LEN; - - memwrite(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); - e1000e_macreg_write(d, E1000E_RDT, (tail + 1) % len); - - /* Read WB data for the packet received */ - memread(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); -} - -static void e1000e_wait_isr(e1000e_device *d, uint16_t msg_id) -{ - guint64 end_time =3D g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND; - - do { - if (qpci_msix_pending(d->pci_dev, msg_id)) { - return; - } - clock_step(10000); - } while (g_get_monotonic_time() < end_time); - - g_error("Timeout expired"); -} - -static void e1000e_send_verify(e1000e_device *d) +static void e1000e_send_verify(QE1000E *d, QGuestAllocator *alloc) { struct { uint64_t buffer_addr; @@ -268,7 +71,7 @@ static void e1000e_send_verify(e1000e_device *d) uint32_t recv_len; =20 /* Prepare test data buffer */ - uint64_t data =3D guest_alloc(test_alloc, data_len); + uint64_t data =3D guest_alloc(alloc, data_len); memwrite(data, "TEST", 5); =20 /* Prepare TX descriptor */ @@ -296,10 +99,10 @@ static void e1000e_send_verify(e1000e_device *d) g_assert_cmpstr(buffer, =3D=3D , "TEST"); =20 /* Free test data buffer */ - guest_free(test_alloc, data); + guest_free(alloc, data); } =20 -static void e1000e_receive_verify(e1000e_device *d) +static void e1000e_receive_verify(QE1000E *d, QGuestAllocator *alloc) { union { struct { @@ -348,7 +151,7 @@ static void e1000e_receive_verify(e1000e_device *d) g_assert_cmpint(ret, =3D=3D , sizeof(test) + sizeof(len)); =20 /* Prepare test data buffer */ - uint64_t data =3D guest_alloc(test_alloc, data_len); + uint64_t data =3D guest_alloc(alloc, data_len); =20 /* Prepare RX descriptor */ memset(&descr, 0, sizeof(descr)); @@ -369,113 +172,110 @@ static void e1000e_receive_verify(e1000e_device *d) g_assert_cmpstr(buffer, =3D=3D , "TEST"); =20 /* Free test data buffer */ - guest_free(test_alloc, data); -} - -static void e1000e_device_clear(QPCIBus *bus, e1000e_device *d) -{ - qpci_iounmap(d->pci_dev, d->mac_regs); - qpci_msix_disable(d->pci_dev); + guest_free(alloc, data); } =20 -static void data_test_init(e1000e_device *d) +static void test_e1000e_init(void *obj, void *data, QGuestAllocator * allo= c) { - char *cmdline; - - int ret =3D socketpair(PF_UNIX, SOCK_STREAM, 0, test_sockets); - g_assert_cmpint(ret, !=3D , -1); - - cmdline =3D g_strdup_printf("-netdev socket,fd=3D%d,id=3Dhs0 " - "-device e1000e,netdev=3Dhs0", test_sockets[= 1]); - g_assert_nonnull(cmdline); - - qtest_start(cmdline); - g_free(cmdline); - - test_alloc =3D pc_alloc_init(global_qtest); - g_assert_nonnull(test_alloc); - - test_bus =3D qpci_new_pc(global_qtest, test_alloc); - g_assert_nonnull(test_bus); - - e1000e_device_init(test_bus, d); + /* init does nothing */ } =20 -static void data_test_clear(e1000e_device *d) +static void test_e1000e_tx(void *obj, void *data, QGuestAllocator * alloc) { - e1000e_device_clear(test_bus, d); - close(test_sockets[0]); - pc_alloc_uninit(test_alloc); - g_free(d->pci_dev); - qpci_free_pc(test_bus); - qtest_end(); -} - -static void test_e1000e_init(gconstpointer data) -{ - e1000e_device d; - - data_test_init(&d); - data_test_clear(&d); -} - -static void test_e1000e_tx(gconstpointer data) -{ - e1000e_device d; + QE1000E_PCI *e1000e =3D obj; + QE1000E *d =3D &e1000e->e1000e; + QOSGraphObject *e_object =3D obj; + QPCIDevice *dev =3D e_object->get_driver(e_object, "pci-device"); + + /* FIXME: add spapr support */ + if (qpci_has_buggy_msi(dev)) { + return; + } =20 - data_test_init(&d); - e1000e_send_verify(&d); - data_test_clear(&d); + e1000e_send_verify(d, alloc); } =20 -static void test_e1000e_rx(gconstpointer data) +static void test_e1000e_rx(void *obj, void *data, QGuestAllocator * alloc) { - e1000e_device d; + QE1000E_PCI *e1000e =3D obj; + QE1000E *d =3D &e1000e->e1000e; + QOSGraphObject *e_object =3D obj; + QPCIDevice *dev =3D e_object->get_driver(e_object, "pci-device"); + + /* FIXME: add spapr support */ + if (qpci_has_buggy_msi(dev)) { + return; + } =20 - data_test_init(&d); - e1000e_receive_verify(&d); - data_test_clear(&d); + e1000e_receive_verify(d, alloc); } =20 -static void test_e1000e_multiple_transfers(gconstpointer data) +static void test_e1000e_multiple_transfers(void *obj, void *data, + QGuestAllocator *alloc) { static const long iterations =3D 4 * 1024; long i; =20 - e1000e_device d; + QE1000E_PCI *e1000e =3D obj; + QE1000E *d =3D &e1000e->e1000e; + QOSGraphObject *e_object =3D obj; + QPCIDevice *dev =3D e_object->get_driver(e_object, "pci-device"); =20 - data_test_init(&d); + /* FIXME: add spapr support */ + if (qpci_has_buggy_msi(dev)) { + return; + } =20 for (i =3D 0; i < iterations; i++) { - e1000e_send_verify(&d); - e1000e_receive_verify(&d); + e1000e_send_verify(d, alloc); + e1000e_receive_verify(d, alloc); } =20 - data_test_clear(&d); } =20 -static void test_e1000e_hotplug(gconstpointer data) +static void test_e1000e_hotplug(void *obj, void *data, QGuestAllocator * a= lloc) { static const uint8_t slot =3D 0x06; =20 - qtest_start("-device e1000e"); - qpci_plug_device_test("e1000e", "e1000e_net", slot, NULL); qpci_unplug_acpi_device_test("e1000e_net", slot); +} + +static void data_test_init(char **cmd_line) +{ + char *new_cmdline; + + int ret =3D socketpair(PF_UNIX, SOCK_STREAM, 0, test_sockets); + g_assert_cmpint(ret, !=3D , -1); =20 - qtest_end(); + new_cmdline =3D g_strdup_printf("%s -netdev socket,fd=3D%d,id=3Dhs0 ",= *cmd_line, + test_sockets[1]); + g_assert_nonnull(new_cmdline); + + g_free(*cmd_line); + *cmd_line =3D new_cmdline; } =20 -int main(int argc, char **argv) +static void data_test_clear(void) { - g_test_init(&argc, &argv, NULL); + close(test_sockets[0]); + qos_invalidate_command_line(); + close(test_sockets[1]); +} =20 - qtest_add_data_func("e1000e/init", NULL, test_e1000e_init); - qtest_add_data_func("e1000e/tx", NULL, test_e1000e_tx); - qtest_add_data_func("e1000e/rx", NULL, test_e1000e_rx); - qtest_add_data_func("e1000e/multiple_transfers", NULL, - test_e1000e_multiple_transfers); - qtest_add_data_func("e1000e/hotplug", NULL, test_e1000e_hotplug); +static void register_e1000e_test(void) +{ + QOSGraphTestOptions opts =3D { + .before =3D data_test_init, + .after =3D data_test_clear, + }; =20 - return g_test_run(); + qos_add_test("e1000e-init", "e1000e", test_e1000e_init, &opts); + qos_add_test("e1000e-tx", "e1000e", test_e1000e_tx, &opts); + qos_add_test("e1000e-rx", "e1000e", test_e1000e_rx, &opts); + qos_add_test("e1000e-multiple_transfers", "e1000e", + test_e1000e_multiple_transfers, &opts); + qos_add_test("e1000e-hotplug", "e1000e", test_e1000e_hotplug, &opts); } + +libqos_init(register_e1000e_test); --=20 2.17.1