Other test added
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 14 Jun 2009 12:21:39 +0000 (14:21 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 14 Jun 2009 12:21:39 +0000 (14:21 +0200)
tests/Makefile [new file with mode: 0644]
tests/_lib.sh [moved from tests/lib.sh with 77% similarity]
tests/rtt-300MHz.sh [new file with mode: 0755]
tests/rtt-virtual-300MHz.sh [new file with mode: 0755]
tests/rtt-virtual.sh [moved from tests/t02-virtual.sh with 84% similarity]
tests/rtt.sh [moved from tests/t01-simple.sh with 70% similarity]

diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644 (file)
index 0000000..7094dba
--- /dev/null
@@ -0,0 +1,8 @@
+T=$(filter-out _lib.sh,$(wildcard *.sh))
+
+.PHONY: $(T)
+
+all: $(T)
+
+$(T):%:
+       ./$@ --pdf-only
similarity index 77%
rename from tests/lib.sh
rename to tests/_lib.sh
index 984af0a..5eb70fd 100644 (file)
@@ -2,6 +2,7 @@
 while [ $# -gt 0 ]; do
     case "$1" in
        -p) OPT_PLOT_ONLY=1; shift;;
+       --pdf-only) OPT_PDF_ONLY=1; shift;;
     esac
 done
 
@@ -59,9 +60,7 @@ prepare_socketcan_virtual() {
 }
 
 run_tests() {
-    [ "$OPT_PLOT_ONLY" -eq 1 ] && return
-       
-    tests=${TESTS:-lincan_hw socketcan_hw}
+    tests=${TESTS:-socketcan_hw lincan_hw}
     for i in $tests; do
        prepare_$i
        t
@@ -71,9 +70,21 @@ run_tests() {
 plot() {
     if [ -n "$PLOT_CMD" ]; then
        echo "set terminal postscript color eps enhanced;
-             set output '`basename $0 .sh`.eps'; $PLOT_CMD" | gnuplot
-       echo "set terminal x11 enhanced; $PLOT_CMD" | gnuplot -persist
+             $PLOT_CMD" | gnuplot | epstopdf --filter > `basename $0 .sh`.pdf
+       if [ -z "$OPT_PDF_ONLY" ]; then
+           echo "set terminal x11 enhanced; $PLOT_CMD" | gnuplot -persist
+       fi
     fi
 }
 
-trap 'run_tests && plot' EXIT
+go() {
+    d=results/`basename $0 .sh`/`uname -r`
+    mkdir -p $d
+    cd $d
+    
+    [ -n "$OPT_PLOT_ONLY" ] || run_tests
+    plot
+
+}
+
+trap 'go' EXIT
diff --git a/tests/rtt-300MHz.sh b/tests/rtt-300MHz.sh
new file mode 100755 (executable)
index 0000000..a76f063
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. _lib.sh
+
+t() {
+    PID_S=`vca_canping -s 1 -b -r -d $CAN1`
+    cpufreq-set -f 300
+    vca_canping -m 1 -r -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
+    cpufreq-set -f 2400
+    kill $PID_S
+}
+
+
+
+PLOT_CMD='
+set title "Round-trip time (`uname -r`, CPU\\@300 MHz)"
+set logscale y
+set grid
+set xlabel "Time [{/Symbol m}s]"
+set ylabel "Latency profile [messages]"
+plot [0:] "socketcan-1000.dat" with lp title "Socketcan",\
+          "lincan-1000.dat" with lp title "Lincan"
+'
+
diff --git a/tests/rtt-virtual-300MHz.sh b/tests/rtt-virtual-300MHz.sh
new file mode 100755 (executable)
index 0000000..5833c23
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. _lib.sh
+
+t() {
+    PID_S=`vca_canping -s 1 -b -r -d $CAN0`
+    cpufreq-set -f 300
+    vca_canping -m 1 -r -v -g $DRIVER -t 1 -d $CAN0 -w 5 -c 10000
+    cpufreq-set -f 2400
+    kill $PID_S
+}
+
+TESTS="lincan_virtual socketcan_virtual"
+
+PLOT_CMD='
+set title "Round-trip time - virtual CAN (`uname -r`, CPU\\@300 MHz)"
+set logscale y
+set grid
+set xlabel "Time [{/Symbol m}s]"
+set ylabel "Latency profile [messages]"
+plot [0:] "socketcan-virtual-1000.dat" with lp title "Socketcan",\
+          "lincan-virtual-1000.dat" with lp title "Lincan"
+'
+
similarity index 84%
rename from tests/t02-virtual.sh
rename to tests/rtt-virtual.sh
index 9cc67b8..fb42e3c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. lib.sh
+. _lib.sh
 
 t() {
     PID_S=`vca_canping -s 1 -b -r -d $CAN0`
@@ -11,9 +11,9 @@ t() {
 TESTS="lincan_virtual socketcan_virtual"
 
 PLOT_CMD='
+set title "Round-trip time - virtual CAN (`uname -r`)"
 set logscale y
 set grid
-set title "Round-trip time measurement - virtual CAN (`uname -r`)"
 set xlabel "Time [{/Symbol m}s]"
 set ylabel "Latency profile [messages]"
 plot [0:] "socketcan-virtual-1000.dat" with lp title "Socketcan",\
similarity index 70%
rename from tests/t01-simple.sh
rename to tests/rtt.sh
index e6e92df..7397869 100755 (executable)
@@ -1,17 +1,19 @@
 #!/bin/sh
 
-. lib.sh
+. _lib.sh
 
 t() {
     PID_S=`vca_canping -s 1 -b -r -d $CAN1`
-    vca_canping -m 1 -r -v -g $DRIVER -t 1 -d $CAN0 -w 5 -c 1000
+    vca_canping -m 1 -r -v -g $DRIVER -t 1 -d $CAN0 -w 2 -c 10000
     kill $PID_S
 }
 
+
+
 PLOT_CMD='
+set title "Round-trip time (`uname -r`)"
 set logscale y
 set grid
-set title "Round-trip time measurement (`uname -r`)"
 set xlabel "Time [{/Symbol m}s]"
 set ylabel "Latency profile [messages]"
 plot [0:] "socketcan-1000.dat" with lp title "Socketcan",\