Commit db1a0d30 authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

zdtm: exit a test if the "root" process died

Each test has a process which controls other processes and
if it dies the other processes have to be killed.

travis-ci: success for zdtm: exit a test if the "root" process died
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 3bdcd52f
...@@ -344,8 +344,22 @@ int ns_init(int argc, char **argv) ...@@ -344,8 +344,22 @@ int ns_init(int argc, char **argv)
ret = 0; ret = 0;
if (reap) { if (reap) {
while (ret != -1) while (true) {
ret = wait(NULL); pid_t child;
ret = -1;
child = waitpid(-1, &ret, 0);
if (child < 0) {
fprintf(stderr, "Unable to wait a test process: %m");
exit(1);
}
if (child == pid) {
fprintf(stderr, "The test returned 0x%x", ret);
exit(!(ret == 0));
}
if (ret)
fprintf(stderr, "The %d process exited with 0x%x", child, ret);
}
} else { } else {
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
} }
......
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