qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH v2 2/1] libqtest: add more exit status checks
Date: Thu, 24 May 2018 19:01:13 +0300

On Thu, May 24, 2018 at 05:54:37PM +0200, Thomas Huth wrote:
> On 24.05.2018 17:38, Michael S. Tsirkin wrote:
> > Add more checks on how did QEMU exit.
> > 
> > Legal ways to exit right now:
> > - exit(0) or return from main
> > - kill(SIGTERM) - sent by testing infrastructure
> > 
> > Signed-off-by: Michael S. Tsirkin <address@hidden>
> > ---
> > 
> > Changes from v1:
> > - drop SIGTERM as suggested by Eric
> > 
> >  tests/libqtest.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/tests/libqtest.c b/tests/libqtest.c
> > index f869854..0576874 100644
> > --- a/tests/libqtest.c
> > +++ b/tests/libqtest.c
> > @@ -110,7 +110,12 @@ static void kill_qemu(QTestState *s)
> >          pid = waitpid(s->qemu_pid, &wstatus, 0);
> >  
> >          if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) {
> 
> Since we're only waiting for one pid ... wouldn't it be better to do
> 
>  assert(pid == s->qemu_pid)
> 
> instead?
> 
> > +            /* Core dump is never OK */
> >              assert(!WCOREDUMP(wstatus));
> > +            /* Must exit normally */
> > +            assert(WIFEXITED(wstatus));
> 
> So you asserted that WIFEXITED(wstatus) != 0 here ...
> 
> > +            /* If exited normally - check exit status */
> > +            assert(!WIFEXITED(wstatus) || !WEXITSTATUS(wstatus));
> 
> So "!WIFEXITED(wstatus)" is always 0 here? That's confusing...?
> 
>  Thomas

It will allow adding more conditions if we ever need to though.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]