Message-ID: <5213E453.6020304@xenomai.org> Date: Tue, 20 Aug 2013 23:49:07 +0200 From: Gilles Chanteperdrix MIME-Version: 1.0 References: <521364EF.8050006@siemens.com> <5213B23C.6000507@xenomai.org> In-Reply-To: <5213B23C.6000507@xenomai.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai] xeno-regression-test returns SUCCESS when Xenomai not available List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gernot Hillier Cc: xenomai@xenomai.org On 08/20/2013 08:15 PM, Gilles Chanteperdrix wrote: > On 08/20/2013 02:45 PM, Gernot Hillier wrote: >> 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 > > 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: diff --git a/src/testsuite/xeno-test/xeno-test-run.c b/src/testsuite/xeno-test/xeno-test-run.c index 12d3df4..ce02284 100644 --- a/src/testsuite/xeno-test/xeno-test-run.c +++ b/src/testsuite/xeno-test/xeno-test-run.c @@ -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); } -- Gilles.