|
From: | Thomas Huth |
Subject: | Re: [Qemu-devel] [PATCH v3 2/1] libqtest: add more exit status checks |
Date: | Thu, 24 May 2018 19:26:16 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 24.05.2018 18:11, 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 > > Anything else is illegal. [...] > - if (pid == s->qemu_pid && WIFSIGNALED(wstatus)) { > + /* waitpid returns child PID on success */ > + assert(pid == s->qemu_pid); > + > + /* If exited on signal - check the reason: core dump is never OK */ > + if (WIFSIGNALED(wstatus)) { > assert(!WCOREDUMP(wstatus)); > } > + /* If exited normally - check exit status */ > + if (WIFEXITED(wstatus)) { > + assert(!WEXITSTATUS(wstatus)); > + } > + /* Valid ways to exit: right now only return from main or exit */ > + assert(WIFEXITED(wstatus)); > } > } It's strange that you always get WIFEXITED(wstatus) == true here, even if QEMU has been terminated by SIGTERM? I assume that's due to the fact that QEMU intercepts SIGTERM and terminates via exit() instead? So I think you could simply replace the last three asserts with: assert(WIFEXITED(wstatus) && !WEXITSTATUS(wstatus)); Thomas
[Prev in Thread] | Current Thread | [Next in Thread] |