Commit a4038d38 authored by Daniel Vetter's avatar Daniel Vetter

lib/drmtest: make signal process cleanup more robust

If we skip a test and and fail somewhere the parent might die before the
child. So add some cleanup to handle this case. Also make sure that the
parent indeed waits for the child to die.

This is required to make the latest version of the piglit runner happy,
it tends to wait for all zombies to disappear.
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <>
parent 740065f0
......@@ -625,11 +625,18 @@ static void sig_handler(int i)
static void signal_helper_exit_handler(int sig)
void drmtest_fork_signal_helper(void)
pid_t pid;
sighandler_t oldsig;
signal(SIGUSR1, sig_handler);
oldsig = signal(SIGQUIT, SIG_DFL);
pid = fork();
......@@ -644,8 +651,12 @@ void drmtest_fork_signal_helper(void)
void drmtest_stop_signal_helper(void)
if (signal_helper != -1)
int exitcode;
if (signal_helper != -1) {
kill(signal_helper, SIGQUIT);
if (sig_stat)
fprintf(stdout, "signal handler called %llu times\n", sig_stat);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment