mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-22 23:36:30 +00:00
lib/drmtest: clean up children in an exit handler
Also be a bit more careful with killing them in general. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
1978aecf1d
commit
9fb316a6db
@ -967,8 +967,10 @@ static void fork_helper_exit_handler(int sig)
|
|||||||
/* Someone forgot to fill up the array? */
|
/* Someone forgot to fill up the array? */
|
||||||
assert(pid != 0);
|
assert(pid != 0);
|
||||||
|
|
||||||
kill(pid, SIGQUIT);
|
assert(kill(pid, SIGQUIT) == 0);
|
||||||
waitpid(pid, &status, 0);
|
while (waitpid(pid, &status, 0) == -1 &&
|
||||||
|
errno == -EINTR)
|
||||||
|
;
|
||||||
helper_process_count--;
|
helper_process_count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1023,7 +1025,7 @@ void igt_stop_helper(struct igt_helper_process *proc)
|
|||||||
|
|
||||||
assert(proc->running);
|
assert(proc->running);
|
||||||
|
|
||||||
kill(proc->pid, SIGQUIT);
|
assert(kill(proc->pid, SIGQUIT) == 0);
|
||||||
waitpid(proc->pid, &status, 0);
|
waitpid(proc->pid, &status, 0);
|
||||||
|
|
||||||
proc->running = false;
|
proc->running = false;
|
||||||
@ -1032,11 +1034,29 @@ void igt_stop_helper(struct igt_helper_process *proc)
|
|||||||
helper_process_count--;
|
helper_process_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void children_exit_handler(int sig)
|
||||||
|
{
|
||||||
|
assert(!test_child);
|
||||||
|
|
||||||
|
for (int nc = 0; nc < num_test_children; nc++) {
|
||||||
|
int status = -1;
|
||||||
|
assert(kill(test_children[nc], SIGQUIT) == 0);
|
||||||
|
|
||||||
|
while (waitpid(test_children[nc], &status, 0) == -1 &&
|
||||||
|
errno == -EINTR)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_test_children = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool __igt_fork(void)
|
bool __igt_fork(void)
|
||||||
{
|
{
|
||||||
assert(!test_with_subtests || in_subtest);
|
assert(!test_with_subtests || in_subtest);
|
||||||
assert(!test_child);
|
assert(!test_child);
|
||||||
|
|
||||||
|
igt_install_exit_handler(children_exit_handler);
|
||||||
|
|
||||||
if (num_test_children >= test_children_sz) {
|
if (num_test_children >= test_children_sz) {
|
||||||
if (!test_children_sz)
|
if (!test_children_sz)
|
||||||
test_children_sz = 4;
|
test_children_sz = 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user