Commit 4f64c11a authored by Henning Schild via Xenomai's avatar Henning Schild via Xenomai Committed by Jan Kiszka

testsuite/xeno-test: do not swallow exit status anymore

xeno-test-run always returned SUCCESS, even if its children exited with
non zero. So xeno-test can not be used programmatically i.e. in CI.

This patch adds some more verbosity and makes xeno-test-run exit FAILURE
if at least one child returned non-zero.
Signed-off-by: Henning Schild's avatarHenning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 69cda2e3
......@@ -51,6 +51,8 @@ void handle_checked_child(struct child *child, fd_set *fds);
void handle_script_child(struct child *child, fd_set *fds);
void handle_load_child(struct child *child, fd_set *fds);
static int exit_global = EXIT_SUCCESS;
static inline time_t mono_time(void)
{
struct timespec ts;
......@@ -319,6 +321,18 @@ void sigchld_handler(int sig)
child->exit_status = status;
child->dead = 1;
fprintf(stderr, "child %d returned: ", pid);
if (WIFEXITED(status)) {
if (WEXITSTATUS(status))
exit_global = EXIT_FAILURE;
fprintf(stderr, "exited with status %d\n",
WEXITSTATUS(status));
} else if WIFSIGNALED(status) {
fprintf(stderr, "killed by signal %d\n",
WTERMSIG(status));
} else {
fprintf(stderr, "unknown reason\n");
}
}
}
......@@ -660,5 +674,5 @@ int main(int argc, char *argv[])
signal(sigexit, SIG_DFL);
raise(sigexit);
}
exit(EXIT_SUCCESS);
exit(exit_global);
}
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