]> git.proxmox.com Git - qemu.git/commit
libqtest: Wait for the right child PID after killing QEMU
authorEduardo Habkost <ehabkost@redhat.com>
Mon, 28 Jan 2013 18:15:16 +0000 (16:15 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 1 Feb 2013 16:43:34 +0000 (10:43 -0600)
commit6bf0076643dac4f37cabb9233dc9170f1c2fdd49
treef95b26883084a5c60bc2730f40b1761834b47855
parent3e7b8f4e6f507e09e27b7449f3744596f19c0083
libqtest: Wait for the right child PID after killing QEMU

When running "make check" with gcov enabled, we get the following
message:

   hw/tmp105.gcda:cannot open data file, assuming not executed

The problem happens because:

 * tmp105-test exits before QEMU exits, because waitpid() at
   qtest_quit() fails;
 * waitpid() fails because there's another process already
   waiting for the QEMU process;
 * The process that is already waiting for QEMU is the child created by
   qtest_init() to run system();
 * qtest_quit() is incorrectly waiting for the QEMU PID directly instead
   of the child created by qtest_init().

This fixes the problem by sending SIGTERM to QEMU, but waiting for the
child process created by qtest_init() (that exits immediately after QEMU
exits).

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
tests/libqtest.c