Module: xenomai-head Branch: master Commit: 8f2fd0b49e51fb2547c4972f2cda9e32dfc5dca6 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=8f2fd0b49e51fb2547c4972f2cda9e32dfc5dca6
Author: Gilles Chanteperdrix <[email protected]> Date: Mon Oct 24 21:21:34 2011 +0200 xeno-test: various fixes fix interruption by ctrl-C, avoid using /bin/sh. --- src/testsuite/xeno-test/xeno-test-run-wrapper | 4 +- src/testsuite/xeno-test/xeno-test-run.c | 26 +++++++++++++++++++----- src/testsuite/xeno-test/xeno-test.in | 11 +++++++++- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/testsuite/xeno-test/xeno-test-run-wrapper b/src/testsuite/xeno-test/xeno-test-run-wrapper index a0efb95..025f56f 100644 --- a/src/testsuite/xeno-test/xeno-test-run-wrapper +++ b/src/testsuite/xeno-test/xeno-test-run-wrapper @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash check_alive() { @@ -16,4 +16,4 @@ wait_load() } script="$1"; shift -source $script +. $script diff --git a/src/testsuite/xeno-test/xeno-test-run.c b/src/testsuite/xeno-test/xeno-test-run.c index 7025dd8..69d10b1 100644 --- a/src/testsuite/xeno-test/xeno-test-run.c +++ b/src/testsuite/xeno-test/xeno-test-run.c @@ -38,7 +38,8 @@ static volatile int sigexit; static time_t termload_start, sigexit_start = 0; static sigset_t sigchld_mask; static struct child *first_child; -static char *loadcmd = "exec dohell 900"; +static char default_loadcmd[] = "dohell 900"; +static char *loadcmd = default_loadcmd; static fd_set inputs; static struct child script, load; @@ -98,6 +99,10 @@ int child_initv(struct child *child, int type, char *argv[]) fail_perror("dup2(pipe_err)"); _exit(EXIT_FAILURE); } + /* Detach child from terminal, + to avoid child catching SIGINT */ + setsid(); + break; case CHILD_SCRIPT: @@ -112,9 +117,6 @@ int child_initv(struct child *child, int type, char *argv[]) break; } - /* Detach child from terminal, to avoid child catching SIGINT */ - setsid(); - err = execvp(argv[0], argv); if (err < 0) { fail_fprintf(stderr, "execvp(%s): %m", argv[0]); @@ -509,7 +511,9 @@ void setpath(void) int main(int argc, char *argv[]) { struct sigaction action; + char **new_argv; int rc, maxfd; + unsigned i; if (argc < 2) { usage(argv[0]); @@ -561,8 +565,18 @@ int main(int argc, char *argv[]) load.dead = 1; FD_ZERO(&inputs); - argv[0] = TESTDIR "/xeno-test-run-wrapper"; - rc = child_initv(&script, CHILD_SCRIPT, argv); + + new_argv = malloc(sizeof(*new_argv) * (argc + 2)); + if (!new_argv) { + fail_fprintf(stderr, "memory allocation failed\n"); + exit(EXIT_FAILURE); + } + new_argv[0] = getenv("SHELL") ?: "/bin/bash"; + new_argv[1] = TESTDIR "/xeno-test-run-wrapper"; + for (i = 1; i < argc + 1; i++) + new_argv[i + 1] = argv[i]; + + rc = child_initv(&script, CHILD_SCRIPT, new_argv); if (rc < 0) { fail_fprintf(stderr, "script creation failed: %s\n", strerror(-rc)); exit(EXIT_FAILURE); diff --git a/src/testsuite/xeno-test/xeno-test.in b/src/testsuite/xeno-test/xeno-test.in index 539c232..3f5ba0f 100644 --- a/src/testsuite/xeno-test/xeno-test.in +++ b/src/testsuite/xeno-test/xeno-test.in @@ -3,7 +3,12 @@ usage() { cat <<EOF -xeno-test [ -l "load command" ] [ latency options ] +xeno-test -h or xeno-test --help + +This help text. + + +xeno-test [ -l "load command" ] [ -- ] [ latency test options ] Run a basic test/benchmark of Xenomai on your platform, by first starting a few unit tests, then running the latency test under the load generated by @@ -29,6 +34,10 @@ if [ "$1" = "-h" -o "$1" = "--help" ]; then exit 0 fi +if [ "$1" = "--" ]; then + shift +fi + set -ex echo 0 > /proc/xenomai/latency || : _______________________________________________ Xenomai-git mailing list [email protected] https://mail.gna.org/listinfo/xenomai-git
