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