From nobody Thu Apr 25 20:06:48 2024 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544115114270526.905121404748; Thu, 6 Dec 2018 08:51:54 -0800 (PST) Received: from localhost ([::1]:41946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwsJ-0005sJ-VP for importer@patchew.org; Thu, 06 Dec 2018 11:51:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwqq-0005GH-6u for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUwql-0007V5-Ls for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53520) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUwql-0007UE-6D for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:07 -0500 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 786C9307D990 for ; Thu, 6 Dec 2018 16:50:06 +0000 (UTC) Received: from thuth.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B0201001F5B; Thu, 6 Dec 2018 16:50:04 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 6 Dec 2018 17:49:54 +0100 Message-Id: <1544114998-1513-2-git-send-email-thuth@redhat.com> In-Reply-To: <1544114998-1513-1-git-send-email-thuth@redhat.com> References: <1544114998-1513-1-git-send-email-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.48]); Thu, 06 Dec 2018 16:50:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 1/5] tests/boot-serial: Get rid of global_qtest variable 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 , Paolo Bonzini 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 test does not use any of the functions that require global_qtest, so we can simply get rid of this global variable here. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- tests/boot-serial-test.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index 8ec6aed..f085165 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -161,6 +161,7 @@ static void test_machine(const void *data) char codetmp[] =3D "/tmp/qtest-boot-serial-cXXXXXX"; const char *codeparam =3D ""; const uint8_t *code =3D NULL; + QTestState *qts; int ser_fd; =20 ser_fd =3D mkstemp(serialtmp); @@ -189,11 +190,11 @@ static void test_machine(const void *data) * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - global_qtest =3D qtest_initf("%s %s -M %s,accel=3Dtcg:kvm " - "-chardev file,id=3Dserial0,path=3D%s " - "-no-shutdown -serial chardev:serial0 %s", - codeparam, code ? codetmp : "", - test->machine, serialtmp, test->extra); + qts =3D qtest_initf("%s %s -M %s,accel=3Dtcg:kvm -no-shutdown " + "-chardev file,id=3Dserial0,path=3D%s " + " -serial chardev:serial0 %s", + codeparam, code ? codetmp : "", test->machine, + serialtmp, test->extra); if (code) { unlink(codetmp); } @@ -204,7 +205,7 @@ static void test_machine(const void *data) } unlink(serialtmp); =20 - qtest_quit(global_qtest); + qtest_quit(qts); =20 close(ser_fd); } --=20 1.8.3.1 From nobody Thu Apr 25 20:06:48 2024 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544115239680204.61730069751854; Thu, 6 Dec 2018 08:53:59 -0800 (PST) Received: from localhost ([::1]:41954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwuT-0007fo-Uu for importer@patchew.org; Thu, 06 Dec 2018 11:53:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwqq-0005GJ-6y for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUwqn-0007ZM-RJ for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUwqn-0007XX-ID for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:09 -0500 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 DCA2513AA4 for ; Thu, 6 Dec 2018 16:50:08 +0000 (UTC) Received: from thuth.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA60E1001F5B; Thu, 6 Dec 2018 16:50:06 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 6 Dec 2018 17:49:55 +0100 Message-Id: <1544114998-1513-3-git-send-email-thuth@redhat.com> In-Reply-To: <1544114998-1513-1-git-send-email-thuth@redhat.com> References: <1544114998-1513-1-git-send-email-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.29]); Thu, 06 Dec 2018 16:50:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 2/5] tests/test-filter: Make tests independent of global_qtest 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 , Paolo Bonzini 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" Apart from using qmp() in the qmp_discard_response() macro, these tests do not have any dependencies to the global_qtest variable, so we can simply get rid of it here by replacing the qmp() with qtest_qmp() in the macro. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- tests/test-filter-mirror.c | 9 +++++---- tests/test-filter-redirector.c | 16 +++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/test-filter-mirror.c b/tests/test-filter-mirror.c index d15917e..7ab2aed 100644 --- a/tests/test-filter-mirror.c +++ b/tests/test-filter-mirror.c @@ -17,7 +17,7 @@ #include "qemu/main-loop.h" =20 /* TODO actually test the results and get rid of this */ -#define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) +#define qmp_discard_response(qs, ...) qobject_unref(qtest_qmp(qs, __VA_ARG= S__)) =20 static void test_mirror(void) { @@ -29,6 +29,7 @@ static void test_mirror(void) uint32_t size =3D sizeof(send_buf); size =3D htonl(size); const char *devstr =3D "e1000"; + QTestState *qts; =20 if (g_str_equal(qtest_get_arch(), "s390x")) { devstr =3D "virtio-net-ccw"; @@ -40,7 +41,7 @@ static void test_mirror(void) ret =3D mkstemp(sock_path); g_assert_cmpint(ret, !=3D, -1); =20 - global_qtest =3D qtest_initf( + qts =3D qtest_initf( "-netdev socket,id=3Dqtest-bn0,fd=3D%d " "-device %s,netdev=3Dqtest-bn0,id=3Dqtest-e0 " "-chardev socket,id=3Dmirror0,path=3D%s,server,nowait " @@ -61,7 +62,7 @@ static void test_mirror(void) }; =20 /* send a qmp command to guarantee that 'connected' is setting to true= . */ - qmp_discard_response("{ 'execute' : 'query-status'}"); + qmp_discard_response(qts, "{ 'execute' : 'query-status'}"); ret =3D iov_send(send_sock[0], iov, 2, 0, sizeof(size) + sizeof(send_b= uf)); g_assert_cmpint(ret, =3D=3D, sizeof(send_buf) + sizeof(size)); close(send_sock[0]); @@ -78,6 +79,7 @@ static void test_mirror(void) g_free(recv_buf); close(recv_sock); unlink(sock_path); + qtest_quit(qts); } =20 int main(int argc, char **argv) @@ -88,7 +90,6 @@ int main(int argc, char **argv) =20 qtest_add_func("/netfilter/mirror", test_mirror); ret =3D g_test_run(); - qtest_end(); =20 return ret; } diff --git a/tests/test-filter-redirector.c b/tests/test-filter-redirector.c index 615ff5c..9ca9fea 100644 --- a/tests/test-filter-redirector.c +++ b/tests/test-filter-redirector.c @@ -59,7 +59,7 @@ #include "qemu/main-loop.h" =20 /* TODO actually test the results and get rid of this */ -#define qmp_discard_response(...) qobject_unref(qmp(__VA_ARGS__)) +#define qmp_discard_response(qs, ...) qobject_unref(qtest_qmp(qs, __VA_ARG= S__)) =20 static const char *get_devstr(void) { @@ -81,6 +81,7 @@ static void test_redirector_tx(void) char *recv_buf; uint32_t size =3D sizeof(send_buf); size =3D htonl(size); + QTestState *qts; =20 ret =3D socketpair(PF_UNIX, SOCK_STREAM, 0, backend_sock); g_assert_cmpint(ret, !=3D, -1); @@ -90,7 +91,7 @@ static void test_redirector_tx(void) ret =3D mkstemp(sock_path1); g_assert_cmpint(ret, !=3D, -1); =20 - global_qtest =3D qtest_initf( + qts =3D qtest_initf( "-netdev socket,id=3Dqtest-bn0,fd=3D%d " "-device %s,netdev=3Dqtest-bn0,id=3Dqtest-e0 " "-chardev socket,id=3Dredirector0,path=3D%s,server,nowait " @@ -108,7 +109,7 @@ static void test_redirector_tx(void) g_assert_cmpint(recv_sock, !=3D, -1); =20 /* send a qmp command to guarantee that 'connected' is setting to true= . */ - qmp_discard_response("{ 'execute' : 'query-status'}"); + qmp_discard_response(qts, "{ 'execute' : 'query-status'}"); =20 struct iovec iov[] =3D { { @@ -137,7 +138,7 @@ static void test_redirector_tx(void) close(recv_sock); unlink(sock_path0); unlink(sock_path1); - qtest_end(); + qtest_quit(qts); } =20 static void test_redirector_rx(void) @@ -150,6 +151,7 @@ static void test_redirector_rx(void) char *recv_buf; uint32_t size =3D sizeof(send_buf); size =3D htonl(size); + QTestState *qts; =20 ret =3D socketpair(PF_UNIX, SOCK_STREAM, 0, backend_sock); g_assert_cmpint(ret, !=3D, -1); @@ -159,7 +161,7 @@ static void test_redirector_rx(void) ret =3D mkstemp(sock_path1); g_assert_cmpint(ret, !=3D, -1); =20 - global_qtest =3D qtest_initf( + qts =3D qtest_initf( "-netdev socket,id=3Dqtest-bn0,fd=3D%d " "-device %s,netdev=3Dqtest-bn0,id=3Dqtest-e0 " "-chardev socket,id=3Dredirector0,path=3D%s,server,nowait " @@ -186,7 +188,7 @@ static void test_redirector_rx(void) send_sock =3D unix_connect(sock_path1, NULL); g_assert_cmpint(send_sock, !=3D, -1); /* send a qmp command to guarantee that 'connected' is setting to true= . */ - qmp_discard_response("{ 'execute' : 'query-status'}"); + qmp_discard_response(qts, "{ 'execute' : 'query-status'}"); =20 ret =3D iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf)= ); g_assert_cmpint(ret, =3D=3D, sizeof(send_buf) + sizeof(size)); @@ -204,7 +206,7 @@ static void test_redirector_rx(void) g_free(recv_buf); unlink(sock_path0); unlink(sock_path1); - qtest_end(); + qtest_quit(qts); } =20 int main(int argc, char **argv) --=20 1.8.3.1 From nobody Thu Apr 25 20:06:48 2024 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544115324728358.4767185955569; Thu, 6 Dec 2018 08:55:24 -0800 (PST) Received: from localhost ([::1]:41962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwvq-0001kR-TD for importer@patchew.org; Thu, 06 Dec 2018 11:55:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwqr-0005H6-5s for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUwqq-0007cB-6W for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUwqp-0007bO-TV for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:12 -0500 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 32B25300251E for ; Thu, 6 Dec 2018 16:50:11 +0000 (UTC) Received: from thuth.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64B4C1001F5B; Thu, 6 Dec 2018 16:50:09 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 6 Dec 2018 17:49:56 +0100 Message-Id: <1544114998-1513-4-git-send-email-thuth@redhat.com> In-Reply-To: <1544114998-1513-1-git-send-email-thuth@redhat.com> References: <1544114998-1513-1-git-send-email-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.45]); Thu, 06 Dec 2018 16:50:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 3/5] tests/machine-none: Make test independent of global_qtest 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 , Paolo Bonzini 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" Apart from using qmp() in one spot, this test does not have any dependencies to the global_qtest variable, so we can simply get rid of it here by replacing the qmp() with qtest_qmp(). Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- tests/machine-none-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c index 2b3b750..4c6d470 100644 --- a/tests/machine-none-test.c +++ b/tests/machine-none-test.c @@ -75,6 +75,7 @@ static void test_machine_cpu_cli(void) QDict *response; const char *arch =3D qtest_get_arch(); const char *cpu_model =3D get_cpu_model_by_arch(arch); + QTestState *qts; =20 if (!cpu_model) { if (!(!strcmp(arch, "microblaze") || !strcmp(arch, "microblazeel")= )) { @@ -83,13 +84,13 @@ static void test_machine_cpu_cli(void) } return; /* TODO: die here to force all targets have a test */ } - global_qtest =3D qtest_initf("-machine none -cpu '%s'", cpu_model); + qts =3D qtest_initf("-machine none -cpu '%s'", cpu_model); =20 - response =3D qmp("{ 'execute': 'quit' }"); + response =3D qtest_qmp(qts, "{ 'execute': 'quit' }"); g_assert(qdict_haskey(response, "return")); qobject_unref(response); =20 - qtest_quit(global_qtest); + qtest_quit(qts); } =20 int main(int argc, char **argv) --=20 1.8.3.1 From nobody Thu Apr 25 20:06:48 2024 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544115397756155.2119448312867; Thu, 6 Dec 2018 08:56:37 -0800 (PST) Received: from localhost ([::1]:41969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwwy-0005RX-0L for importer@patchew.org; Thu, 06 Dec 2018 11:56:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwqt-0005IA-9b for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUwqs-0007eE-DX for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUwqs-0007da-7Q for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:14 -0500 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 7A672307DAB4 for ; Thu, 6 Dec 2018 16:50:13 +0000 (UTC) Received: from thuth.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD2E21001F5B; Thu, 6 Dec 2018 16:50:11 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 6 Dec 2018 17:49:57 +0100 Message-Id: <1544114998-1513-5-git-send-email-thuth@redhat.com> In-Reply-To: <1544114998-1513-1-git-send-email-thuth@redhat.com> References: <1544114998-1513-1-git-send-email-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.42]); Thu, 06 Dec 2018 16:50:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 4/5] tests/prom-env: Make test independent of global_qtest 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 , Paolo Bonzini 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" global_qtest is only needed here for one readl(). Let's replace it with qtest_readl() and we can remove the global_qtest variable here. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- tests/prom-env-test.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c index 198d007..4821254 100644 --- a/tests/prom-env-test.c +++ b/tests/prom-env-test.c @@ -25,14 +25,14 @@ #define MAGIC 0xcafec0de #define ADDRESS 0x4000 =20 -static void check_guest_memory(void) +static void check_guest_memory(QTestState *qts) { uint32_t signature; int i; =20 /* Poll until code has run and modified memory. Wait at most 600 secon= ds */ for (i =3D 0; i < 60000; ++i) { - signature =3D readl(ADDRESS); + signature =3D qtest_readl(qts, ADDRESS); if (signature =3D=3D MAGIC) { break; } @@ -45,17 +45,16 @@ static void check_guest_memory(void) static void test_machine(const void *machine) { const char *extra_args; + QTestState *qts; =20 /* The pseries firmware boots much faster without the default devices = */ extra_args =3D strcmp(machine, "pseries") =3D=3D 0 ? "-nodefaults" : "= "; =20 - global_qtest =3D qtest_initf("-M %s,accel=3Dtcg %s " - "-prom-env 'use-nvramrc?=3Dtrue' " - "-prom-env 'nvramrc=3D%x %x l!' ", - (const char *)machine, extra_args, - MAGIC, ADDRESS); - check_guest_memory(); - qtest_quit(global_qtest); + qts =3D qtest_initf("-M %s,accel=3Dtcg %s -prom-env 'use-nvramrc?=3Dtr= ue' " + "-prom-env 'nvramrc=3D%x %x l!' ", (const char *)mac= hine, + extra_args, MAGIC, ADDRESS); + check_guest_memory(qts); + qtest_quit(qts); } =20 static void add_tests(const char *machines[]) --=20 1.8.3.1 From nobody Thu Apr 25 20:06:48 2024 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1544115240027729.4911408495836; Thu, 6 Dec 2018 08:54:00 -0800 (PST) Received: from localhost ([::1]:41955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwuU-0007ft-Bn for importer@patchew.org; Thu, 06 Dec 2018 11:53:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwqv-0005IX-I0 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUwqu-0007fT-O7 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52388) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUwqu-0007ez-H3 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 11:50:16 -0500 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 DF0B12D7E4 for ; Thu, 6 Dec 2018 16:50:15 +0000 (UTC) Received: from thuth.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067E0104C53B; Thu, 6 Dec 2018 16:50:13 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 6 Dec 2018 17:49:58 +0100 Message-Id: <1544114998-1513-6-git-send-email-thuth@redhat.com> In-Reply-To: <1544114998-1513-1-git-send-email-thuth@redhat.com> References: <1544114998-1513-1-git-send-email-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.30]); Thu, 06 Dec 2018 16:50:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 5/5] tests/pxe: Make test independent from global_qtest 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 , Paolo Bonzini 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" global_qtest is not really required here, since boot_sector_test() is already independent from that global variable. Signed-off-by: Thomas Huth Reviewed-by: Eric Blake --- tests/pxe-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/pxe-test.c b/tests/pxe-test.c index 6e36796..73ac1d1 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -61,6 +61,7 @@ static testdef_t s390x_tests[] =3D { =20 static void test_pxe_one(const testdef_t *test, bool ipv6) { + QTestState *qts; char *args; =20 args =3D g_strdup_printf( @@ -70,9 +71,9 @@ static void test_pxe_one(const testdef_t *test, bool ipv6) test->machine, disk, ipv6 ? "off" : "on", ipv6 ? "on" : "off", test->model); =20 - qtest_start(args); - boot_sector_test(global_qtest); - qtest_quit(global_qtest); + qts =3D qtest_init(args); + boot_sector_test(qts); + qtest_quit(qts); g_free(args); } =20 --=20 1.8.3.1