From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpv4A-0003pt-Vx for qemu-devel@nongnu.org; Fri, 30 Sep 2016 06:29:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpv46-0000FL-01 for qemu-devel@nongnu.org; Fri, 30 Sep 2016 06:29:18 -0400 Received: from 9.mo177.mail-out.ovh.net ([46.105.72.238]:35926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpv45-0000F0-Qy for qemu-devel@nongnu.org; Fri, 30 Sep 2016 06:29:13 -0400 Received: from player779.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 04176FFA6BC for ; Fri, 30 Sep 2016 12:29:09 +0200 (CEST) Date: Fri, 30 Sep 2016 12:29:02 +0200 From: Greg Kurz Message-ID: <20160930122902.6f391a50@bahia> In-Reply-To: References: <1475169307-1510-1-git-send-email-lvivier@redhat.com> <1475169307-1510-2-git-send-email-lvivier@redhat.com> <20160930103341.3b2bee36@bahia> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] tests: use qtest_pc_boot()/qtest_pc_shutdown() in virtio tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: qemu-devel@nongnu.org, dgibson@redhat.com, thuth@redhat.com, qemu-ppc@nongnu.org On Fri, 30 Sep 2016 11:13:33 +0200 Laurent Vivier wrote: > On 30/09/2016 10:33, Greg Kurz wrote: > > On Thu, 29 Sep 2016 19:15:05 +0200 > > Laurent Vivier wrote: > > > >> [...] > >> static void pci_nop(void) > >> { > >> - qvirtio_9p_start(); > >> - qvirtio_9p_stop(); > >> + QOSState *qs; > >> + > >> + qs = qvirtio_9p_start(); > >> + g_assert(qs); > > > > The appropriate macro to use here is: g_assert_nonnull(). > > OK > > > > > BTW, how can qs be NULL ? > > we should not know what happens in qtest_pc_boot() (or > qtest_spapr_boot(), or qtest_XXX_boot()) > What is the point in letting qtest_XXX_boot() return NULL then if it is always followed by g_assert() in the test program code ? I'd rather move the assertion there and document that it cannot return NULL, since it is always unrecoverable in the test code. > So I think it i better to check it before to use it. > [...] > >> +static QOSState *pci_test_start(void) > >> { > >> - char *cmdline; > >> + QOSState *qs = NULL; > > > > Why setting qs to NULL ? It is necessarily set... > > Yes, I've mixed my patches: later we add a "if (arch == pc) { qs = } > else if (arch == spapr) { qs = }" and this case qs can be uninitialized. > Ok, I've realized that when reading the other patch. :) > [...] > >> + qtest_shutdown(qs); > > > > The title is "tests: use qtest_pc_boot()/qtest_pc_shutdown() in virtio tests" > > > > Even if qtest_shutdown() happens to be equivalent to qtest_pc_shutdown() when > > qtest_pc_boot() was called, I would rather stick to the title, and convert > > all qtest_pc_shutdown() to qtest_shutdown() in patch 3/3... > > > > No big deal though, you may s/qtest_pc_shutdown/qtest_shutdown in the title > > as well :) > > I'm to change all qtest_pc_shutdown() to qtest_shutdown() here > Ok. Cheers. -- Greg