From nobody Tue Nov 4 22:00:41 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 153356745951384.59956204630669; Mon, 6 Aug 2018 07:57:39 -0700 (PDT) Received: from localhost ([::1]:34473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmgx0-0008Km-BQ for importer@patchew.org; Mon, 06 Aug 2018 10:57:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmgbH-0005Ec-TA for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmgbG-00011M-Pv for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:11 -0400 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]:45783) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmgbG-00010v-J4 for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:10 -0400 Received: by mail-ed1-x544.google.com with SMTP id s16-v6so5240058edq.12 for ; Mon, 06 Aug 2018 07:35:10 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.126]) by smtp.gmail.com with ESMTPSA id x13-v6sm14615157edx.17.2018.08.06.07.35.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 07:35: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=adW5F7j4EP/+Ep6mEMWY7ASChs+7QzdZtWTpuMDF8Os=; b=N2pTfXeXG6wkjsO+4svDipSzF7/njoffcf+sCQJyz5JOSMPEMtlFwdCKYBPKMVvAk9 CeE95ioLyEfvxTmTNPDIMjAgH6b1+iKVmKgxGfXvRbo1/dkLrQanNsPHOlWD/bfXEyav Mnj0PDNnVezd1a9/JGv/GIVTaQO+FLekVca0bLTQ+z+ZOXGOCex9FT3o6PPoPhmDWAdv XD2pI/Anl0Wh0Yjf4UIoWx2PYMy7Q0xGV2j0aw78QCdB9TWDw2kchJTX2FTfRyuzaf7B 3P0lmCU6DgyF+/tlHvdfuscILW6884WLSuuXa/+Xgp0vy9yN/XjCgB27F/sfSQlnlRwU rGrQ== 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=adW5F7j4EP/+Ep6mEMWY7ASChs+7QzdZtWTpuMDF8Os=; b=VA3nsWFZ9f9IHGdm5gTqhhodkW5gZsR7u/TOpVd3uGFwLbL5NVwRe5kH8QHa+JHZHh n9WQOK7lqxvVn14uMbZSPHMcaV0O5o1FGyCGI7EB9zHKYbKFb0MjpAOZpFgegeDuhjFg cpzqKcFoO/6dpZFF30ZtyYfGAM0BtfmcW2i0QeUvZVun7yjYufPIuzmhrVUEHjJrXbBb XIWDeWJrH5qJ3mQJTW5ip/ns3bBsMgokKxF1aHtE4UZjbektjtPqY+l/atjfjXqqYB0n kHIkAiKhKLWcv8E0bj0FkmukR3lh9SqMGg7SUvafphj6BcFwc8++HZpzHfFcqQuZextM 6ndw== X-Gm-Message-State: AOUpUlHdTpjOAjWp+3dgIh956sv0aYPZQQO7uJ3Avcrmcxv4I6XWKVmE hoM67fWlb1DYRRi0lzr7XfI= X-Google-Smtp-Source: AAOMgpdrlzJg3cqvAV+LC86ZsH6pAu21V1XSCg6bDMP4Mz6TOWyW/I42exZ18i8bpbTQb2Zco3ydJg== X-Received: by 2002:a50:b684:: with SMTP id d4-v6mr18265613ede.250.1533566109575; Mon, 06 Aug 2018 07:35:09 -0700 (PDT) From: Emanuele Giuseppe Esposito To: Paolo Bonzini Date: Mon, 6 Aug 2018 16:34:05 +0200 Message-Id: <20180806143412.27722-28-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180806143412.27722-1-e.emanuelegiuseppe@gmail.com> References: <20180806143412.27722-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 v2 27/34] test/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 , Stefan Hajnoczi , Emanuele Giuseppe Esposito , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 6ebd6463a9..3a1a99b8c8 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..24fd62f44f 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 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(virtio_rng_test); --=20 2.17.1