From nobody Mon Nov 10 19:07:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; 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=1558436181; cv=none; d=zoho.com; s=zohoarc; b=IFpIuQ4qTyUNSVemBL+sGKq5UrxSr2EUaumE5wR91QdD+OSkHplNL1pbby6rlRsp1ikYNFBAI2xx/ATRK0WESjLqCuZdCHn8jkJbgCpvGVpCwtnZZSIHDfulU526TxOa+czGP2rz3koEJL9wCVPbdbgbWo6ogJ3y9Ed7T1ijEKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558436181; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mPubcdWbP4VwYbEL2vLP0BjOlIJJ7Ew+/FTm1IDzoY0=; b=lIn4EYcZmBvV7zq+3pNX4BF4e6ftNn29QQ5MqdJCXFXPqagZ7V1qDM6HRQkcAXM9yRde4xgp2ezer2Ep/6X+hIhz9qpoBW9wUOy5hYO220Vu5W0rCx38u5bhFthvXNfwVXg4xGrGO7QP8JoM0PXoTrIbkifp/soScuxmB5he8a8= 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 1558436181947621.000502446066; Tue, 21 May 2019 03:56:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:51336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT2RH-0001LP-Q8 for importer@patchew.org; Tue, 21 May 2019 06:56:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hT2PH-00006E-H2 for qemu-devel@nongnu.org; Tue, 21 May 2019 06:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hT2PG-0004hm-I1 for qemu-devel@nongnu.org; Tue, 21 May 2019 06:54:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40416) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hT2PG-0004hD-9e for qemu-devel@nongnu.org; Tue, 21 May 2019 06:54:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92DA830832E9; Tue, 21 May 2019 10:54:05 +0000 (UTC) Received: from thuth.com (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6239C6085B; Tue, 21 May 2019 10:54:04 +0000 (UTC) From: Thomas Huth To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 21 May 2019 12:53:37 +0200 Message-Id: <20190521105344.11637-7-thuth@redhat.com> In-Reply-To: <20190521105344.11637-1-thuth@redhat.com> References: <20190521105344.11637-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 21 May 2019 10:54:05 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PULL 06/13] tests/qom-test: Use qtest_init() instead of qtest_start() 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: kwolf@redhat.com, lvivier@redhat.com, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" qtest_start() + qtest_end() should be avoided, since they use the global_qtest variable that we want to get rid of in the long run. Use qtest_init() and qtest_quit() instead. Message-Id: <20190515174328.16361-5-thuth@redhat.com> Signed-off-by: Thomas Huth --- tests/qom-test.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/qom-test.c b/tests/qom-test.c index 73c52af3bb..4f94cc678c 100644 --- a/tests/qom-test.c +++ b/tests/qom-test.c @@ -44,7 +44,7 @@ static bool is_blacklisted(const char *arch, const char *= mach) return false; } =20 -static void test_properties(const char *path, bool recurse) +static void test_properties(QTestState *qts, const char *path, bool recurs= e) { char *child_path; QDict *response, *tuple, *tmp; @@ -52,8 +52,8 @@ static void test_properties(const char *path, bool recurs= e) QListEntry *entry; =20 g_test_message("Obtaining properties of %s", path); - response =3D qmp("{ 'execute': 'qom-list'," - " 'arguments': { 'path': %s } }", path); + response =3D qtest_qmp(qts, "{ 'execute': 'qom-list'," + " 'arguments': { 'path': %s } }", path); g_assert(response); =20 if (!recurse) { @@ -71,15 +71,15 @@ static void test_properties(const char *path, bool recu= rse) if (is_child || is_link) { child_path =3D g_strdup_printf("%s/%s", path, qdict_get_str(tuple, "name"= )); - test_properties(child_path, is_child); + test_properties(qts, child_path, is_child); g_free(child_path); } else { const char *prop =3D qdict_get_str(tuple, "name"); g_test_message("Testing property %s.%s", path, prop); - tmp =3D qmp("{ 'execute': 'qom-get'," - " 'arguments': { 'path': %s," - " 'property': %s } }", - path, prop); + tmp =3D qtest_qmp(qts, + "{ 'execute': 'qom-get'," + " 'arguments': { 'path': %s, 'property': %s }= }", + path, prop); /* qom-get may fail but should not, e.g., segfault. */ g_assert(tmp); qobject_unref(tmp); @@ -91,20 +91,18 @@ static void test_properties(const char *path, bool recu= rse) static void test_machine(gconstpointer data) { const char *machine =3D data; - char *args; QDict *response; + QTestState *qts; =20 - args =3D g_strdup_printf("-machine %s", machine); - qtest_start(args); + qts =3D qtest_initf("-machine %s", machine); =20 - test_properties("/machine", true); + test_properties(qts, "/machine", true); =20 - response =3D qmp("{ 'execute': 'quit' }"); + response =3D qtest_qmp(qts, "{ 'execute': 'quit' }"); g_assert(qdict_haskey(response, "return")); qobject_unref(response); =20 - qtest_end(); - g_free(args); + qtest_quit(qts); g_free((void *)machine); } =20 --=20 2.21.0