From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567604136; cv=none; d=zoho.com; s=zohoarc; b=l7OuAXbHmhWz/KZUcjgXpBA+seWpxmR+0Dg0RSAkS6Rr2L/ZMJ7X/aeG0ILQMjnhWFejFL8o0IjZRLrJTnAiJjtVRJnge15jLluJrGoWWoQetVzjJp2CHyEfLMF0hvfEHX6DNfaM0jq3dt0KUNzALJj0PW9PBA+GKhK4mynAyG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567604136; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0FygqQMeH/JiDxvRLMtIWNFkHuWufTXuppCPgFMM7xE=; b=m7nzlE2HiwoUyzM5xKekU4GqwRWxJgFD8FvdFm9rNPE8+hv6a+ioI1BuCN9brAzoLchKWT8FmkSJEOgQPDQsYEkBxC+p8YZafmtaz019lHrOuuoIMr17+pe/iV9kDvf0of76wiuP5XTX6J0ENBq+8CmgA3x3O1WY0lvRBsnNzo8= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156760413642450.73206378449754; Wed, 4 Sep 2019 06:35:36 -0700 (PDT) Received: from localhost ([::1]:58070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VRe-0000rN-3T for importer@patchew.org; Wed, 04 Sep 2019 09:35:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55026) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuD-0001zr-6Z for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuB-0008IN-6n for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuA-0008I1-Vd for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:00:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12FF011A03 for ; Wed, 4 Sep 2019 13:00:58 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 873D51001B1A; Wed, 4 Sep 2019 13:00:56 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:42 +0200 Message-Id: <20190904130047.25808-2-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Sep 2019 13:00:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/6] tests/migration: Do not use functions anymore that rely on global_qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The migration tests deal with multiple test states, so we really should not use functions here that rely on the single global_qtest variable. Switch from qtest_start() to qtest_init() to make sure that global_qtest is not set anymore. This also revealed a regression in the migrate() function: It has once been converted to use the qtest_qmp() function, but commit b5bbd3f315d686bd511 ("Clean up string interpolation into QMP, part 2") accidentally reverted it back to qmp(). Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Laurent Vivier Signed-off-by: Thomas Huth Reviewed-by: Stefan Hajnoczi --- tests/migration-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index b87ba99a9e..a9f81cc185 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -490,7 +490,7 @@ static void migrate(QTestState *who, const char *uri, c= onst char *fmt, ...) g_assert(!qdict_haskey(args, "uri")); qdict_put_str(args, "uri", uri); =20 - rsp =3D qmp("{ 'execute': 'migrate', 'arguments': %p}", args); + rsp =3D qtest_qmp(who, "{ 'execute': 'migrate', 'arguments': %p}", arg= s); =20 g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); @@ -625,7 +625,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, cmd_dst =3D tmp; } =20 - *from =3D qtest_start(cmd_src); + *from =3D qtest_init(cmd_src); g_free(cmd_src); =20 *to =3D qtest_init(cmd_dst); @@ -715,7 +715,7 @@ static void test_deprecated(void) { QTestState *from; =20 - from =3D qtest_start("-machine none"); + from =3D qtest_init("-machine none"); =20 deprecated_set_downtime(from, 0.12345); deprecated_set_speed(from, 12345); --=20 2.18.1 From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567604122; cv=none; d=zoho.com; s=zohoarc; b=chsD9KlhHPLzNO4SvJxeCB3WEpiIn60oBDRreaOsSuiS+RcICsaNJFEcK1duq0ADrLGSbfdjhMKv9r0E5S64OO4GTp0pygql5XRS3F7oXekvhjHz9s1Kww5NQPs1b4hEU1KO7VVASZBa1IPBqBQtilbG8B0KiqsuVM7nMHWuZyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567604122; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=yYCwnkRw3Q+LvFqTSblT9K4ASYSWr1OzLsPWb6DXbX8=; b=UPzFS1l/woT0sTGhoj/vJOsenT+g1Gk/s6MDG219en7TGEYipdHiNPbJ94ocNzJRNtUeH4dHKuCpPHQ2SCK/VQaXNU4H5BLqmZStV4lISgIC0yri11mfIjsoETnZMNZEhe0ebTbxxhzGkPxR4z6MyGJjPmlDeHJzAUjhpMm+fso= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567604122285889.2517010622454; Wed, 4 Sep 2019 06:35:22 -0700 (PDT) Received: from localhost ([::1]:58066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VRQ-0000XG-Om for importer@patchew.org; Wed, 04 Sep 2019 09:35:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55088) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuI-00028P-0L for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuC-0008J5-JY for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56176) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuC-0008Ib-Dq for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3AD2C05243E for ; Wed, 4 Sep 2019 13:00:59 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A25E100197A; Wed, 4 Sep 2019 13:00:58 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:43 +0200 Message-Id: <20190904130047.25808-3-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Sep 2019 13:00:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/6] tests/libqos/e1000e: Make e1000e libqos functions independent from global_qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" libqos library functions should never depend on functions (like memread(), memwrite() or clock_step()) that require global_qtest to be set, since library functions might get used in qtests that track multiple states, too. Thus let's replace the global_qtest-related functions with their independent counterparts. Reviewed-by: Laurent Vivier Signed-off-by: Thomas Huth Reviewed-by: Stefan Hajnoczi --- tests/libqos/e1000e.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/libqos/e1000e.c b/tests/libqos/e1000e.c index 1d0592974e..560e7a2bb2 100644 --- a/tests/libqos/e1000e.c +++ b/tests/libqos/e1000e.c @@ -85,26 +85,32 @@ static uint32_t e1000e_macreg_read(QE1000E *d, uint32_t= reg) =20 void e1000e_tx_ring_push(QE1000E *d, void *descr) { + QE1000E_PCI *d_pci =3D container_of(d, QE1000E_PCI, e1000e); uint32_t tail =3D e1000e_macreg_read(d, E1000E_TDT); uint32_t len =3D e1000e_macreg_read(d, E1000E_TDLEN) / E1000E_TXD_LEN; =20 - memwrite(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); + qtest_memwrite(d_pci->pci_dev.bus->qts, d->tx_ring + tail * E1000E_TXD= _LEN, + descr, E1000E_TXD_LEN); e1000e_macreg_write(d, E1000E_TDT, (tail + 1) % len); =20 /* Read WB data for the packet transmitted */ - memread(d->tx_ring + tail * E1000E_TXD_LEN, descr, E1000E_TXD_LEN); + qtest_memread(d_pci->pci_dev.bus->qts, d->tx_ring + tail * E1000E_TXD_= LEN, + descr, E1000E_TXD_LEN); } =20 void e1000e_rx_ring_push(QE1000E *d, void *descr) { + QE1000E_PCI *d_pci =3D container_of(d, QE1000E_PCI, e1000e); uint32_t tail =3D e1000e_macreg_read(d, E1000E_RDT); uint32_t len =3D e1000e_macreg_read(d, E1000E_RDLEN) / E1000E_RXD_LEN; =20 - memwrite(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); + qtest_memwrite(d_pci->pci_dev.bus->qts, d->rx_ring + tail * E1000E_RXD= _LEN, + descr, E1000E_RXD_LEN); e1000e_macreg_write(d, E1000E_RDT, (tail + 1) % len); =20 /* Read WB data for the packet received */ - memread(d->rx_ring + tail * E1000E_RXD_LEN, descr, E1000E_RXD_LEN); + qtest_memread(d_pci->pci_dev.bus->qts, d->rx_ring + tail * E1000E_RXD_= LEN, + descr, E1000E_RXD_LEN); } =20 static void e1000e_foreach_callback(QPCIDevice *dev, int devfn, void *data) @@ -123,7 +129,7 @@ void e1000e_wait_isr(QE1000E *d, uint16_t msg_id) if (qpci_msix_pending(&d_pci->pci_dev, msg_id)) { return; } - clock_step(10000); + qtest_clock_step(d_pci->pci_dev.bus->qts, 10000); } while (g_get_monotonic_time() < end_time); =20 g_error("Timeout expired"); --=20 2.18.1 From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567603008; cv=none; d=zoho.com; s=zohoarc; b=DcPEsKC140pTEVLopp2DrEf3FmoJLfIcCihG7ZZyyyuz9p7zgOf4Fso3ki3PjuoFPjkHYtbl15RlD+zAMowNzBolJNomzBMkC4xcVxeiinVINGGcwRg38fTvi07xV/ARmpqDNKzIEp+E7Pq8zMZ2tRCzaT/ZwF7SJXcHM/r5ytU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567603008; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PnCatCfFzthbqgwie+9zO9qLpNA09Z2iIPz109ldM/M=; b=GklaCvUeYv1CmgDetiT+h0b6dbWGR+bszaHki5sCU2yakToSWVAMUg1PYJvIb3O/fythCqOTgnSUkTP1ZEcZdWwKgCBNBOk/C++0beG5hIm1fyYOI47HMVolTIdzAUCV1irXJUp7n1zOs7w2lt7n+mrPaMSqSKzXtF6OHB+DzDU= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567603008935111.93961216511343; Wed, 4 Sep 2019 06:16:48 -0700 (PDT) Received: from localhost ([::1]:57714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5V9T-0007o6-LZ for importer@patchew.org; Wed, 04 Sep 2019 09:16:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55065) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuG-000261-G7 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuE-0008K4-BD for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41754) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuE-0008JY-0C for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3EB5710A8123 for ; Wed, 4 Sep 2019 13:01:01 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE0371000321; Wed, 4 Sep 2019 13:00:59 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:44 +0200 Message-Id: <20190904130047.25808-4-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Wed, 04 Sep 2019 13:01:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/6] tests/libqos: Replace clock_step with qtest_clock_step in virtio code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Library functions should not rely on functions that require global_qtest (since they might get used in tests that deal with multiple states). Commit 1999a70a05ad603d ("Make generic virtio code independent from global_qtest") already tried to clean the libqos virtio code, but I missed to replace the clock_step() function. Thus change it now to qtest_clock_step() instead. The logic of the qvirtio_wait_config_isr() function is now pushed to the virtio-mmio.c and virtio-pci.c files instead, since we can get the QTestState here easily. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/libqos/virtio-mmio.c | 14 +++++++++++++- tests/libqos/virtio-pci.c | 14 +++++++++++++- tests/libqos/virtio.c | 20 ++++++-------------- tests/libqos/virtio.h | 6 +++--- tests/virtio-blk-test.c | 3 ++- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/tests/libqos/virtio-mmio.c b/tests/libqos/virtio-mmio.c index 5f37b51129..d0047876a8 100644 --- a/tests/libqos/virtio-mmio.c +++ b/tests/libqos/virtio-mmio.c @@ -101,6 +101,18 @@ static bool qvirtio_mmio_get_config_isr_status(QVirtio= Device *d) return false; } =20 +static void qvirtio_mmio_wait_config_isr_status(QVirtioDevice *d, + gint64 timeout_us) +{ + QVirtioMMIODevice *dev =3D container_of(d, QVirtioMMIODevice, vdev); + gint64 start_time =3D g_get_monotonic_time(); + + do { + g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); + qtest_clock_step(dev->qts, 100); + } while (!qvirtio_mmio_get_config_isr_status(d)); +} + static void qvirtio_mmio_queue_select(QVirtioDevice *d, uint16_t index) { QVirtioMMIODevice *dev =3D container_of(d, QVirtioMMIODevice, vdev); @@ -179,7 +191,7 @@ const QVirtioBus qvirtio_mmio =3D { .get_status =3D qvirtio_mmio_get_status, .set_status =3D qvirtio_mmio_set_status, .get_queue_isr_status =3D qvirtio_mmio_get_queue_isr_status, - .get_config_isr_status =3D qvirtio_mmio_get_config_isr_status, + .wait_config_isr_status =3D qvirtio_mmio_wait_config_isr_status, .queue_select =3D qvirtio_mmio_queue_select, .get_queue_size =3D qvirtio_mmio_get_queue_size, .set_queue_address =3D qvirtio_mmio_set_queue_address, diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index 3f55c047a0..50499e75ef 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -175,6 +175,18 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioD= evice *d) } } =20 +static void qvirtio_pci_wait_config_isr_status(QVirtioDevice *d, + gint64 timeout_us) +{ + QVirtioPCIDevice *dev =3D container_of(d, QVirtioPCIDevice, vdev); + gint64 start_time =3D g_get_monotonic_time(); + + do { + g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); + qtest_clock_step(dev->pdev->bus->qts, 100); + } while (!qvirtio_pci_get_config_isr_status(d)); +} + static void qvirtio_pci_queue_select(QVirtioDevice *d, uint16_t index) { QVirtioPCIDevice *dev =3D container_of(d, QVirtioPCIDevice, vdev); @@ -257,7 +269,7 @@ const QVirtioBus qvirtio_pci =3D { .get_status =3D qvirtio_pci_get_status, .set_status =3D qvirtio_pci_set_status, .get_queue_isr_status =3D qvirtio_pci_get_queue_isr_status, - .get_config_isr_status =3D qvirtio_pci_get_config_isr_status, + .wait_config_isr_status =3D qvirtio_pci_wait_config_isr_status, .queue_select =3D qvirtio_pci_queue_select, .get_queue_size =3D qvirtio_pci_get_queue_size, .set_queue_address =3D qvirtio_pci_set_queue_address, diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c index 91ce06954b..0ae9956fc8 100644 --- a/tests/libqos/virtio.c +++ b/tests/libqos/virtio.c @@ -82,13 +82,13 @@ void qvirtio_set_driver_ok(QVirtioDevice *d) VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE); } =20 -void qvirtio_wait_queue_isr(QVirtioDevice *d, +void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, gint64 timeout_us) { gint64 start_time =3D g_get_monotonic_time(); =20 for (;;) { - clock_step(100); + qtest_clock_step(qts, 100); if (d->bus->get_queue_isr_status(d, vq)) { return; } @@ -109,8 +109,8 @@ uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts= , QVirtioDevice *d, gint64 start_time =3D g_get_monotonic_time(); uint8_t val; =20 - while ((val =3D readb(addr)) =3D=3D 0xff) { - clock_step(100); + while ((val =3D qtest_readb(qts, addr)) =3D=3D 0xff) { + qtest_clock_step(qts, 100); g_assert(!d->bus->get_queue_isr_status(d, vq)); g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); } @@ -137,7 +137,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDev= ice *d, for (;;) { uint32_t got_desc_idx; =20 - clock_step(100); + qtest_clock_step(qts, 100); =20 if (d->bus->get_queue_isr_status(d, vq) && qvirtqueue_get_buf(qts, vq, &got_desc_idx, len)) { @@ -151,15 +151,7 @@ void qvirtio_wait_used_elem(QTestState *qts, QVirtioDe= vice *d, =20 void qvirtio_wait_config_isr(QVirtioDevice *d, gint64 timeout_us) { - gint64 start_time =3D g_get_monotonic_time(); - - for (;;) { - clock_step(100); - if (d->bus->get_config_isr_status(d)) { - return; - } - g_assert(g_get_monotonic_time() - start_time <=3D timeout_us); - } + d->bus->wait_config_isr_status(d, timeout_us); } =20 void qvring_init(QTestState *qts, const QGuestAllocator *alloc, QVirtQueue= *vq, diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index 037176dbd8..2cb2448f46 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -69,8 +69,8 @@ struct QVirtioBus { /* Get the queue ISR status of the device */ bool (*get_queue_isr_status)(QVirtioDevice *d, QVirtQueue *vq); =20 - /* Get the configuration ISR status of the device */ - bool (*get_config_isr_status)(QVirtioDevice *d); + /* Wait for the configuration ISR status of the device */ + void (*wait_config_isr_status)(QVirtioDevice *d, gint64 timeout_us); =20 /* Select a queue to work on */ void (*queue_select)(QVirtioDevice *d, uint16_t index); @@ -112,7 +112,7 @@ void qvirtio_set_acknowledge(QVirtioDevice *d); void qvirtio_set_driver(QVirtioDevice *d); void qvirtio_set_driver_ok(QVirtioDevice *d); =20 -void qvirtio_wait_queue_isr(QVirtioDevice *d, +void qvirtio_wait_queue_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, gint64 timeout_us); uint8_t qvirtio_wait_status_byte_no_isr(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq, diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 982ff1538c..45375dc4ff 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -737,6 +737,7 @@ static void resize(void *obj, void *data, QGuestAllocat= or *t_alloc) int n_size =3D TEST_IMAGE_SIZE / 2; uint64_t capacity; QVirtQueue *vq; + QTestState *qts =3D global_qtest; =20 vq =3D qvirtqueue_setup(dev, t_alloc, 0); =20 @@ -746,7 +747,7 @@ static void resize(void *obj, void *data, QGuestAllocat= or *t_alloc) " 'arguments': { 'device': 'drive0', " " 'size': %d } }", n_size); =20 - qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US); + qvirtio_wait_queue_isr(qts, dev, vq, QVIRTIO_BLK_TIMEOUT_US); =20 capacity =3D qvirtio_config_readq(dev, 0); g_assert_cmpint(capacity, =3D=3D, n_size / 512); --=20 2.18.1 From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567603603; cv=none; d=zoho.com; s=zohoarc; b=d2Hr8mIAsbW5apOGofBZoj9f3OpoNvctXDTapEFe5qSyfVhT/O0prmIPLiBs0THU5HkLH0ypGdVntTcuaP4p6NDG/o0whbOqC6IQuzI/XCPSxgdCONlaoDrMiACCy8DIrP0Shr3Y/agARz/XRG3wi4xJh92x2pKxk95IWEFtr0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567603603; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sSZUmGyjkkOPRRxfJ9NdTOfkbeH8h0U6Q/3svRV/ZcY=; b=BXPInx7b4VTZ8wZM7CRbAGyvt7HSTcg0Z72JdamP/tSsf1wBEaTWqDWXnA/vESPqpFGCNfXieLHSOnldAKZAGH5iNkjgehyoXtcXhO6+z/pIOJ41CC88JFjUwYBLnFcmFEpoY1EqSRniY4AU/lqzmQ5eBMetZ8mGQpbLRKGTHDQ= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567603603144364.5655291715491; Wed, 4 Sep 2019 06:26:43 -0700 (PDT) Received: from localhost ([::1]:57902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VIz-0001Am-Mc for importer@patchew.org; Wed, 04 Sep 2019 09:26:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55079) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuH-00027Y-Da for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuF-0008Kz-Qv for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuF-0008Kf-J6 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE13FC050E12 for ; Wed, 4 Sep 2019 13:01:02 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 848B91001B02; Wed, 4 Sep 2019 13:01:01 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:45 +0200 Message-Id: <20190904130047.25808-5-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 04 Sep 2019 13:01:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/6] tests: Remove unnecessary global_qtest references X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are going to remove global_qtest from the main libqtest library soon, so tests that do not urgently need global_qtest anymore should be cleaned from the unnecessary references. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/ahci-test.c | 1 - tests/bios-tables-test.c | 1 - tests/ivshmem-test.c | 3 --- tests/rtas-test.c | 1 - 4 files changed, 6 deletions(-) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 086811e602..c8d42ceea0 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -200,7 +200,6 @@ static void ahci_shutdown(AHCIQState *ahci) { QOSState *qs =3D ahci->parent; =20 - assert(!global_qtest); ahci_clean_mem(ahci); free_ahci_device(ahci->dev); g_free(ahci); diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index a356ac3489..9b3d8b0d1b 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -626,7 +626,6 @@ static void test_acpi_one(const char *params, test_data= *data) test_smbios_structs(data); } =20 - assert(!global_qtest); qtest_quit(data->qts); g_free(args); } diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index b76457948b..be9aa92a61 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -100,7 +100,6 @@ static inline void write_mem(IVState *s, uint64_t off, =20 static void cleanup_vm(IVState *s) { - assert(!global_qtest); g_free(s->dev); qtest_shutdown(s->qs); } @@ -388,7 +387,6 @@ static void test_ivshmem_hotplug(void) =20 qts =3D qtest_init("-object memory-backend-ram,size=3D1M,id=3Dmb1"); =20 - global_qtest =3D qts; /* TODO: Get rid of global_qtest here */ qtest_qmp_device_add(qts, "ivshmem-plain", "iv1", "{'addr': %s, 'memdev': 'mb1'}", stringify(PCI_SLOT_HP)); @@ -397,7 +395,6 @@ static void test_ivshmem_hotplug(void) } =20 qtest_quit(qts); - global_qtest =3D NULL; } =20 static void test_ivshmem_memdev(void) diff --git a/tests/rtas-test.c b/tests/rtas-test.c index ee888676ed..167b42db38 100644 --- a/tests/rtas-test.c +++ b/tests/rtas-test.c @@ -14,7 +14,6 @@ static void test_rtas_get_time_of_day(void) time_t t1, t2; =20 qs =3D qtest_spapr_boot("-machine pseries"); - global_qtest =3D qs->qts; =20 t1 =3D time(NULL); ret =3D qrtas_get_time_of_day(qs->qts, &qs->alloc, &tm, &ns); --=20 2.18.1 From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567604241; cv=none; d=zoho.com; s=zohoarc; b=Yoz3WhVR/pqfNzpmExTUq4EUfJuoYLOknsn/YZit5MghyA4yuBz5b3Un3TWf3MK0wn0VQgVmJkk5D1WB4agwRlhFIXgoYw/N9kM62dIprih8/JGESegr1NsaynbLQas/2D/rpdahBpzb4dwcLDNUgPtUZexH0Agd3jQOr4LDhi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567604241; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GJr/8RY9wiCD6j9d3SjiYwfdZUCxwmNmKS3GG/Ds6HU=; b=PPVJSpWPrlAv9bDcgmHvFu/6fjUIqjpClOXSiRvnVe7UAnMX5wafEnLd+GUsy5phWLj4hWBQtZeboV8P2BqCIvJyu3CkyPXvxnjfx7j/GsBnQ68KPYhmMY5zP0kb7Y8UW7kCQGuoOJQHBsAWOK7VURyhrlzGSkFxMrVVKAlznn8= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567604241840433.0791472683528; Wed, 4 Sep 2019 06:37:21 -0700 (PDT) Received: from localhost ([::1]:58294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VTH-00033l-Uz for importer@patchew.org; Wed, 04 Sep 2019 09:37:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuL-0002DK-SH for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuI-0008N9-Bd for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43078) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuH-0008Ln-OL for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DACD94E924 for ; Wed, 4 Sep 2019 13:01:04 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 333CB1001284; Wed, 4 Sep 2019 13:01:03 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:46 +0200 Message-Id: <20190904130047.25808-6-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Sep 2019 13:01:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/6] tests/libqtest: Move global_test wrapper function into a separate header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We want libqtest.h to become completely independen from global_qtest (so that the wrapper functions are not used by accident anymore). As a first step, move the wrapper functions into a separate header file. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- MAINTAINERS | 2 +- tests/libqtest-single.h | 311 ++++++++++++++++++++++++++++++++++++++++ tests/libqtest.c | 11 -- tests/libqtest.h | 287 +----------------------------------- 4 files changed, 313 insertions(+), 298 deletions(-) create mode 100644 tests/libqtest-single.h diff --git a/MAINTAINERS b/MAINTAINERS index ef6c01084b..b01bf0902a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2078,7 +2078,7 @@ R: Paolo Bonzini S: Maintained F: qtest.c F: accel/qtest.c -F: tests/libqtest.* +F: tests/libqtest* F: tests/libqos/ F: tests/*-test.c =20 diff --git a/tests/libqtest-single.h b/tests/libqtest-single.h new file mode 100644 index 0000000000..49259558a5 --- /dev/null +++ b/tests/libqtest-single.h @@ -0,0 +1,311 @@ +/* + * QTest - wrappers for test with single QEMU instances + * + * Copyright IBM, Corp. 2012 + * Copyright Red Hat, Inc. 2012 + * Copyright SUSE LINUX Products GmbH 2013 + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ +#ifndef LIBQTEST_SINGLE_H +#define LIBQTEST_SINGLE_H + +/** + * qtest_start: + * @args: other arguments to pass to QEMU + * + * Start QEMU and assign the resulting #QTestState to a global variable. + * The global variable is used by "shortcut" functions documented below. + * + * Returns: #QTestState instance. + */ +static inline QTestState *qtest_start(const char *args) +{ + global_qtest =3D qtest_init(args); + return global_qtest; +} + +/** + * qtest_end: + * + * Shut down the QEMU process started by qtest_start(). + */ +static inline void qtest_end(void) +{ + if (!global_qtest) { + return; + } + qtest_quit(global_qtest); + global_qtest =3D NULL; +} + +/** + * qmp: + * @fmt...: QMP message to send to qemu, formatted like + * qobject_from_jsonf_nofail(). See parse_escape() for what's + * supported after '%'. + * + * Sends a QMP message to QEMU and returns the response. + */ +GCC_FMT_ATTR(1, 2) +static inline QDict *qmp(const char *fmt, ...) +{ + va_list ap; + QDict *response; + + va_start(ap, fmt); + response =3D qtest_vqmp(global_qtest, fmt, ap); + va_end(ap); + return response; +} + +/** + * qmp_eventwait: + * @s: #event event to wait for. + * + * Continuously polls for QMP responses until it receives the desired even= t. + */ +static inline void qmp_eventwait(const char *event) +{ + return qtest_qmp_eventwait(global_qtest, event); +} + +/** + * get_irq: + * @num: Interrupt to observe. + * + * Returns: The level of the @num interrupt. + */ +static inline bool get_irq(int num) +{ + return qtest_get_irq(global_qtest, num); +} + +/** + * outb: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write an 8-bit value to an I/O port. + */ +static inline void outb(uint16_t addr, uint8_t value) +{ + qtest_outb(global_qtest, addr, value); +} + +/** + * outw: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write a 16-bit value to an I/O port. + */ +static inline void outw(uint16_t addr, uint16_t value) +{ + qtest_outw(global_qtest, addr, value); +} + +/** + * outl: + * @addr: I/O port to write to. + * @value: Value being written. + * + * Write a 32-bit value to an I/O port. + */ +static inline void outl(uint16_t addr, uint32_t value) +{ + qtest_outl(global_qtest, addr, value); +} + +/** + * inb: + * @addr: I/O port to read from. + * + * Reads an 8-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint8_t inb(uint16_t addr) +{ + return qtest_inb(global_qtest, addr); +} + +/** + * inw: + * @addr: I/O port to read from. + * + * Reads a 16-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint16_t inw(uint16_t addr) +{ + return qtest_inw(global_qtest, addr); +} + +/** + * inl: + * @addr: I/O port to read from. + * + * Reads a 32-bit value from an I/O port. + * + * Returns: Value read. + */ +static inline uint32_t inl(uint16_t addr) +{ + return qtest_inl(global_qtest, addr); +} + +/** + * writeb: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes an 8-bit value to guest memory. + */ +static inline void writeb(uint64_t addr, uint8_t value) +{ + qtest_writeb(global_qtest, addr, value); +} + +/** + * writew: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 16-bit value to guest memory. + */ +static inline void writew(uint64_t addr, uint16_t value) +{ + qtest_writew(global_qtest, addr, value); +} + +/** + * writel: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 32-bit value to guest memory. + */ +static inline void writel(uint64_t addr, uint32_t value) +{ + qtest_writel(global_qtest, addr, value); +} + +/** + * writeq: + * @addr: Guest address to write to. + * @value: Value being written. + * + * Writes a 64-bit value to guest memory. + */ +static inline void writeq(uint64_t addr, uint64_t value) +{ + qtest_writeq(global_qtest, addr, value); +} + +/** + * readb: + * @addr: Guest address to read from. + * + * Reads an 8-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint8_t readb(uint64_t addr) +{ + return qtest_readb(global_qtest, addr); +} + +/** + * readw: + * @addr: Guest address to read from. + * + * Reads a 16-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint16_t readw(uint64_t addr) +{ + return qtest_readw(global_qtest, addr); +} + +/** + * readl: + * @addr: Guest address to read from. + * + * Reads a 32-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint32_t readl(uint64_t addr) +{ + return qtest_readl(global_qtest, addr); +} + +/** + * readq: + * @addr: Guest address to read from. + * + * Reads a 64-bit value from guest memory. + * + * Returns: Value read. + */ +static inline uint64_t readq(uint64_t addr) +{ + return qtest_readq(global_qtest, addr); +} + +/** + * memread: + * @addr: Guest address to read from. + * @data: Pointer to where memory contents will be stored. + * @size: Number of bytes to read. + * + * Read guest memory into a buffer. + */ +static inline void memread(uint64_t addr, void *data, size_t size) +{ + qtest_memread(global_qtest, addr, data, size); +} + +/** + * memwrite: + * @addr: Guest address to write to. + * @data: Pointer to the bytes that will be written to guest memory. + * @size: Number of bytes to write. + * + * Write a buffer to guest memory. + */ +static inline void memwrite(uint64_t addr, const void *data, size_t size) +{ + qtest_memwrite(global_qtest, addr, data, size); +} + +/** + * clock_step_next: + * + * Advance the QEMU_CLOCK_VIRTUAL to the next deadline. + * + * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. + */ +static inline int64_t clock_step_next(void) +{ + return qtest_clock_step_next(global_qtest); +} + +/** + * clock_step: + * @step: Number of nanoseconds to advance the clock by. + * + * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds. + * + * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. + */ +static inline int64_t clock_step(int64_t step) +{ + return qtest_clock_step(global_qtest, step); +} + +#endif diff --git a/tests/libqtest.c b/tests/libqtest.c index 2713b86cf7..e5101d9d3a 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -1106,17 +1106,6 @@ void qtest_memset(QTestState *s, uint64_t addr, uint= 8_t pattern, size_t size) qtest_rsp(s, 0); } =20 -QDict *qmp(const char *fmt, ...) -{ - va_list ap; - QDict *response; - - va_start(ap, fmt); - response =3D qtest_vqmp(global_qtest, fmt, ap); - va_end(ap); - return response; -} - void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) { va_list ap; diff --git a/tests/libqtest.h b/tests/libqtest.h index 07ea35867c..6a7d7e41ad 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -628,45 +628,6 @@ void qtest_add_data_func_full(const char *str, void *d= ata, =20 void qtest_add_abrt_handler(GHookFunc fn, const void *data); =20 -/** - * qtest_start: - * @args: other arguments to pass to QEMU - * - * Start QEMU and assign the resulting #QTestState to a global variable. - * The global variable is used by "shortcut" functions documented below. - * - * Returns: #QTestState instance. - */ -static inline QTestState *qtest_start(const char *args) -{ - global_qtest =3D qtest_init(args); - return global_qtest; -} - -/** - * qtest_end: - * - * Shut down the QEMU process started by qtest_start(). - */ -static inline void qtest_end(void) -{ - if (!global_qtest) { - return; - } - qtest_quit(global_qtest); - global_qtest =3D NULL; -} - -/** - * qmp: - * @fmt...: QMP message to send to qemu, formatted like - * qobject_from_jsonf_nofail(). See parse_escape() for what's - * supported after '%'. - * - * Sends a QMP message to QEMU and returns the response. - */ -QDict *qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); - /** * qtest_qmp_assert_success: * @qts: QTestState instance to operate on @@ -680,253 +641,7 @@ QDict *qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) GCC_FMT_ATTR(2, 3); =20 -/* - * qmp_eventwait: - * @s: #event event to wait for. - * - * Continuously polls for QMP responses until it receives the desired even= t. - */ -static inline void qmp_eventwait(const char *event) -{ - return qtest_qmp_eventwait(global_qtest, event); -} - -/** - * get_irq: - * @num: Interrupt to observe. - * - * Returns: The level of the @num interrupt. - */ -static inline bool get_irq(int num) -{ - return qtest_get_irq(global_qtest, num); -} - -/** - * outb: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write an 8-bit value to an I/O port. - */ -static inline void outb(uint16_t addr, uint8_t value) -{ - qtest_outb(global_qtest, addr, value); -} - -/** - * outw: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write a 16-bit value to an I/O port. - */ -static inline void outw(uint16_t addr, uint16_t value) -{ - qtest_outw(global_qtest, addr, value); -} - -/** - * outl: - * @addr: I/O port to write to. - * @value: Value being written. - * - * Write a 32-bit value to an I/O port. - */ -static inline void outl(uint16_t addr, uint32_t value) -{ - qtest_outl(global_qtest, addr, value); -} - -/** - * inb: - * @addr: I/O port to read from. - * - * Reads an 8-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint8_t inb(uint16_t addr) -{ - return qtest_inb(global_qtest, addr); -} - -/** - * inw: - * @addr: I/O port to read from. - * - * Reads a 16-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint16_t inw(uint16_t addr) -{ - return qtest_inw(global_qtest, addr); -} - -/** - * inl: - * @addr: I/O port to read from. - * - * Reads a 32-bit value from an I/O port. - * - * Returns: Value read. - */ -static inline uint32_t inl(uint16_t addr) -{ - return qtest_inl(global_qtest, addr); -} - -/** - * writeb: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes an 8-bit value to guest memory. - */ -static inline void writeb(uint64_t addr, uint8_t value) -{ - qtest_writeb(global_qtest, addr, value); -} - -/** - * writew: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 16-bit value to guest memory. - */ -static inline void writew(uint64_t addr, uint16_t value) -{ - qtest_writew(global_qtest, addr, value); -} - -/** - * writel: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 32-bit value to guest memory. - */ -static inline void writel(uint64_t addr, uint32_t value) -{ - qtest_writel(global_qtest, addr, value); -} - -/** - * writeq: - * @addr: Guest address to write to. - * @value: Value being written. - * - * Writes a 64-bit value to guest memory. - */ -static inline void writeq(uint64_t addr, uint64_t value) -{ - qtest_writeq(global_qtest, addr, value); -} - -/** - * readb: - * @addr: Guest address to read from. - * - * Reads an 8-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint8_t readb(uint64_t addr) -{ - return qtest_readb(global_qtest, addr); -} - -/** - * readw: - * @addr: Guest address to read from. - * - * Reads a 16-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint16_t readw(uint64_t addr) -{ - return qtest_readw(global_qtest, addr); -} - -/** - * readl: - * @addr: Guest address to read from. - * - * Reads a 32-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint32_t readl(uint64_t addr) -{ - return qtest_readl(global_qtest, addr); -} - -/** - * readq: - * @addr: Guest address to read from. - * - * Reads a 64-bit value from guest memory. - * - * Returns: Value read. - */ -static inline uint64_t readq(uint64_t addr) -{ - return qtest_readq(global_qtest, addr); -} - -/** - * memread: - * @addr: Guest address to read from. - * @data: Pointer to where memory contents will be stored. - * @size: Number of bytes to read. - * - * Read guest memory into a buffer. - */ -static inline void memread(uint64_t addr, void *data, size_t size) -{ - qtest_memread(global_qtest, addr, data, size); -} - -/** - * memwrite: - * @addr: Guest address to write to. - * @data: Pointer to the bytes that will be written to guest memory. - * @size: Number of bytes to write. - * - * Write a buffer to guest memory. - */ -static inline void memwrite(uint64_t addr, const void *data, size_t size) -{ - qtest_memwrite(global_qtest, addr, data, size); -} - -/** - * clock_step_next: - * - * Advance the QEMU_CLOCK_VIRTUAL to the next deadline. - * - * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. - */ -static inline int64_t clock_step_next(void) -{ - return qtest_clock_step_next(global_qtest); -} - -/** - * clock_step: - * @step: Number of nanoseconds to advance the clock by. - * - * Advance the QEMU_CLOCK_VIRTUAL by @step nanoseconds. - * - * Returns: The current value of the QEMU_CLOCK_VIRTUAL in nanoseconds. - */ -static inline int64_t clock_step(int64_t step) -{ - return qtest_clock_step(global_qtest, step); -} +#include "libqtest-single.h" =20 QDict *qmp_fd_receive(int fd); void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, --=20 2.18.1 From nobody Sun May 19 02:06:32 2024 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1567604300; cv=none; d=zoho.com; s=zohoarc; b=d+VtDWjwlAaIePm5NWmDwtU9qdtSDYGBbYisHymRr8QcAMZu96sc8yf+4BOaravNsb9DqwyEcdpHYxuGmh/fa4M+0cse1k3uL2rSQjaxpf+o/Z9SmsKCkwmemd1/QoD8A9744MZegFuWPReRvHSKdWSmoocOT0FCcVE+0vLY8fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567604300; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OUg0KuzSMHWoAY1omRmRooGYlkxNUVXPue4pOCsDQ3Q=; b=lz4f4o+0I6J+3aeyRSn/aQum63zwAdZs/9snTr4y5/1KGph96LA0iVrxfE6iDAbaY+hjw9mn3vL5Zf6FI6HJG8gULssKhwq2Gk2FA3Be0UxbJF+QOyiOw+BFUcLuuM6b+hcXtgs2H2PBwxqMGo9TJh/tjMkXRiIOTnMjE8gifK8= ARC-Authentication-Results: i=1; mx.zoho.com; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567604300786298.204950258195; Wed, 4 Sep 2019 06:38:20 -0700 (PDT) Received: from localhost ([::1]:58348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5VUJ-0004FQ-Md for importer@patchew.org; Wed, 04 Sep 2019 09:38:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55131) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5UuM-0002Ej-Ku for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5UuK-0008OG-3B for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i5UuJ-0008Nb-H3 for qemu-devel@nongnu.org; Wed, 04 Sep 2019 09:01:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0111875224 for ; Wed, 4 Sep 2019 13:01:06 +0000 (UTC) Received: from thuth.com (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F7A610002B8; Wed, 4 Sep 2019 13:01:05 +0000 (UTC) From: Thomas Huth To: Laurent Vivier , qemu-devel@nongnu.org Date: Wed, 4 Sep 2019 15:00:47 +0200 Message-Id: <20190904130047.25808-7-thuth@redhat.com> In-Reply-To: <20190904130047.25808-1-thuth@redhat.com> References: <20190904130047.25808-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.68]); Wed, 04 Sep 2019 13:01:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 6/6] tests/libqtest: Use libqtest-single.h in tests that require global_qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Tests that require global_qtest or the related wrapper functions now use the libqtest-single.h header that is dedicated for everything related to global_qtest. The core libqtest.c and libqtest.h files are now completely indepedent from global_qtest, so that the core library is now not depending on a global state anymore. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- tests/cpu-plug-test.c | 2 +- tests/display-vga-test.c | 2 +- tests/e1000e-test.c | 2 +- tests/fdc-test.c | 2 +- tests/i440fx-test.c | 2 +- tests/i82801b11-test.c | 2 +- tests/intel-hda-test.c | 2 +- tests/ioh3420-test.c | 2 +- tests/ipmi-kcs-test.c | 3 +-- tests/libqtest-single.h | 4 ++++ tests/libqtest.c | 2 -- tests/libqtest.h | 4 ---- tests/m25p80-test.c | 2 +- tests/qos-test.c | 2 +- tests/rtc-test.c | 2 +- tests/rtl8139-test.c | 2 +- tests/test-arm-mptimer.c | 2 +- tests/test-netfilter.c | 2 +- tests/test-x86-cpuid-compat.c | 2 +- tests/tmp105-test.c | 2 +- tests/tpm-crb-test.c | 2 +- tests/tpm-tests.c | 2 +- tests/tpm-tis-test.c | 2 +- tests/usb-hcd-ohci-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/vhost-user-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-ccw-test.c | 2 +- tests/virtio-net-test.c | 2 +- tests/virtio-scsi-test.c | 2 +- tests/virtio-serial-test.c | 2 +- 32 files changed, 33 insertions(+), 36 deletions(-) diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c index 3049620854..776407e1b6 100644 --- a/tests/cpu-plug-test.c +++ b/tests/cpu-plug-test.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" =20 #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" =20 struct PlugTestData { diff --git a/tests/display-vga-test.c b/tests/display-vga-test.c index bd176dcf3a..ace3bb28e0 100644 --- a/tests/display-vga-test.c +++ b/tests/display-vga-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 static void pci_cirrus(void) { diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c index 93628c588d..1a232a663a 100644 --- a/tests/e1000e-test.c +++ b/tests/e1000e-test.c @@ -26,7 +26,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu-common.h" #include "libqos/pci-pc.h" #include "qemu/sockets.h" diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 31cd3295c1..26b69f7c5c 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" =20 =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qemu-common.h" =20 diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index 69205b58a8..1f57d9684b 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" #include "hw/pci/pci_regs.h" diff --git a/tests/i82801b11-test.c b/tests/i82801b11-test.c index a6e31594c9..4345da338b 100644 --- a/tests/i82801b11-test.c +++ b/tests/i82801b11-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/intel-hda-test.c b/tests/intel-hda-test.c index b782b2e944..fc25ccc33c 100644 --- a/tests/intel-hda-test.c +++ b/tests/intel-hda-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 #define HDA_ID "hda0" #define CODEC_DEVICES " -device hda-output,bus=3D" HDA_ID ".0" \ diff --git a/tests/ioh3420-test.c b/tests/ioh3420-test.c index b54c4b9f11..f6ca43cca7 100644 --- a/tests/ioh3420-test.c +++ b/tests/ioh3420-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* Tests only initialization so far. TODO: Replace with functional tests */ static void nop(void) diff --git a/tests/ipmi-kcs-test.c b/tests/ipmi-kcs-test.c index a2354c10c7..693a6aacb5 100644 --- a/tests/ipmi-kcs-test.c +++ b/tests/ipmi-kcs-test.c @@ -24,8 +24,7 @@ =20 #include "qemu/osdep.h" =20 - -#include "libqtest.h" +#include "libqtest-single.h" =20 #define IPMI_IRQ 5 =20 diff --git a/tests/libqtest-single.h b/tests/libqtest-single.h index 49259558a5..6f1bb1331c 100644 --- a/tests/libqtest-single.h +++ b/tests/libqtest-single.h @@ -11,6 +11,10 @@ #ifndef LIBQTEST_SINGLE_H #define LIBQTEST_SINGLE_H =20 +#include "libqtest.h" + +QTestState *global_qtest __attribute__((common, weak)); + /** * qtest_start: * @args: other arguments to pass to QEMU diff --git a/tests/libqtest.c b/tests/libqtest.c index e5101d9d3a..0a6b91737e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -35,8 +35,6 @@ #define SOCKET_TIMEOUT 50 #define SOCKET_MAX_FDS 16 =20 -QTestState *global_qtest; - struct QTestState { int fd; diff --git a/tests/libqtest.h b/tests/libqtest.h index 6a7d7e41ad..c8cffe5d68 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -22,8 +22,6 @@ =20 typedef struct QTestState QTestState; =20 -extern QTestState *global_qtest; - /** * qtest_initf: * @fmt...: Format for creating other arguments to pass to QEMU, formatted @@ -641,8 +639,6 @@ void qtest_add_abrt_handler(GHookFunc fn, const void *d= ata); void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) GCC_FMT_ATTR(2, 3); =20 -#include "libqtest-single.h" - QDict *qmp_fd_receive(int fd); void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, const char *fmt, va_list ap) GCC_FMT_ATTR(4, 0); diff --git a/tests/m25p80-test.c b/tests/m25p80-test.c index 055f7246a8..50c6b79fb3 100644 --- a/tests/m25p80-test.c +++ b/tests/m25p80-test.c @@ -25,7 +25,7 @@ =20 #include "qemu/osdep.h" #include "qemu/bswap.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 /* * ASPEED SPI Controller registers diff --git a/tests/qos-test.c b/tests/qos-test.c index 3c0071b3b7..fd70d73ea5 100644 --- a/tests/qos-test.c +++ b/tests/qos-test.c @@ -18,7 +18,7 @@ =20 #include "qemu/osdep.h" #include -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qstring.h" diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 509be707e3..6309b0ef6c 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/timer.h" #include "hw/timer/mc146818rtc_regs.h" =20 diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c index d6d0c24909..4506049264 100644 --- a/tests/rtl8139-test.c +++ b/tests/rtl8139-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/pci-pc.h" #include "qemu/timer.h" #include "qemu-common.h" diff --git a/tests/test-arm-mptimer.c b/tests/test-arm-mptimer.c index 156a39f50d..7a56d56da9 100644 --- a/tests/test-arm-mptimer.c +++ b/tests/test-arm-mptimer.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" #include "qemu/timer.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 #define TIMER_BLOCK_SCALE(s) ((((s) & 0xff) + 1) * 10) =20 diff --git a/tests/test-netfilter.c b/tests/test-netfilter.c index e47075dd06..22927ee6ab 100644 --- a/tests/test-netfilter.c +++ b/tests/test-netfilter.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/qmp/qdict.h" =20 /* add a netfilter to a netdev and then remove it */ diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c index e75b959950..772287bdb4 100644 --- a/tests/test-x86-cpuid-compat.c +++ b/tests/test-x86-cpuid-compat.c @@ -4,7 +4,7 @@ #include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qbool.h" -#include "libqtest.h" +#include "libqtest-single.h" =20 static char *get_cpu0_qom_path(void) { diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c index f599309a4a..f930a96b83 100644 --- a/tests/tmp105-test.c +++ b/tests/tmp105-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/qgraph.h" #include "libqos/i2c.h" #include "qapi/qmp/qdict.h" diff --git a/tests/tpm-crb-test.c b/tests/tpm-crb-test.c index a139caa51d..632fb7fbd8 100644 --- a/tests/tpm-crb-test.c +++ b/tests/tpm-crb-test.c @@ -15,7 +15,7 @@ =20 #include "hw/acpi/tpm.h" #include "io/channel-socket.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "tpm-emu.h" =20 diff --git a/tests/tpm-tests.c b/tests/tpm-tests.c index e640777aa9..6e45a0ba85 100644 --- a/tests/tpm-tests.c +++ b/tests/tpm-tests.c @@ -15,7 +15,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "tpm-tests.h" =20 static bool diff --git a/tests/tpm-tis-test.c b/tests/tpm-tis-test.c index 92a7e95aad..dcf30e05b7 100644 --- a/tests/tpm-tis-test.c +++ b/tests/tpm-tis-test.c @@ -17,7 +17,7 @@ =20 #include "hw/acpi/tpm.h" #include "io/channel-socket.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "tpm-emu.h" =20 diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c index 0cd73b7363..19d760f3fb 100644 --- a/tests/usb-hcd-ohci-test.c +++ b/tests/usb-hcd-ohci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "libqos/usb.h" #include "libqos/qgraph.h" diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 2eef8e3d1c..7a117b64d9 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/libqos.h" #include "libqos/usb.h" #include "libqos/libqos-pc.h" diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c index 01845371f9..10ef9d2a91 100644 --- a/tests/usb-hcd-xhci-test.c +++ b/tests/usb-hcd-xhci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/usb.h" =20 =20 diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6ae8a23688..91ea373ba5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -10,7 +10,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "libqtest-single.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu/config-file.h" diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 45375dc4ff..ed13167392 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/bswap.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_blk.h" diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c index 9f445ef4ad..d05236407b 100644 --- a/tests/virtio-ccw-test.c +++ b/tests/virtio-ccw-test.c @@ -14,7 +14,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "libqos/virtio.h" =20 static void virtio_balloon_nop(void) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index 840875aaae..a08e2ffe12 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" #include "qemu-common.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/iov.h" #include "qemu/module.h" #include "qapi/qmp/qdict.h" diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 09348765d7..7c8f9b27f8 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "scsi/constants.h" #include "libqos/libqos-pc.h" diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c index e584ad76e8..2541034822 100644 --- a/tests/virtio-serial-test.c +++ b/tests/virtio-serial-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "libqtest-single.h" #include "qemu/module.h" #include "libqos/virtio-serial.h" =20 --=20 2.18.1