Commit 6084e1d0 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm/static/xids00: print more information about errors (v2)

v2: typo fix
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1a3fc94c
...@@ -13,7 +13,7 @@ const char *test_author = "Pavel Emelianov <xemul@parallels.com>"; ...@@ -13,7 +13,7 @@ const char *test_author = "Pavel Emelianov <xemul@parallels.com>";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int tmp_pipe[2]; int tmp_pipe[2], i;
int pids[2], syncfd[2], stat, fail = 0; int pids[2], syncfd[2], stat, fail = 0;
test_init(argc, argv); test_init(argc, argv);
...@@ -83,9 +83,14 @@ int main(int argc, char **argv) ...@@ -83,9 +83,14 @@ int main(int argc, char **argv)
exit(2); exit(2);
kill(pid, SIGTERM); kill(pid, SIGTERM);
wait(&stat); if (waitpid(pid, &stat, 0) < 0) {
if (!WIFEXITED(stat) || WEXITSTATUS(stat)) err("Unable to wait P2 %d", pid);
exit(3); exit(3);
} else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
err("P2 stat %d/%d/%d/%d", WIFEXITED(stat), WEXITSTATUS(stat),
WIFSIGNALED(stat), WTERMSIG(stat));
exit(3);
}
exit(0); exit(0);
} }
...@@ -100,17 +105,18 @@ int main(int argc, char **argv) ...@@ -100,17 +105,18 @@ int main(int argc, char **argv)
test_daemon(); test_daemon();
test_waitsig(); test_waitsig();
kill(pids[0], SIGTERM); for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++)
wait(&stat); kill(pids[i], SIGTERM);
if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
test_msg("P1 stat %d/%d\n", WIFEXITED(stat), WEXITSTATUS(stat)); for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) {
fail = 1; if (waitpid(pids[i], &stat, 0) < 0) {
} err("Unable to wait %d", pids[i]);
kill(pids[1], SIGTERM); fail = 1;
wait(&stat); } else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
if (!WIFEXITED(stat) || WEXITSTATUS(stat)) { err("P%d stat %d/%d/%d/%d", i, WIFEXITED(stat), WEXITSTATUS(stat),
test_msg("P1 stat %d/%d\n", WIFEXITED(stat), WEXITSTATUS(stat)); WIFSIGNALED(stat), WTERMSIG(stat));
fail = 1; fail = 1;
}
} }
if (fail) if (fail)
......
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