[{"id":1766632,"web_url":"http://patchwork.ozlabs.org/comment/1766632/","msgid":"<b583b7ea-42e3-cf4b-10aa-7cc16f41356e@redhat.com>","list_archive_url":null,"date":"2017-09-12T00:20:38","subject":"Re: [Qemu-devel] [PATCH v7 18/38] ahci-test: Drop dependence on\n\tglobal_qtest","submitter":{"id":64343,"url":"http://patchwork.ozlabs.org/api/people/64343/","name":"John Snow","email":"jsnow@redhat.com"},"content":"On 09/11/2017 01:20 PM, Eric Blake wrote:\n> Managing parallel connections to two different monitors via\n> the implicit global_qtest makes it hard to copy-and-paste code\n> to tests that are not aware of the implicit state; the\n> management of global_qtest is even harder to follow because\n> it was masked behind set_context().\n> \n> Instead, explicitly pass QTestState* around (generally, by\n> reusing the member already present in ahci->parent QOSState),\n> and call explicit qtest_* functions on all places that\n> interact with a monitor.\n> \n> We can assert that the conversion is correct by checking that\n> global_qtest remains NULL throughout the test (a later patch\n> that changes global_qtest to not be a public global variable\n> will drop the assertions).\n> \n> Bonus: there was one spots that was creating a needless temporary\n> variable to execute the 'cont' command, rather than just directly\n> passing the literal command through qtest_qmp().  Fixing that\n> gets us one step closer to enabling -Wformat checking on\n> constructed JSON.\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n\nstill LGTM, you can probably still see why I was a little iffy about\nmaking the global qstate ubiquitous instead of doing it this way.\n\n(Though it does make the calls a little more verbose, they are IMO a lot\neasier to reason about in tests that deal with mixed-state and\nmigrations and so on, which -- most of my qtest experience was from AHCI\n-- there is a lot of here. (Sorry Markus, I'm a\n\nReviewed-by: John Snow <jsnow@redhat.com>","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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.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 3xrlp20ccHz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 10:21:12 +1000 (AEST)","from localhost ([::1]:32924 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 1drYwv-0007DJ-3o\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 20:21:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33687)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1drYwa-0007Aw-5j\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 20:20:49 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1drYwZ-000474-DI\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 20:20:48 -0400","from mx1.redhat.com ([209.132.183.28]:41214)\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 1drYwS-000436-Vi; Mon, 11 Sep 2017 20:20:41 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 ADABEC04B310;\n\tTue, 12 Sep 2017 00:20:39 +0000 (UTC)","from [10.18.17.231] (dhcp-17-231.bos.redhat.com [10.18.17.231])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 00B556EE48;\n\tTue, 12 Sep 2017 00:20:38 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com ADABEC04B310","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170911172022.4738-1-eblake@redhat.com>\n\t<20170911172022.4738-19-eblake@redhat.com>","From":"John Snow <jsnow@redhat.com>","Message-ID":"<b583b7ea-42e3-cf4b-10aa-7cc16f41356e@redhat.com>","Date":"Mon, 11 Sep 2017 20:20:38 -0400","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":"<20170911172022.4738-19-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.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tTue, 12 Sep 2017 00:20:39 +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 v7 18/38] ahci-test: Drop dependence on\n\tglobal_qtest","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":"pbonzini@redhat.com, thuth@redhat.com, armbru@redhat.com,\n\t\"open list:IDE\" <qemu-block@nongnu.org>","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":1766633,"web_url":"http://patchwork.ozlabs.org/comment/1766633/","msgid":"<abb11f66-2b9e-0dc5-5641-dc9f8b1ae4e9@redhat.com>","list_archive_url":null,"date":"2017-09-12T00:21:35","subject":"Re: [Qemu-devel] [PATCH v7 18/38] ahci-test: Drop dependence on\n\tglobal_qtest","submitter":{"id":64343,"url":"http://patchwork.ozlabs.org/api/people/64343/","name":"John Snow","email":"jsnow@redhat.com"},"content":"On 09/11/2017 08:20 PM, John Snow wrote:\n> \n> \n> On 09/11/2017 01:20 PM, Eric Blake wrote:\n>> Managing parallel connections to two different monitors via\n>> the implicit global_qtest makes it hard to copy-and-paste code\n>> to tests that are not aware of the implicit state; the\n>> management of global_qtest is even harder to follow because\n>> it was masked behind set_context().\n>>\n>> Instead, explicitly pass QTestState* around (generally, by\n>> reusing the member already present in ahci->parent QOSState),\n>> and call explicit qtest_* functions on all places that\n>> interact with a monitor.\n>>\n>> We can assert that the conversion is correct by checking that\n>> global_qtest remains NULL throughout the test (a later patch\n>> that changes global_qtest to not be a public global variable\n>> will drop the assertions).\n>>\n>> Bonus: there was one spots that was creating a needless temporary\n>> variable to execute the 'cont' command, rather than just directly\n>> passing the literal command through qtest_qmp().  Fixing that\n>> gets us one step closer to enabling -Wformat checking on\n>> constructed JSON.\n>>\n>> Signed-off-by: Eric Blake <eblake@redhat.com>\n> \n> still LGTM, you can probably still see why I was a little iffy about\n> making the global qstate ubiquitous instead of doing it this way.\n> \n> (Though it does make the calls a little more verbose, they are IMO a lot\n> easier to reason about in tests that deal with mixed-state and\n> migrations and so on, which -- most of my qtest experience was from AHCI\n> -- there is a lot of here. (Sorry Markus, I'm a\nlol! I hit send too soon, I tabbed away to look for Markus' previous\nemail which used some German term to refer to people who preferred\nexplicit state.\n\nI wound up not finding it and then getting distracted.\n\nEnjoy.","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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.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 3xrlqP3pgpz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 10:22:25 +1000 (AEST)","from localhost ([::1]:32929 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 1drYy7-0008AE-NI\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 20:22:23 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:34094)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1drYxV-0007oQ-Lp\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 20:21:46 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1drYxU-0004e0-O9\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 20:21:45 -0400","from mx1.redhat.com ([209.132.183.28]:42636)\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 1drYxO-0004XN-FL; Mon, 11 Sep 2017 20:21:38 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\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 8EAF3C0D8D55;\n\tTue, 12 Sep 2017 00:21:37 +0000 (UTC)","from [10.18.17.231] (dhcp-17-231.bos.redhat.com [10.18.17.231])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 5488369FA5;\n\tTue, 12 Sep 2017 00:21:36 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 8EAF3C0D8D55","From":"John Snow <jsnow@redhat.com>","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170911172022.4738-1-eblake@redhat.com>\n\t<20170911172022.4738-19-eblake@redhat.com>\n\t<b583b7ea-42e3-cf4b-10aa-7cc16f41356e@redhat.com>","Message-ID":"<abb11f66-2b9e-0dc5-5641-dc9f8b1ae4e9@redhat.com>","Date":"Mon, 11 Sep 2017 20:21:35 -0400","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":"<b583b7ea-42e3-cf4b-10aa-7cc16f41356e@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.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tTue, 12 Sep 2017 00:21:37 +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 v7 18/38] ahci-test: Drop dependence on\n\tglobal_qtest","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":"pbonzini@redhat.com, thuth@redhat.com, armbru@redhat.com,\n\t\"open list:IDE\" <qemu-block@nongnu.org>","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>"}}]