From patchwork Thu Dec 6 16:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10716389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D12D71923 for ; Thu, 6 Dec 2018 16:51:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2CFD2F0FC for ; Thu, 6 Dec 2018 16:51:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C14952F14D; Thu, 6 Dec 2018 16:51:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 679B92F0FC for ; Thu, 6 Dec 2018 16:51:19 +0000 (UTC) Received: from localhost ([::1]:41946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwru-0005sJ-H1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 11:51:18 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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[] = "/tmp/qtest-boot-serial-cXXXXXX"; const char *codeparam = ""; const uint8_t *code = NULL; + QTestState *qts; int ser_fd; ser_fd = 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 = qtest_initf("%s %s -M %s,accel=tcg:kvm " - "-chardev file,id=serial0,path=%s " - "-no-shutdown -serial chardev:serial0 %s", - codeparam, code ? codetmp : "", - test->machine, serialtmp, test->extra); + qts = qtest_initf("%s %s -M %s,accel=tcg:kvm -no-shutdown " + "-chardev file,id=serial0,path=%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); - qtest_quit(global_qtest); + qtest_quit(qts); close(ser_fd); } From patchwork Thu Dec 6 16:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10716401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5B6F13BF for ; Thu, 6 Dec 2018 16:53:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 963A12F1AB for ; Thu, 6 Dec 2018 16:53:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A5602F1D0; Thu, 6 Dec 2018 16:53:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04C3C2F1AB for ; Thu, 6 Dec 2018 16:53:34 +0000 (UTC) Received: from localhost ([::1]:41954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwu6-0007fo-6E for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 11:53:34 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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" /* 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_ARGS__)) static void test_mirror(void) { @@ -29,6 +29,7 @@ static void test_mirror(void) uint32_t size = sizeof(send_buf); size = htonl(size); const char *devstr = "e1000"; + QTestState *qts; if (g_str_equal(qtest_get_arch(), "s390x")) { devstr = "virtio-net-ccw"; @@ -40,7 +41,7 @@ static void test_mirror(void) ret = mkstemp(sock_path); g_assert_cmpint(ret, !=, -1); - global_qtest = qtest_initf( + qts = qtest_initf( "-netdev socket,id=qtest-bn0,fd=%d " "-device %s,netdev=qtest-bn0,id=qtest-e0 " "-chardev socket,id=mirror0,path=%s,server,nowait " @@ -61,7 +62,7 @@ static void test_mirror(void) }; /* 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 = iov_send(send_sock[0], iov, 2, 0, sizeof(size) + sizeof(send_buf)); g_assert_cmpint(ret, ==, 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); } int main(int argc, char **argv) @@ -88,7 +90,6 @@ int main(int argc, char **argv) qtest_add_func("/netfilter/mirror", test_mirror); ret = g_test_run(); - qtest_end(); 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" /* 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_ARGS__)) static const char *get_devstr(void) { @@ -81,6 +81,7 @@ static void test_redirector_tx(void) char *recv_buf; uint32_t size = sizeof(send_buf); size = htonl(size); + QTestState *qts; ret = socketpair(PF_UNIX, SOCK_STREAM, 0, backend_sock); g_assert_cmpint(ret, !=, -1); @@ -90,7 +91,7 @@ static void test_redirector_tx(void) ret = mkstemp(sock_path1); g_assert_cmpint(ret, !=, -1); - global_qtest = qtest_initf( + qts = qtest_initf( "-netdev socket,id=qtest-bn0,fd=%d " "-device %s,netdev=qtest-bn0,id=qtest-e0 " "-chardev socket,id=redirector0,path=%s,server,nowait " @@ -108,7 +109,7 @@ static void test_redirector_tx(void) g_assert_cmpint(recv_sock, !=, -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'}"); struct iovec iov[] = { { @@ -137,7 +138,7 @@ static void test_redirector_tx(void) close(recv_sock); unlink(sock_path0); unlink(sock_path1); - qtest_end(); + qtest_quit(qts); } static void test_redirector_rx(void) @@ -150,6 +151,7 @@ static void test_redirector_rx(void) char *recv_buf; uint32_t size = sizeof(send_buf); size = htonl(size); + QTestState *qts; ret = socketpair(PF_UNIX, SOCK_STREAM, 0, backend_sock); g_assert_cmpint(ret, !=, -1); @@ -159,7 +161,7 @@ static void test_redirector_rx(void) ret = mkstemp(sock_path1); g_assert_cmpint(ret, !=, -1); - global_qtest = qtest_initf( + qts = qtest_initf( "-netdev socket,id=qtest-bn0,fd=%d " "-device %s,netdev=qtest-bn0,id=qtest-e0 " "-chardev socket,id=redirector0,path=%s,server,nowait " @@ -186,7 +188,7 @@ static void test_redirector_rx(void) send_sock = unix_connect(sock_path1, NULL); g_assert_cmpint(send_sock, !=, -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'}"); ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf)); g_assert_cmpint(ret, ==, 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); } int main(int argc, char **argv) From patchwork Thu Dec 6 16:49:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10716405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20A9C13BF for ; Thu, 6 Dec 2018 16:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFA42F172 for ; Thu, 6 Dec 2018 16:55:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F009C2F165; Thu, 6 Dec 2018 16:55:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 995FB2F165 for ; Thu, 6 Dec 2018 16:55:08 +0000 (UTC) Received: from localhost ([::1]:41962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwvb-0001kR-Uf for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 11:55:07 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 = qtest_get_arch(); const char *cpu_model = get_cpu_model_by_arch(arch); + QTestState *qts; 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 = qtest_initf("-machine none -cpu '%s'", cpu_model); + qts = qtest_initf("-machine none -cpu '%s'", cpu_model); - response = qmp("{ 'execute': 'quit' }"); + response = qtest_qmp(qts, "{ 'execute': 'quit' }"); g_assert(qdict_haskey(response, "return")); qobject_unref(response); - qtest_quit(global_qtest); + qtest_quit(qts); } int main(int argc, char **argv) From patchwork Thu Dec 6 16:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10716407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99DEC13BF for ; Thu, 6 Dec 2018 16:56:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A04D2F17B for ; Thu, 6 Dec 2018 16:56:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D9D22F18D; Thu, 6 Dec 2018 16:56:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 311062F17B for ; Thu, 6 Dec 2018 16:56:19 +0000 (UTC) Received: from localhost ([::1]:41969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwwk-0005RX-3N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 11:56:18 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 -static void check_guest_memory(void) +static void check_guest_memory(QTestState *qts) { uint32_t signature; int i; /* Poll until code has run and modified memory. Wait at most 600 seconds */ for (i = 0; i < 60000; ++i) { - signature = readl(ADDRESS); + signature = qtest_readl(qts, ADDRESS); if (signature == 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; /* The pseries firmware boots much faster without the default devices */ extra_args = strcmp(machine, "pseries") == 0 ? "-nodefaults" : ""; - global_qtest = qtest_initf("-M %s,accel=tcg %s " - "-prom-env 'use-nvramrc?=true' " - "-prom-env 'nvramrc=%x %x l!' ", - (const char *)machine, extra_args, - MAGIC, ADDRESS); - check_guest_memory(); - qtest_quit(global_qtest); + qts = qtest_initf("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " + "-prom-env 'nvramrc=%x %x l!' ", (const char *)machine, + extra_args, MAGIC, ADDRESS); + check_guest_memory(qts); + qtest_quit(qts); } static void add_tests(const char *machines[]) From patchwork Thu Dec 6 16:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10716403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 133B017DB for ; Thu, 6 Dec 2018 16:53:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01CD129BD6 for ; Thu, 6 Dec 2018 16:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA13E2F090; Thu, 6 Dec 2018 16:53:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A267329BD6 for ; Thu, 6 Dec 2018 16:53:37 +0000 (UTC) Received: from localhost ([::1]:41955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUwu8-0007ft-Oq for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 11:53:36 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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[] = { static void test_pxe_one(const testdef_t *test, bool ipv6) { + QTestState *qts; char *args; args = 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); - qtest_start(args); - boot_sector_test(global_qtest); - qtest_quit(global_qtest); + qts = qtest_init(args); + boot_sector_test(qts); + qtest_quit(qts); g_free(args); }