[{"id":1762031,"web_url":"http://patchwork.ozlabs.org/comment/1762031/","msgid":"<ff87af52-2137-072d-525e-4f293da89c16@redhat.com>","list_archive_url":null,"date":"2017-09-01T23:16:47","subject":"Re: [Qemu-devel] [PATCH v6 28/29] libqtest: Remove qtest_start()\n\tand qtest_end() shortcuts","submitter":{"id":64343,"url":"http://patchwork.ozlabs.org/api/people/64343/","name":"John Snow","email":"jsnow@redhat.com"},"content":"On 09/01/2017 02:03 PM, Eric Blake wrote:\n> Remove the trivial wrappers qtest_start() and qtest_end(), to make\n> it obvious in the rest of the testsuite where we are still relying on\n> global_qtest.  Doing this makes it easier to see what remaining\n> cleanups will be needed if we don't want an implicit dependency\n> on global state.  Many tests can also take advantage of qtest_init()\n> doing formatting of args, avoiding a temporary local variable.\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n\nReviewed-by: John Snow <jsnow@redhat.com>\n\ndiffstat looks like a win overall, unless it's just a local minima ;)","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jsnow@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkZsQ2rMVz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 09:17:44 +1000 (AEST)","from localhost ([::1]:38053 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnvBx-0007zZ-8H\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 19:17:37 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:32812)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnvBO-0007xP-VS\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 19:17:03 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnvBN-00064Q-VZ\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 19:17:02 -0400","from mx1.redhat.com ([209.132.183.28]:53518)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jsnow@redhat.com>)\n\tid 1dnvBI-0005yt-7B; Fri, 01 Sep 2017 19:16:56 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id F1F872DDB9;\n\tFri,  1 Sep 2017 23:16:54 +0000 (UTC)","from [10.18.17.130] (dhcp-17-130.bos.redhat.com [10.18.17.130])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id BF8E67C14E;\n\tFri,  1 Sep 2017 23:16:47 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com F1F872DDB9","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-29-eblake@redhat.com>","From":"John Snow <jsnow@redhat.com>","Message-ID":"<ff87af52-2137-072d-525e-4f293da89c16@redhat.com>","Date":"Fri, 1 Sep 2017 19:16:47 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-29-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tFri, 01 Sep 2017 23:16:55 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v6 28/29] libqtest: Remove qtest_start()\n\tand qtest_end() shortcuts","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Thomas Huth <thuth@redhat.com>,\n\t\"open list:Floppy\" <qemu-block@nongnu.org>, Ben Warren\n\t<ben@skyportsystems.com>, Amit Shah <amit@kernel.org>, Jason Wang\n\t<jasowang@redhat.com>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\tarmbru@redhat.com, Alexander Graf <agraf@suse.de>,\n\tKeith Busch <keith.busch@intel.com>, \"open list:sPAPR\"\n\t<qemu-ppc@nongnu.org>, Gerd Hoffmann <kraxel@redhat.com>, Stefan\n\tHajnoczi <stefanha@redhat.com>, pbonzini@redhat.com, =?utf-8?q?Andrea?=\n\t=?utf-8?b?cyBGw6RyYmVy?= <afaerber@suse.de>,\n\t\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>, David Gibson\n\t<david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1763344,"web_url":"http://patchwork.ozlabs.org/comment/1763344/","msgid":"<c04242da-f026-3cc1-7359-a78065a63946@redhat.com>","list_archive_url":null,"date":"2017-09-05T13:06:16","subject":"Re: [Qemu-devel] [PATCH v6 28/29] libqtest: Remove qtest_start()\n\tand qtest_end() shortcuts","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 01.09.2017 20:03, Eric Blake wrote:\n> Remove the trivial wrappers qtest_start() and qtest_end(), to make\n> it obvious in the rest of the testsuite where we are still relying on\n> global_qtest.  Doing this makes it easier to see what remaining\n> cleanups will be needed if we don't want an implicit dependency\n> on global state.  Many tests can also take advantage of qtest_init()\n> doing formatting of args, avoiding a temporary local variable.\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n> ---\n>  tests/libqtest.h               | 26 ------------------\n>  tests/libqtest.c               |  4 +--\n>  tests/ac97-test.c              |  4 +--\n>  tests/boot-order-test.c        | 11 +++-----\n>  tests/boot-serial-test.c       | 12 +++------\n>  tests/device-introspect-test.c | 24 ++++++++---------\n>  tests/display-vga-test.c       | 18 +++++--------\n>  tests/drive_del-test.c         | 17 ++++++------\n>  tests/ds1338-test.c            |  2 +-\n>  tests/e1000-test.c             | 10 ++-----\n>  tests/e1000e-test.c            | 14 +++-------\n>  tests/eepro100-test.c          | 11 ++------\n>  tests/endianness-test.c        | 33 +++++++++--------------\n>  tests/es1370-test.c            |  4 +--\n>  tests/fdc-test.c               |  4 +--\n>  tests/hd-geo-test.c            | 16 +++++------\n>  tests/i440fx-test.c            | 16 +++++------\n>  tests/i82801b11-test.c         |  5 ++--\n>  tests/ide-test.c               |  4 +--\n>  tests/intel-hda-test.c         | 11 ++++----\n>  tests/ioh3420-test.c           |  7 ++---\n>  tests/ipmi-bt-test.c           | 11 +++-----\n>  tests/ipmi-kcs-test.c          |  5 +---\n>  tests/ipoctal232-test.c        |  5 ++--\n>  tests/ivshmem-test.c           |  4 +--\n>  tests/libqos/libqos.c          |  2 +-\n>  tests/m25p80-test.c            |  9 +++----\n>  tests/m48t59-test.c            |  2 +-\n>  tests/ne2000-test.c            |  4 +--\n>  tests/numa-test.c              | 28 ++++++++++----------\n>  tests/nvme-test.c              |  7 ++---\n>  tests/pc-cpu-test.c            | 26 +++++++-----------\n>  tests/pcnet-test.c             |  4 +--\n>  tests/pnv-xscom-test.c         | 14 ++--------\n>  tests/prom-env-test.c          | 13 ++++-----\n>  tests/pvpanic-test.c           |  4 +--\n>  tests/pxe-test.c               | 14 ++++------\n>  tests/q35-test.c               |  8 +++---\n>  tests/qom-test.c               |  7 ++---\n>  tests/rtc-test.c               |  2 +-\n>  tests/rtl8139-test.c           |  4 +--\n>  tests/spapr-phb-test.c         |  5 ++--\n>  tests/tco-test.c               | 12 ++++-----\n>  tests/test-arm-mptimer.c       |  4 +--\n>  tests/test-filter-mirror.c     | 16 +++++------\n>  tests/test-filter-redirector.c | 60 ++++++++++++++++++++----------------------\n>  tests/test-hmp.c               |  7 ++---\n>  tests/test-netfilter.c         |  9 +++----\n>  tests/test-x86-cpuid-compat.c  | 13 ++++-----\n>  tests/tmp105-test.c            |  2 +-\n>  tests/tpci200-test.c           |  4 +--\n>  tests/usb-hcd-ehci-test.c      | 25 +++++++++---------\n>  tests/usb-hcd-ohci-test.c      |  4 +--\n>  tests/usb-hcd-xhci-test.c      |  4 +--\n>  tests/virtio-balloon-test.c    |  4 +--\n>  tests/virtio-blk-test.c        | 13 ++++-----\n>  tests/virtio-console-test.c    |  8 +++---\n>  tests/virtio-net-test.c        |  4 +--\n>  tests/virtio-rng-test.c        |  4 +--\n>  tests/virtio-serial-test.c     |  4 +--\n>  tests/vmgenid-test.c           | 29 ++++++--------------\n>  tests/vmxnet3-test.c           |  4 +--\n>  62 files changed, 267 insertions(+), 394 deletions(-)\n> \n> diff --git a/tests/libqtest.h b/tests/libqtest.h\n> index d338de3e22..0459526187 100644\n> --- a/tests/libqtest.h\n> +++ b/tests/libqtest.h\n> @@ -509,32 +509,6 @@ void qtest_add_data_func_full(const char *str, void *data,\n>  void qtest_add_abrt_handler(GHookFunc fn, const void *data);\n> \n>  /**\n> - * qtest_start:\n> - * @args: other arguments to pass to QEMU\n> - *\n> - * Start QEMU and assign the resulting #QTestState to a global variable.\n> - * The global variable is used by \"shortcut\" functions documented below.\n> - *\n> - * Returns: #QTestState instance.\n> - */\n> -static inline QTestState *qtest_start(const char *args)\n> -{\n> -    global_qtest = qtest_init(\"%s\", args);\n> -    return global_qtest;\n> -}\n> -\n> -/**\n> - * qtest_end:\n> - *\n> - * Shut down the QEMU process started by qtest_start().\n> - */\n> -static inline void qtest_end(void)\n> -{\n> -    qtest_quit(global_qtest);\n> -    global_qtest = NULL;\n> -}\n> -\n> -/**\n>   * qmp:\n>   * @fmt...: QMP message to send to qemu\n>   *\n> diff --git a/tests/libqtest.c b/tests/libqtest.c\n> index 18facbf130..fa4e47c137 100644\n> --- a/tests/libqtest.c\n> +++ b/tests/libqtest.c\n> @@ -970,7 +970,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine))\n>      QString *qstr;\n>      const char *mname;\n> \n> -    qtest_start(\"-machine none\");\n> +    global_qtest = qtest_init(\"-machine none\");\n>      response = qmp(\"{ 'execute': 'query-machines' }\");\n>      g_assert(response);\n>      list = qdict_get_qlist(response, \"return\");\n> @@ -987,6 +987,6 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine))\n>          cb(mname);\n>      }\n> \n> -    qtest_end();\n> +    qtest_quit(global_qtest);\n>      QDECREF(response);\n>  }\n[...]\n\nMaybe this patch could be postponed 'till we can completely remove\nglobal_qtest? Otherwise you've got to change these lines over and over\nagain...\n\n Thomas","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=208.118.235.17; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [208.118.235.17])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmn7f6K30z9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 23:07:41 +1000 (AEST)","from localhost ([::1]:58829 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dpDZp-0003DL-O8\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 09:07:37 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:40822)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpDZJ-0003Ck-Qq\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 09:07:16 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpDZE-0003T6-Du\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 09:07:05 -0400","from mx1.redhat.com ([209.132.183.28]:49266)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>)\n\tid 1dpDYw-0003G8-E8; Tue, 05 Sep 2017 09:06:42 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 7280472FC3;\n\tTue,  5 Sep 2017 13:06:41 +0000 (UTC)","from [10.36.116.114] (ovpn-116-114.ams2.redhat.com [10.36.116.114])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 8250A84D7C;\n\tTue,  5 Sep 2017 13:06:18 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 7280472FC3","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-29-eblake@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<c04242da-f026-3cc1-7359-a78065a63946@redhat.com>","Date":"Tue, 5 Sep 2017 15:06:16 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-29-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tTue, 05 Sep 2017 13:06:41 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v6 28/29] libqtest: Remove qtest_start()\n\tand qtest_end() shortcuts","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"\"open list:Floppy\" <qemu-block@nongnu.org>, Ben Warren\n\t<ben@skyportsystems.com>, Amit Shah <amit@kernel.org>, Jason Wang\n\t<jasowang@redhat.com>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n\tarmbru@redhat.com, Alexander Graf <agraf@suse.de>,\n\tKeith Busch <keith.busch@intel.com>, \"open list:sPAPR\"\n\t<qemu-ppc@nongnu.org>, Gerd Hoffmann <kraxel@redhat.com>, Stefan\n\tHajnoczi <stefanha@redhat.com>, pbonzini@redhat.com, John Snow\n\t<jsnow@redhat.com>, =?utf-8?q?Andreas_F=C3=A4rber?= <afaerber@suse.de>,\n\t\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>, David Gibson\n\t<david@gibson.dropbear.id.au>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]