Module: xenomai-2.6
Branch: master
Commit: eec1abe036dfbd18a262e564386fbe6bd8e34abf
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=eec1abe036dfbd18a262e564386fbe6bd8e34abf

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu Aug 22 21:09:24 2013 +0200

tests: get xeno-test to not always return EXIT_SUCCESS

---

 src/testsuite/xeno-test/xeno-test-run.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/testsuite/xeno-test/xeno-test-run.c 
b/src/testsuite/xeno-test/xeno-test-run.c
index 12d3df4..56e5ba6 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,18 @@ 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();
+               }
+               if (WIFSIGNALED(status)) {
+                       children_kill(CHILD_ANY, SIGTERM);
+                       sigexit_start = termload_start = mono_time();
+                       sigexit = WTERMSIG(status);
+               }       
                return;
        }
 
@@ -664,5 +676,5 @@ int main(int argc, char *argv[])
                signal(sigexit, SIG_DFL);
                raise(sigexit);
        }
-       exit(EXIT_SUCCESS);
+       exit(script_exit_status);
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to