]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - tests/_lib.sh
Other test added
[can-benchmark.git] / tests / _lib.sh
similarity index 77%
rename from tests/lib.sh
rename to tests/_lib.sh
index 984af0a37d76bcd382aed2bd392ad944bccffddb..5eb70fd419641a0f11d6d2f24e74faec0b148683 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