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

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    |   56 +++++++++++++++++++++++++----------
 2 files changed, 49 insertions(+), 32 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..c0092d7 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,35 @@ 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 +78,11 @@ $testdir/switchtest -T 30
 
 start_load
 
+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