mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
Wait for any pid in order to reap failure quicker
When waiting for the forked tests, we can respond quicker to a failure (such as oom) by waiting for any child to exit rather than waiting for each child in order. Then when we see that a test failed, we can kill all other children before aborting. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
3777d42303
commit
f47ee31dd5
@ -925,32 +925,52 @@ bool __igt_fork(void)
|
|||||||
*/
|
*/
|
||||||
void igt_waitchildren(void)
|
void igt_waitchildren(void)
|
||||||
{
|
{
|
||||||
|
int err = 0;
|
||||||
|
int count;
|
||||||
|
|
||||||
assert(!test_child);
|
assert(!test_child);
|
||||||
|
|
||||||
for (int nc = 0; nc < num_test_children; nc++) {
|
count = 0;
|
||||||
|
while (count < num_test_children) {
|
||||||
int status = -1;
|
int status = -1;
|
||||||
while (waitpid(test_children[nc], &status, 0) == -1 &&
|
pid_t pid;
|
||||||
errno == EINTR)
|
int c;
|
||||||
;
|
|
||||||
|
|
||||||
if (status != 0) {
|
pid = wait(&status);
|
||||||
|
if (pid == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (c = 0; c < num_test_children; c++)
|
||||||
|
if (pid == test_children[c])
|
||||||
|
break;
|
||||||
|
if (c == num_test_children)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (err == 0 && status != 0) {
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
printf("child %i failed with exit status %i\n",
|
printf("child %i failed with exit status %i\n",
|
||||||
nc, WEXITSTATUS(status));
|
c, WEXITSTATUS(status));
|
||||||
igt_fail(WEXITSTATUS(status));
|
err = WEXITSTATUS(status);
|
||||||
} else if (WIFSIGNALED(status)) {
|
} else if (WIFSIGNALED(status)) {
|
||||||
printf("child %i died with signal %i, %s\n",
|
printf("child %i died with signal %i, %s\n",
|
||||||
nc, WTERMSIG(status),
|
c, WTERMSIG(status),
|
||||||
strsignal(WTERMSIG(status)));
|
strsignal(WTERMSIG(status)));
|
||||||
igt_fail(99);
|
err = 128 + WTERMSIG(status);
|
||||||
} else {
|
} else {
|
||||||
printf("Unhandled failure in child %i\n", nc);
|
printf("Unhandled failure [%d] in child %i\n", status, c);
|
||||||
abort();
|
err = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (c = 0; c < num_test_children; c++)
|
||||||
|
kill(test_children[c], SIGKILL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_test_children = 0;
|
num_test_children = 0;
|
||||||
|
if (err)
|
||||||
|
igt_fail(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exit handler code */
|
/* exit handler code */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user