testsuite/xeno-test: do not swallow exit status anymore
PATCH 1/1 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.
--- testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
testsuite/xeno-test/xeno-test-run.c +15 -1
@@ -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); }
Signature · 1 line
2.19.1
Jan Kiszka
AppliedQuoted 45 lines · Henning Schild via Xenomai
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 <[email protected]>--- testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)testsuite/xeno-test/xeno-test-run.c +14
-0@@ -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" ); + } } }
testsuite/xeno-test/xeno-test-run.c int main(int argc, char *argv[]) · line 678
Quoted 6 lines
testsuite/xeno-test/xeno-test-run.c +1
-1@@ -660,5 +674,5 @@ int main(int argc, char *argv[])signal (sigexit,SIG_DFL );raise (sigexit); } -exit (EXIT_SUCCESS ); +exit (exit_global); }
Merged to next.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Am Fri, 16 Nov 2018 07:28:51 +0100
schrieb Jan Kiszka <[email protected]>:
Quoted 45 lines · Henning Schild via Xenomai
Quoted 44 lines
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 <[email protected]>--- testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/testsuite/xeno-test/xeno-test-run.cindexbfede63fd..6d1bb96c0100644 ---a/testsuite/xeno-test/xeno-test-run.c
+++b/testsuite/xeno-test/xeno-test-run.c(quoted diff) +0
-0@@ -51,6 +51,8 @@ void handle_checked_child(struct child *child,
fd_set*fds); voidhandle_script_child(struct child *child, fd_set *fds); voidhandle_load_child(struct child *child, fd_set *fds);testsuite/xeno-test/xeno-test-run.c +14
-0+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" ); + } } }
Quoted 10 lines
testsuite/xeno-test/xeno-test-run.c int main(int argc, char *argv[]) · line 678
Quoted 8 lines
testsuite/xeno-test/xeno-test-run.c +1
-1@@ -660,5 +674,5 @@ int main(int argc, char *argv[])signal (sigexit,SIG_DFL );raise (sigexit); } -exit (EXIT_SUCCESS ); +exit (exit_global); }Merged to next.
With author "via Xenomai", i will always include a "From:" from now on. But should be something to double-check before merging.
Henning
Quoted 3 lines
Thanks,
Jan
Quoted 59 lines · Henning Schild
Am Fri, 16 Nov 2018 07:28:51 +0100
schrieb Jan Kiszka <[email protected]>:Quoted 45 lines · Henning Schild via Xenomai
Quoted 44 lines
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 <[email protected]>--- testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/testsuite/xeno-test/xeno-test-run.cindexbfede63fd..6d1bb96c0100644 ---a/testsuite/xeno-test/xeno-test-run.c
+++b/testsuite/xeno-test/xeno-test-run.c(quoted diff) +0
-0@@ -51,6 +51,8 @@ void handle_checked_child(struct child *child,
fd_set*fds); voidhandle_script_child(struct child *child, fd_set *fds); voidhandle_load_child(struct child *child, fd_set *fds);testsuite/xeno-test/xeno-test-run.c +14
-0+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" ); + } } }Quoted 10 lines
testsuite/xeno-test/xeno-test-run.c int main(int argc, char *argv[]) · line 678
Quoted 8 lines
testsuite/xeno-test/xeno-test-run.c +1
-1@@ -660,5 +674,5 @@ int main(int argc, char *argv[])signal (sigexit,SIG_DFL );raise (sigexit); } -exit (EXIT_SUCCESS ); +exit (exit_global); }Merged to next.
Quoted 3 lines
With author "via Xenomai", i will always include a "From:" from now on. But should be something to double-check before merging.
Hmpf, yeah, missed that.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux