From nobody Wed Nov 5 10:47:35 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 1534156928055452.51670205547646; Mon, 13 Aug 2018 03:42:08 -0700 (PDT) Received: from localhost ([::1]:38721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpAIV-0007ED-3M for importer@patchew.org; Mon, 13 Aug 2018 06:42:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9tW-0007rt-9n for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:16:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9tT-0002u0-Kj for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:16:14 -0400 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]:34228) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9tT-0002tF-EC; Mon, 13 Aug 2018 06:16:11 -0400 Received: by mail-ed1-x541.google.com with SMTP id h1-v6so7958989eds.1; Mon, 13 Aug 2018 03:16:11 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.125]) by smtp.gmail.com with ESMTPSA id s27-v6sm11670006edb.73.2018.08.13.03.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:16:09 -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=8NWWzqn+RMKgyP4G909L74ugNJg7sz3snjs5VVJdJPs=; b=J0boDLJGZRkmS43u2ZB7UmeWqo7ncOZ3QKL3GsJ0QPdSjZZf/M4r4id0dzQynCUZIR 7KL/9HXml9EjWojHO7Yfsz0crVX1JS2cQuwFJpZJcYMLa+qjqvt6gjD2k/Gm1WCjmDy4 Vk7bEoU5gnNS3InrHEal7xYyHiw+PhD4Sy1yJxNisDMmjvFK/T0pVyX0y34EEEG/0ctu vfrviaRReEb3HgrprEvMlZHS1fHUWIz7uXqLvFah4TjguCwUHKUvMh3Z2F3KOkynn7iQ 0hWgqqdEBl3t39tsxpD8zKeyebZ/QnoSGndCZjR99OaGvGacW0izXvyOnkwIOd2XnIf4 uDtw== 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=8NWWzqn+RMKgyP4G909L74ugNJg7sz3snjs5VVJdJPs=; b=baObPZkmAbCG/KvqFGWn80CcN+pbul6twTo6DIOq2ReZZl3KwtM6H5fzyHzXr4NqTf MlVFDspKuxRllPLnSpdKFN811DNuLTDYGVTLjFobEchlea2xSl+ZsvJB1Lj7Zx6r9NYS FIo/mEAbdCkRL/aE2sXFTocLs0qgo88My5JYeElD2cKOtjqZIAwRS/Y7oiwB6lmgrdcs ueFSG078Mylom3jf2N9ht+X1iWVY29/zhpovQtIbaMLOypgq+6FoXkdvqo1cZTOUCKk3 WU2dh3hEqIYxaPn89+Oe4dEpGFKrKdozpIDhOBpvHvvx9p9AR/TkusjnCoOCaTi6MlUn Am6g== X-Gm-Message-State: AOUpUlFN9Dyf7I9zti8mfIakvqydyzzX6sdI4zbnWb1IoE3KUWUL+3Hk nK+4i2aJ+doDKqL8iBcpy4QIT5PbDMA= X-Google-Smtp-Source: AA+uWPzBQ36vcvfC8lnAqZ92Fjmfu1VZKHOIHYwplvzBFdUKHD1oAN/gwsLnuiT22YtmWjcDva7RtQ== X-Received: by 2002:a50:ab13:: with SMTP id s19-v6mr22180495edc.133.1534155370173; Mon, 13 Aug 2018 03:16:10 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:46 +0200 Message-Id: <20180813101453.10200-27-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::541 Subject: [Qemu-devel] [PATCH 26/33] tests/qgraph: virtio-rng 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/virtio-rng-test in qgraph test node, virtio-rng-test. This test consumes a virtio-rng interface and checks that its function return the expected values. Some functions are implemented only for virtio-rng-pci, so they don't consume virtio-rng, but virtio-rng-pci Note that this test does not allocate any virtio-rng structure, it's all done by the qtest walking graph mechanism Signed-off-by: Emanuele Giuseppe Esposito --- tests/Makefile.include | 3 +-- tests/virtio-rng-test.c | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 162187d15b..cc1e1396f1 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -195,7 +195,6 @@ gcov-files-virtio-y +=3D i386-softmmu/hw/net/virtio-net= .c gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio-balloon.c check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/block/virtio-blk.c -check-qtest-virtio-y +=3D tests/virtio-rng-test$(EXESUF) gcov-files-virtio-y +=3D hw/virtio/virtio-rng.c check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) gcov-files-virtio-y +=3D i386-softmmu/hw/scsi/virtio-scsi.c @@ -784,6 +783,7 @@ libqgraph-tests-obj-y +=3D tests/virtio-serial-test.o libqgraph-tests-obj-y +=3D tests/virtio-console-test.o libqgraph-tests-obj-y +=3D tests/virtio-9p-test.o libqgraph-tests-obj-y +=3D tests/virtio-balloon-test.o +libqgraph-tests-obj-y +=3D tests/virtio-rng-test.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y) @@ -829,7 +829,6 @@ tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-o= bj-y) tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-ob= j-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y)= $(libqos-virtio-obj-y) -tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y) tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-= obj-y) tests/tpci200-test$(EXESUF): tests/tpci200-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o diff --git a/tests/virtio-rng-test.c b/tests/virtio-rng-test.c index dcecf77463..fd67922b66 100644 --- a/tests/virtio-rng-test.c +++ b/tests/virtio-rng-test.c @@ -9,16 +9,17 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" -#include "libqos/pci.h" +#include "libqos/qgraph.h" +#include "libqos/virtio-rng.h" =20 #define PCI_SLOT_HP 0x06 =20 /* Tests only initialization so far. TODO: Replace with functional tests */ -static void pci_nop(void) +static void nop(void *obj, void *data, QGuestAllocator *alloc) { } =20 -static void hotplug(void) +static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc) { const char *arch =3D qtest_get_arch(); =20 @@ -29,18 +30,10 @@ static void hotplug(void) } } =20 -int main(int argc, char **argv) +static void register_virtio_rng_test(void) { - int ret; - - g_test_init(&argc, &argv, NULL); - qtest_add_func("/virtio/rng/pci/nop", pci_nop); - qtest_add_func("/virtio/rng/pci/hotplug", hotplug); - - qtest_start("-device virtio-rng-pci"); - ret =3D g_test_run(); - - qtest_end(); - - return ret; + qos_add_test("rng-nop", "virtio-rng", nop, NULL); + qos_add_test("rng-hotplug", "virtio-rng-pci", rng_hotplug, NULL); } + +libqos_init(register_virtio_rng_test); --=20 2.17.1