]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Add test for modifications + update nop for different msg lengths
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Nov 2010 15:41:08 +0000 (16:41 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Nov 2010 15:41:08 +0000 (16:41 +0100)
gw-tests/gw-mod.sh [new file with mode: 0755]
gw-tests/gw-nop.sh
gw-tests/lib.sh

diff --git a/gw-tests/gw-mod.sh b/gw-tests/gw-mod.sh
new file mode 100755 (executable)
index 0000000..3edcbfe
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+. lib.sh
+
+LATESTER_OPTS="-d can0 -d can1 -d can2 -o -l 8 -c $COUNT"
+
+main() {
+    sshgw cangw -A -s can0 -d can1
+    latester $LATESTER_OPTS -h hist.dat -f time.dat
+
+    cleanupgw
+    sshgw cangw -A -s can0 -d can1 -m OR:D:0.0.0000123400000000 \
+                                  -m SET:IL:123.8.0000000000000000
+    latester $LATESTER_OPTS -h hist-mod.dat -f time-mod.dat
+
+    cleanupgw
+    sshgw cangw -A -s can0 -d can1 -m AND:ID:0.0.ffff000000000000 \
+                                  -m OR:D:0.0.0000123400000000 \
+                                  -m XOR:D:0.0.0000000012345678 \
+                                  -m SET:IL:123.8.0000000000000000
+    latester $LATESTER_OPTS -h hist-mod2.dat -f time-mod2.dat
+
+    cleanupgw
+    sshgw cangw -A -s can0 -d can1 -m AND:ID:0.0.ffff000000000000 \
+                                  -m OR:D:0.0.0000123400000000 \
+                                  -m XOR:D:0.0.0000000012345678 \
+                                  -m SET:IL:123.8.0000000000000000 \
+                                  -x 0:6:7:0
+    latester $LATESTER_OPTS -h hist-modcsxor.dat -f time-modcsxor.dat
+    cleanupgw
+    sshgw cangw -A -s can0 -d can1 -m AND:ID:0.0.ffff000000000000 \
+                                  -m OR:D:0.0.0000123400000000 \
+                                  -m XOR:D:0.0.0000000012345678 \
+                                  -m SET:IL:123.8.0000000000000000 \
+                                  -p 3 -c 0:6:7:0:0:00D013C326F635E54C9C5F8F6ABA79A998488B5BBE6EAD7DD404C717F222E13183539040A575B666CF1FDC0CE939FA2A1BCB08D83DED2EFE5787449471A162B2B565A67693438050F929EA3ADF0FCC1C2DFD3EEE0BDB18C861B172A24797548436E625F510C003D37AAA69B95C8C4F9FAE7EBD6D88589B4BE232F121C414D707D909CA1AFF2FEC3C95458656B363A0704191528267B774A40DDD1ECE2BFB38E85A8A49997CAC6FBF16C605D530E023F3C212D101E434F7278E5E9D4DA878BB6B6CBC7FAF4A9A598920F033E306D615C5F424E737D202C111B868AB7B9E4E8D5DEF3FFC2CC919DA0AA373B0608555964677A764B4518142923BEB28F81DCD0EDE
+    latester $LATESTER_OPTS -h hist-modcscrc8.dat -f time-modcscrc8.dat
+}
+
+plot_cmds() {
+    cat <<EOF
+set title "Single GW, with modifications, no filters, 8 byte messages"
+set logscale y
+set grid
+set xlabel "Time [{/Symbol m}s]"
+set ylabel "Latency profile [messages]"
+plot [0:] [1:$COUNT] \
+          "hist.dat" with lp lt 1 title "No modifications", \
+          "hist-mod.dat" with lp lt 2 title "Two modifications", \
+          "hist-mod2.dat" with lp lt 3 title "Four modifications", \
+          "hist-modcsxor.dat" with lp lt 4 title "Four modifications and XOR checksum",\
+          "hist-modcscrc8.dat" with lp lt 5 title "Four modifications and CRC8 checksum"
+EOF
+}
+    
+test_end
+    
index 69b328df95b273c79dc1123802f52fe9a71f47a9..72d87c7053b9c7f7f35dccd33977185332b72fa5 100755 (executable)
@@ -3,20 +3,25 @@
 . lib.sh
 
 main() {
 . lib.sh
 
 main() {
-    gw="cangw -A -s can0 -d can1"
-    sshgw $gw
-    latester -d can0 -d can1 -d can2 -o -c $COUNT -h hist.dat -f time.dat
+    sshgw cangw -A -s can0 -d can1
+    latester -d can0 -d can1 -d can2 -o -c $COUNT -l 2 -h hist2.dat -f time2.dat
+    latester -d can0 -d can1 -d can2 -o -c $COUNT -l 4 -h hist4.dat -f time4.dat
+    latester -d can0 -d can1 -d can2 -o -c $COUNT -l 6 -h hist6.dat -f time6.dat
+    latester -d can0 -d can1 -d can2 -o -c $COUNT -l 8 -h hist8.dat -f time8.dat
 }
 
 plot_cmds() {
     cat <<EOF
 }
 
 plot_cmds() {
     cat <<EOF
-set title "$gw"
+set title "Single GW, no modifications, no filters"
 set logscale y
 set grid
 set xlabel "Time [{/Symbol m}s]"
 set ylabel "Latency profile [messages]"
 set logscale y
 set grid
 set xlabel "Time [{/Symbol m}s]"
 set ylabel "Latency profile [messages]"
-plot [0:1000] [1:$COUNT] \
-          "hist.dat" with lp lt 1 title ""
+plot [0:] [1:$COUNT] \
+          "hist2.dat" with lp lt 1 title "2 byte messages", \
+          "hist4.dat" with lp lt 2 title "4 byte messages", \
+          "hist6.dat" with lp lt 3 title "6 byte messages", \
+          "hist8.dat" with lp lt 4 title "8 byte messages"
 EOF
 }
     
 EOF
 }
     
index f270c788847f636f86c9407a95f034e6c9f03778..f82ea28d855ac6a07a9bdf215a579fd559472832 100644 (file)
@@ -29,7 +29,7 @@ sshgw() {
     ssh -x -a -S $socket root@192.168.2.3 "$@"
 }
 
     ssh -x -a -S $socket root@192.168.2.3 "$@"
 }
 
