Received: from eggs.gnu.org ([2001:4830:134:3::10]:49170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpv8c-0007ZO-Lz for qemu-devel@nongnu.org; Fri, 30 Sep 2016 06:33:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpv8Y-0001kU-Mk for qemu-devel@nongnu.org; Fri, 30 Sep 2016 06:33:54 -0400 References: <1475169307-1510-1-git-send-email-lvivier@redhat.com> <1475169307-1510-2-git-send-email-lvivier@redhat.com> <20160930103341.3b2bee36@bahia> <20160930122902.6f391a50@bahia> From: Laurent Vivier Message-ID: <78779f31-9b79-6d1f-c062-a9730ff4aecb@redhat.com> Date: Fri, 30 Sep 2016 12:33:46 +0200 MIME-Version: 1.0 In-Reply-To: <20160930122902.6f391a50@bahia> Content-Type: text/plain; charset=utf-8 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: Greg Kurz Cc: qemu-devel@nongnu.org, dgibson@redhat.com, thuth@redhat.com, qemu-ppc@nongnu.org On 30/09/2016 12:29, Greg Kurz wrote: > 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. You're right it looks better as you say. I'm going to change that. Thanks, Laurent