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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Sep 23 16:47:20 2012 +0200

testsuite: various fixes in xeno-test-run

---

 src/testsuite/xeno-test/Makefile.am     |    2 +-
 src/testsuite/xeno-test/Makefile.in     |    2 +-
 src/testsuite/xeno-test/xeno-test-run.c |   17 +++++++++++------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/testsuite/xeno-test/Makefile.am 
b/src/testsuite/xeno-test/Makefile.am
index 0e57de4..3abd8fc 100644
--- a/src/testsuite/xeno-test/Makefile.am
+++ b/src/testsuite/xeno-test/Makefile.am
@@ -4,7 +4,7 @@ test_SCRIPTS = xeno-test-run-wrapper dohell
 test_PROGRAMS = xeno-test-run
 bin_SCRIPTS = xeno-test
 
-xeno_test_run_CPPFLAGS = -DTESTDIR=\"$(testdir)\"
+xeno_test_run_CPPFLAGS = -DTESTDIR=\"$(testdir)\" -D_GNU_SOURCE
 xeno_test_run_LDADD = -lpthread -lrt
 
 xeno-test: $(srcdir)/xeno-test.in Makefile
diff --git a/src/testsuite/xeno-test/Makefile.in 
b/src/testsuite/xeno-test/Makefile.in
index 24b123f..28e7808 100644
--- a/src/testsuite/xeno-test/Makefile.in
+++ b/src/testsuite/xeno-test/Makefile.in
@@ -265,7 +265,7 @@ top_srcdir = @top_srcdir@
 testdir = @XENO_TEST_DIR@
 test_SCRIPTS = xeno-test-run-wrapper dohell
 bin_SCRIPTS = xeno-test
-xeno_test_run_CPPFLAGS = -DTESTDIR=\"$(testdir)\"
+xeno_test_run_CPPFLAGS = -DTESTDIR=\"$(testdir)\" -D_GNU_SOURCE
 xeno_test_run_LDADD = -lpthread -lrt
 EXTRA_DIST = $(test_SCRIPTS) xeno-test.in
 CLEANFILES = xeno-test
diff --git a/src/testsuite/xeno-test/xeno-test-run.c 
b/src/testsuite/xeno-test/xeno-test-run.c
index 2761d64..0caa2de 100644
--- a/src/testsuite/xeno-test/xeno-test-run.c
+++ b/src/testsuite/xeno-test/xeno-test-run.c
@@ -5,7 +5,8 @@
 #include <ctype.h>
 
 #include <sys/types.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <unistd.h>
 #include <signal.h>
 #include <sys/wait.h>
@@ -17,6 +18,8 @@
 #define CHILD_LOAD    2
 #define CHILD_ANY     -1
 
+#define TIMEOUT 30
+
 struct child {
        unsigned type: 2;
        unsigned dead: 1;
@@ -156,7 +159,7 @@ int child_initv(struct child *child, int type, char *argv[])
        }
 
        time(&child->timeout);
-       child->timeout += 300;
+       child->timeout += TIMEOUT * 60;
 
        switch(type) {
        case CHILD_CHECKED:
@@ -347,7 +350,7 @@ void handle_checked_child(struct child *child, fd_set *fds)
 
        if (FD_ISSET(child->out, fds)) {
                copy(child->out, STDOUT_FILENO);
-               child->timeout = now + 300;
+               child->timeout = now + TIMEOUT * 60;
        }
 
        if (child->dead) {
@@ -381,8 +384,8 @@ void handle_checked_child(struct child *child, fd_set *fds)
        }
 
        if (now > child->timeout) {
-               fail_fprintf(stderr, "child %d produced no output for 5 
minutes.\n",
-                          child->pid);
+               fail_fprintf(stderr, "child %d produced no output for %d 
minutes.\n",
+                            child->pid, TIMEOUT);
                exit(EXIT_FAILURE);
        }
 
@@ -404,7 +407,9 @@ void handle_script_child(struct child *child, fd_set *fds)
        if (!FD_ISSET(child->out, fds))
                return;
 
-       sz = read(child->out, buffer + pos, sizeof(buffer) - pos);
+       sz = read(child->out, buffer + pos, sizeof(buffer) - (pos + 1));
+       buffer[pos + sz] = '\0';
+
        for (l = buffer; (eol = strchr(l, '\n')); l = eol + 1) {
                char buf[16];
                *eol = '\0';


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

Reply via email to