signaltest: Add MAX_LATENCY argument

The test should fail if the max value is larger then the expe
MAX_LATENCY has been observed.

MAX_LATENCY value is board and kernel specific, which means t
job needs to set it accordingly.

Unfortunatly, we need to add a slightly more complex parser f
finding the numbers and add the pass/fail flag.

Signed-off-by: Daniel Wagner <wagi@monom.org>
diff --git a/automated/linux/signaltest/signaltest.sh b/automated/linux/signaltest/signaltest.sh
index 5f64737..db04b10 100755
--- a/automated/linux/signaltest/signaltest.sh
+++ b/automated/linux/signaltest/signaltest.sh
@@ -11,17 +11,19 @@
 PRIORITY="98"
 THREADS="2"
 LOOPS="10000"
+MAX_LATENCY="100"
 
 usage() {
-    echo "Usage: $0 [-p priority] [-t threads] [-l loops]" 1>&2
+    echo "Usage: $0 [-p priority] [-t threads] [-l loops] [-m latency]" 1>&2
     exit 1
 }
 
-while getopts ":p:t:l:" opt; do
+while getopts ":p:t:l:m:" opt; do
     case "${opt}" in
         p) PRIORITY="${OPTARG}" ;;
         t) THREADS="${OPTARG}" ;;
         l) LOOPS="${OPTARG}" ;;
+	m) MAX_LATENCY="${OPTARG}" ;;
         *) usage ;;
     esac
 done
@@ -39,8 +41,5 @@
     | tee "${LOGFILE}"
 
 # Parse test log.
-tail -n 1 "${LOGFILE}" \
-    | awk '{printf("min-latency pass %s us\n", $(NF-6))};
-           {printf("avg-latency pass %s us\n", $(NF-2))};
-           {printf("max-latency pass %s us\n", $NF)};'  \
+../../lib/parse_rt_tests_results.py signaltest "${LOGFILE}" "${MAX_LATENCY}" \
     | tee -a "${RESULT_FILE}"