qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, dgibson@redhat.com, thuth@redhat.com,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] tests: use qtest_pc_boot()/qtest_pc_shutdown() in virtio tests
Date: Fri, 30 Sep 2016 12:29:02 +0200	[thread overview]
Message-ID: <20160930122902.6f391a50@bahia> (raw)
In-Reply-To: <fd54082a-b875-870c-4d45-d4bb1caad78f@redhat.com>

On Fri, 30 Sep 2016 11:13:33 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> On 30/09/2016 10:33, Greg Kurz wrote:
> > On Thu, 29 Sep 2016 19:15:05 +0200
> > Laurent Vivier <lvivier@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

  reply	other threads:[~2016-09-30 10:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 17:15 [Qemu-devel] [PATCH 0/3] tests: enable virtio tests on SPAPR Laurent Vivier
2016-09-29 17:15 ` [Qemu-devel] [PATCH 1/3] tests: use qtest_pc_boot()/qtest_pc_shutdown() in virtio tests Laurent Vivier
2016-09-30  1:27   ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-30  6:56     ` Laurent Vivier
2016-09-30  8:33   ` [Qemu-devel] " Greg Kurz
2016-09-30  9:13     ` Laurent Vivier
2016-09-30 10:29       ` Greg Kurz [this message]
2016-09-30 10:33         ` Laurent Vivier
2016-09-30  9:56     ` Laurent Vivier
2016-09-30 10:34       ` Greg Kurz
2016-09-29 17:15 ` [Qemu-devel] [PATCH 2/3] qtest: evaluate endianness of the target in qtest_init() Laurent Vivier
2016-09-30  1:29   ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-29 17:15 ` [Qemu-devel] [PATCH 3/3] tests: enable virtio tests on SPAPR Laurent Vivier
2016-09-30  1:30   ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-30  6:59     ` Laurent Vivier
2016-09-30  9:06       ` David Gibson
2016-09-30 10:18   ` [Qemu-devel] " Greg Kurz
2016-09-30 10:30     ` Laurent Vivier
2016-09-30 10:52       ` Greg Kurz
2016-09-30 15:19       ` John Snow
2016-10-01 12:14         ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160930122902.6f391a50@bahia \
    --to=groug@kaod.org \
    --cc=dgibson@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).