]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - tests/_lib.sh
Allow tests to generate more graphs
[can-benchmark.git] / tests / _lib.sh
index 183f1891b374963e42a7ee4225492c91abd31c19..281ddf90e87e08f2cfb253d6f721e96f52dd95f1 100644 (file)
@@ -6,7 +6,7 @@ while [ $# -gt 0 ]; do
     esac
 done
 
-set -x
+#set -x
 set -e
 
 PATH=$PWD/../_compiled/bin/:$PATH
@@ -14,10 +14,11 @@ PATH=$PWD/../_compiled/bin/:$PATH
 RTPRIO=60
 
 boost_irq_prio() {
-    local P=${1:-50}
+    local PRIO=${1:-50}
     CAN_IRQ=`sed -ne '/can/ s/:.*//p' /proc/interrupts`
     if [ -n "$CAN_IRQ" ]; then
-       schedtool -F -p $P `pidof IRQ-${CAN_IRQ/ /}`
+       IRQ_PID=`pidof IRQ-${CAN_IRQ/ /}` || true
+       [ -z "$IRQ_PID" ] || schedtool -F -p $PRIO $IRQ_PID 
     fi
 }
 
@@ -78,17 +79,19 @@ run_tests() {
 }
 
 plot() {
-    if [ -n "$PLOT_CMD" ]; then
-       echo "set terminal postscript color eps enhanced;
-             $PLOT_CMD" | gnuplot | epstopdf --filter > `basename $0 .sh`.pdf
+    for i in "${!PLOT_CMD[@]}"; do
        if [ -z "$OPT_PDF_ONLY" ]; then
-           echo "set terminal x11 enhanced; $PLOT_CMD" | gnuplot -persist
+           echo "set terminal x11 enhanced; ${PLOT_CMD[$i]}" | gnuplot -persist
        fi
-    fi
+       I=${i/0/}
+       echo "set terminal postscript color eps enhanced;
+             ${PLOT_CMD[$i]}" | gnuplot | epstopdf --filter > `basename $0 .sh`$I.pdf
+    done
 }
 
 go() {
     d=results/`basename $0 .sh`/`uname -r`
+    set -x
     mkdir -p $d
     cd $d