-_cleanupgw() {
+cleanupgw() {
     # Set can interfaces up
     sshgw 'for i in 0 1; do ip link show dev can$i|grep -q UP || ip link set can$i up type can bitrate 1000000; done'
     # Delete all GW rules
     # Set can interfaces up
     sshgw 'for i in 0 1; do ip link show dev can$i|grep -q UP || ip link set can$i up type can bitrate 1000000; done'
     # Delete all GW rules
@@ -68,27 +68,41 @@ create_dirs_and_links() {
 }
 
 _run() {
 }
 
 _run() {
-    _cleanupgw
-    kvers=$(sshgw uname -r)
-    dir=$(create_dirs_and_links $(basename $0 .sh) $kvers)
-    cd $dir
     if [[ ! "$OPT_PLOT_ONLY" ]]; then
     if [[ ! "$OPT_PLOT_ONLY" ]]; then
-       main
+       kernel_versions=$(sshgw uname -r)
+    else
+       kernel_versions=$(ls results/by-kern)
     fi
     fi
-    _plot
+    for kvers in $kernel_versions; do
+       dir=$(create_dirs_and_links $(basename $0 .sh) $kvers)
+       script=$PWD/$0
+       cd $dir
+       if [[ ! "$OPT_PLOT_ONLY" ]]; then
+           cleanupgw
+           main
+           cp $script .
+       fi
+       _plot
+    done
 }
 
 test_end() {
     test_end_called=t
 }
 
 test_end() {
     test_end_called=t
-    trap '' DEBUG
+    exit_ok=
     _run
     _run
+    exit_ok=t
 }
 
 }
 
-exit() {
+_myexit() {
+    code=$?
+    cmd=$BASH_COMMAND
     if [[ ! "$test_end_called" ]]; then
        test_end_called=t
        error "bug in the test script: No test_end called"
     fi
     if [[ ! "$test_end_called" ]]; then
        test_end_called=t
        error "bug in the test script: No test_end called"
     fi
+    if ! test -n "$exit_ok"; then
+       error "FATAL: Command '$cmd' exited with code $code"
+    fi
 }
 
 }
 
-trap 'exit' EXIT
+trap '_myexit' EXIT