* [PATCH] testsuite/xeno-test: do not swallow exit status anymore
@ 2018-11-08 12:42 Henning Schild
2018-11-16 6:28 ` Jan Kiszka
0 siblings, 1 reply; 4+ messages in thread
From: Henning Schild @ 2018-11-08 12:42 UTC (permalink / raw)
To: 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 <henning.schild@siemens.com>
---
testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/testsuite/xeno-test/xeno-test-run.c b/testsuite/xeno-test/xeno-test-run.c
index bfede63fd..6d1bb96c0 100644
--- a/testsuite/xeno-test/xeno-test-run.c
+++ b/testsuite/xeno-test/xeno-test-run.c
@@ -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);
}
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] testsuite/xeno-test: do not swallow exit status anymore
2018-11-08 12:42 [PATCH] testsuite/xeno-test: do not swallow exit status anymore Henning Schild
@ 2018-11-16 6:28 ` Jan Kiszka
2018-11-28 9:05 ` Henning Schild
0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2018-11-16 6:28 UTC (permalink / raw)
To: Henning Schild, xenomai
On 08.11.18 13:42, Henning Schild via Xenomai wrote:
> 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 <henning.schild@siemens.com>
> ---
> testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/testsuite/xeno-test/xeno-test-run.c b/testsuite/xeno-test/xeno-test-run.c
> index bfede63fd..6d1bb96c0 100644
> --- a/testsuite/xeno-test/xeno-test-run.c
> +++ b/testsuite/xeno-test/xeno-test-run.c
> @@ -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);
> }
>
Merged to next.
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] testsuite/xeno-test: do not swallow exit status anymore
2018-11-16 6:28 ` Jan Kiszka
@ 2018-11-28 9:05 ` Henning Schild
2018-11-28 9:10 ` Jan Kiszka
0 siblings, 1 reply; 4+ messages in thread
From: Henning Schild @ 2018-11-28 9:05 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Am Fri, 16 Nov 2018 07:28:51 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> On 08.11.18 13:42, Henning Schild via Xenomai wrote:
> > 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 <henning.schild@siemens.com>
> > ---
> > testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++-
> > 1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/testsuite/xeno-test/xeno-test-run.c
> > b/testsuite/xeno-test/xeno-test-run.c index bfede63fd..6d1bb96c0
> > 100644 --- a/testsuite/xeno-test/xeno-test-run.c
> > +++ b/testsuite/xeno-test/xeno-test-run.c
> > @@ -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);
> > }
> >
>
> 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
> Thanks,
> Jan
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] testsuite/xeno-test: do not swallow exit status anymore
2018-11-28 9:05 ` Henning Schild
@ 2018-11-28 9:10 ` Jan Kiszka
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2018-11-28 9:10 UTC (permalink / raw)
To: Henning Schild; +Cc: xenomai
On 28.11.18 10:05, Henning Schild wrote:
> Am Fri, 16 Nov 2018 07:28:51 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>
>> On 08.11.18 13:42, Henning Schild via Xenomai wrote:
>>> 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 <henning.schild@siemens.com>
>>> ---
>>> testsuite/xeno-test/xeno-test-run.c | 16 +++++++++++++++-
>>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/testsuite/xeno-test/xeno-test-run.c
>>> b/testsuite/xeno-test/xeno-test-run.c index bfede63fd..6d1bb96c0
>>> 100644 --- a/testsuite/xeno-test/xeno-test-run.c
>>> +++ b/testsuite/xeno-test/xeno-test-run.c
>>> @@ -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);
>>> }
>>>
>>
>> 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.
>
Hmpf, yeah, missed that.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-28 9:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 12:42 [PATCH] testsuite/xeno-test: do not swallow exit status anymore Henning Schild
2018-11-16 6:28 ` Jan Kiszka
2018-11-28 9:05 ` Henning Schild
2018-11-28 9:10 ` Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.