xeno-regression-test returns SUCCESS when Xenomai not available
Hi there!
I'm currently working on an automatic test environment for Xenomai
kernels. Sometimes, Xenomai integration into my kernel fails completely and I expected this to be detected in a xeno-regression-test run - however:
root@localhost:~# xeno-regression-test && echo Worked. Started child 28231: /bin/bash /usr/lib/xenomai/testsuite/xeno-test-run-wrapper /usr/bin/xeno-regression-test ++ echo 0 /usr/bin/xeno-regression-test: line 38: /proc/xenomai/latency: No such file or directory ++ : ++ /usr/lib/xenomai/testsuite/arith Xenomai: /dev/rtheap is missing (chardev, major=10 minor=254) Worked.
Looking into xeno-test-run.c, I see that a dead script child is not causing an error exit of xeno-test-run in handle_script_child().
Is there any special reason for that behaviour or could we just add a comparable EXIT_FAILURE branch as in handle_checked_child(), something like
testsuite/xeno-test/xeno-test-run.c 2013-08-20 13:10:12.739924212 +0200 renamed from testsuite/xeno-test/xeno-test-run.c.orig 2013-08-20 10:10:04.452067093 +0200 +7 -0
@@ -420,7 +418,14 @@ void handle_script_child(struct child *c int rc; if (child->dead) { + int status = child->exit_status; child_cleanup(child); + if (WIFEXITED(status)) { + fail_fprintf(stderr, + "child %d exited with status %d\n", + child->pid, WEXITSTATUS(status)); + exit(EXIT_FAILURE); + } return; }
However, as I didn't really get the concept yet how script and checked clients work together, I'm not sure whether this is the right way to fix(?) that behaviour.
Signature · 5 lines
With kind regards, Gernot Hillier Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 19 lines · Gernot Hillier
Hi there!
I'm currently working on an automatic test environment for Xenomai kernels. Sometimes, Xenomai integration into my kernel fails completely and I expected this to be detected in a xeno-regression-test run - however:
root@localhost:~# xeno-regression-test && echo Worked. Started child 28231: /bin/bash /usr/lib/xenomai/testsuite/xeno-test-run-wrapper /usr/bin/xeno-regression-test ++ echo 0 /usr/bin/xeno-regression-test: line 38: /proc/xenomai/latency: No such file or directory ++ : ++ /usr/lib/xenomai/testsuite/arith Xenomai: /dev/rtheap is missing (chardev, major=10 minor=254) Worked.
Quoted 6 lines
Looking into
xeno-test-run.c, I see that a dead script child is not causing an error exit of xeno-test-run inhandle_script_child().Is there any special reason for that behaviour or could we just add a comparable
EXIT_FAILUREbranch as inhandle_checked_child(), something like
No, some piece is missing, but we can not exit right away, we have to send a SIGTERM to all children, then return to the main loop which will wait a bit, then send a SIGKILL if children are not answering, then finally exit. And we have to take note somewhere of the child exit status to call exit with the same exit status. Will send a patch shortly.
Signature · 1 line
Gilles.
Quoted 27 lines · Gilles Chanteperdrix
Quoted 19 lines · Gernot Hillier
Hi there!
I'm currently working on an automatic test environment for Xenomai kernels. Sometimes, Xenomai integration into my kernel fails completely and I expected this to be detected in a xeno-regression-test run - however:
root@localhost:~# xeno-regression-test && echo Worked. Started child 28231: /bin/bash /usr/lib/xenomai/testsuite/xeno-test-run-wrapper /usr/bin/xeno-regression-test ++ echo 0 /usr/bin/xeno-regression-test: line 38: /proc/xenomai/latency: No such file or directory ++ : ++ /usr/lib/xenomai/testsuite/arith Xenomai: /dev/rtheap is missing (chardev, major=10 minor=254) Worked.Quoted 6 lines
Looking into
xeno-test-run.c, I see that a dead script child is not causing an error exit of xeno-test-run inhandle_script_child().Is there any special reason for that behaviour or could we just add a comparable
EXIT_FAILUREbranch as inhandle_checked_child(), something like
Quoted 7 lines
No, some piece is missing, but we can not exit right away, we have to send a SIGTERM to all children, then return to the main loop which will wait a bit, then send a SIGKILL if children are not answering, then finally exit. And we have to take note somewhere of the child exit status to call exit with the same exit status. Will send a patch shortly.
Please try the following patch:
src/testsuite/xeno-test/xeno-test-run.c +8 -1
@@ -46,6 +46,7 @@ static char default_loadcmd[] = "dohell 900";static char *loadcmd = default_loadcmd;static fd_set inputs;static struct child script, load; +static int script_exit_status =EXIT_SUCCESS ;void handle_checked_child (struct child *child,fd_set *fds);void handle_script_child (struct child *child,fd_set *fds);
@@ -417,7 +418,13 @@ void handle_script_child(struct child *child, fd_set *fds)int rc;if (child->dead) { +int status = child->exit_status;child_cleanup (child); +if (WIFEXITED (status)) { + script_exit_status =WEXITSTATUS (status); +children_kill (CHILD_ANY ,SIGTERM ); + sigexit_start = termload_start =mono_time (); + }return ; }
@@ -664,5 +671,5 @@ int main(int argc, char *argv[])signal (sigexit,SIG_DFL );raise (sigexit); } -exit (EXIT_SUCCESS ); +exit (script_exit_status); }
Signature · 1 line
Gilles.
Hi!
Am 20.08.2013 23:49, schrieb Gilles Chanteperdrix:
Quoted 36 lines · Gilles Chanteperdrix
Quoted 27 lines · Gernot Hillier
Quoted 19 lines
Hi there!
I'm currently working on an automatic test environment for Xenomai kernels. Sometimes, Xenomai integration into my kernel fails completely and I expected this to be detected in a xeno-regression-test run - however:
root@localhost:~# xeno-regression-test && echo Worked. Started child 28231: /bin/bash /usr/lib/xenomai/testsuite/xeno-test-run-wrapper /usr/bin/xeno-regression-test ++ echo 0 /usr/bin/xeno-regression-test: line 38: /proc/xenomai/latency: No such file or directory ++ : ++ /usr/lib/xenomai/testsuite/arith Xenomai: /dev/rtheap is missing (chardev, major=10 minor=254) Worked.Quoted 6 lines
Looking into
xeno-test-run.c, I see that a dead script child is not causing an error exit of xeno-test-run inhandle_script_child().Is there any special reason for that behaviour or could we just add a comparable
EXIT_FAILUREbranch as inhandle_checked_child(), something likeQuoted 7 lines
No, some piece is missing, but we can not exit right away, we have to send a SIGTERM to all children, then return to the main loop which will wait a bit, then send a SIGKILL if children are not answering, then finally exit. And we have to take note somewhere of the child exit status to call exit with the same exit status. Will send a patch shortly.
Quoted 1 line
Please try the following patch:
[...]
Seems to work perfectly for my use case. Thanks!!
Signature · 5 lines
Regards, Gernot Hillier Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux
Quoted 5 lines · Gernot Hillier
Hi there!
I'm currently working on an automatic test environment for Xenomai kernels. Sometimes, Xenomai integration into my kernel fails completely and I expected this to be detected in a xeno-regression-test run - however:
You might want to use:
http://git.xenomai.org/?p=mkrootfs.git;a=summary
Which verifies at compilation time that the kernel has Xenomai enabled if the Xenomai user-space package is enabled. I use this tool to build rootfses for Xenomai system on ARM and x86 systems and I believe Philippe uses it also. It is not as feature-rich or package-rich as alternatives such as buildroot, ptxdist, openembedded, but it has some unique features which are more adapted to a (Xenomai ?) developer usage.
Signature · 1 line
Gilles.