Module: xenomai-gch
Branch: next
Commit: 646f5caa2ec7db6e78beae9f4a0bd00a4c65a9c0
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=646f5caa2ec7db6e78beae9f4a0bd00a4c65a9c0

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Dec 21 22:28:22 2015 +0100

testsuite/xeno-test: add -r option

To generate real-time load with the "switchtest" test.

---

 testsuite/xeno-test/xeno-test-run.c |   25 ++++++---------
 testsuite/xeno-test/xeno-test.in    |   59 +++++++++++++++++++++++++----------
 2 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/testsuite/xeno-test/xeno-test-run.c 
b/testsuite/xeno-test/xeno-test-run.c
index a60fe3b..bfede63 100644
--- a/testsuite/xeno-test/xeno-test-run.c
+++ b/testsuite/xeno-test/xeno-test-run.c
@@ -557,29 +557,22 @@ int main(int argc, char *argv[])
        char **new_argv;
        int rc, maxfd;
        unsigned i;
+       int j, k;
 
-       if (argc < 2) {
-               usage(argv[0]);
-               exit(EXIT_FAILURE);
-       }
-
-       if (!strcmp(argv[1], "-h")
-           || !strcmp(argv[1], "--help")) {
-               usage(argv[0]);
-               exit(EXIT_SUCCESS);
-       }
-
-       if (argc >= 3) {
-               if (!strcmp(argv[2], "-l")) {
-                       if (argc == 3) {
+       for (j = 0; j < argc; j++) {
+               if (!strcmp(argv[j], "-l")) {
+                       if (j == argc -1) {
                                usage(argv[0]);
                                exit(EXIT_FAILURE);
                        }
 
-                       loadcmd = argv[3];
+                       loadcmd = argv[j + 1];
+                       for (k = j - 1; k >= 0; k--)
+                               argv[k + 2] = argv[k];
 
-                       argv[3] = argv[1];
                        argv += 2;
+                       j -= 2;
+                       argc -= 2;
                }
        }
        scriptname = argv[1];
diff --git a/testsuite/xeno-test/xeno-test.in b/testsuite/xeno-test/xeno-test.in
index be8506d..b4bb403 100644
--- a/testsuite/xeno-test/xeno-test.in
+++ b/testsuite/xeno-test/xeno-test.in
@@ -8,17 +8,21 @@ xeno-test -h or xeno-test --help
 This help text.
 
 
-xeno-test [ -k ] [ -l "load command" ] [ -- ] [ latency test options ]
+xeno-test [ -l "load command" ] [ -k ] [ -r ] [ -- ] [ 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
 "load-command".
 
+By default, the load command is "dohell 900", which will generate load during
+15 minutes. To generate a more realistic load see dohell help.
+
 This script accepts the -k option to tell the unit test loop to keep
 going upon a failing test. Otherwise xeno-test stops immediately.
 
-By default, the load command is "dohell 900", which will generate load during
-15 minutes. To generate a more realistic load see dohell help.
+If the script is passed the -r option, real-time stress is added to the test,
+with the help of the "switchtest" test. But beware: the latency test figures 
are
+then no longer meaningful.
 
 Any other option passed on the command line is passed to the latency test.
 
@@ -32,20 +36,36 @@ timer irq latency.
 EOF
 }
 
-if [ "$1" = "-h" -o "$1" = "--help" ]; then
-    usage
-    exit 0
-fi
-
 keep_going=
-if [ "$1" = "-k" ]; then
-   keep_going=--keep-going
-   shift
-fi
-
-if [ "$1" = "--" ]; then
-   shift
-fi
+rt_load=false
+
+while :; do
+    case "$1" in
+       -h|--help)
+           usage
+           exit 0
+           ;;
+
+       -k)
+           keep_going=--keep-going
+           shift
+           ;;
+
+       -r)
+           rt_load=true
+           shift
+           ;;
+
+       --)
+           shift
+           break
+           ;;
+
+       ""|*)
+           break
+           ;;
+    esac
+done
 
 set -ex
 
@@ -59,6 +79,11 @@ $testdir/switchtest -T 30
 
 start_load
 
-check_alive @testdir@/latency ${1+"$@"}
+if $rt_load; then
+    check_alive $testdir/switchtest
+    check_alive $testdir/switchtest -s 1000
+fi
+
+check_alive $testdir/latency ${1+"$@"}
 
 wait_load


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

Reply via email to