On Fri, 30 Sep 2016 11:13:33 +0200 Laurent Vivier <lviv...@redhat.com> wrote:
> On 30/09/2016 10:33, Greg Kurz wrote: > > On Thu, 29 Sep 2016 19:15:05 +0200 > > Laurent Vivier <lviv...@redhat.com> 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