summaryrefslogtreecommitdiff
path: root/test_nmea2000
diff options
context:
space:
mode:
authorReinhard Arlt <reinhard.arlt@t-online.de>2015-01-29 10:49:20 +0100
committerReinhard Arlt <reinhard.arlt@t-online.de>2015-01-29 10:49:20 +0100
commit435dd1c359fc489a16d74f227a51299822f36ff2 (patch)
tree1cbe49903568f97b60d8378561a5f92d45def262 /test_nmea2000
parentc22e4adc07305d0ff39756843015be6b092cbcb6 (diff)
downloadgpsd-435dd1c359fc489a16d74f227a51299822f36ff2.tar.gz
First version of test_nmea2000 testscript.
Diffstat (limited to 'test_nmea2000')
-rwxr-xr-xtest_nmea200053
1 files changed, 53 insertions, 0 deletions
diff --git a/test_nmea2000 b/test_nmea2000
new file mode 100755
index 00000000..d8379771
--- /dev/null
+++ b/test_nmea2000
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# The regression-test driver script for the nmea2000 driver.
+# CAN is a bit different from normal serial interfaces.
+#
+
+GPSD_PORT=2948
+CAN_PLAYER=canplayer
+TMP_PID_FILE=`mktemp`
+TMP_OUT_FILE=`mktemp`
+CAN_UNIT="vcan0"
+
+# Requires GNU date extensions
+# Should return an empty blank string if those are not present.
+STARTTIME=`date +"%s" 2>/dev/null`
+
+# We need to have the build directory in $GPSD_HOME to find the new gpsd
+if [ "`dirname $0`" = "." ]; then
+ GPSD_HOME=`pwd`
+else
+ GPSD_HOME=`dirname $0`
+fi
+
+
+TEST_FILE=$1
+
+echo ${TMP_PID_FILE}
+echo ${TMP_OUT_FILE}
+echo ${CAN_PLAYER}
+echo ${STARTTIME}
+echo ${GPSD_HOME}
+echo ${TEST_FILE}
+
+${GPSD_HOME}/gpsd -n -G -D0 -S ${GPSD_PORT} -P ${TMP_PID_FILE} nmea2000://${CAN_UNIT}
+
+sleep 1
+
+${GPSD_HOME}/gpspipe -d -r -w -S -o ${TMP_OUT_FILE} :${GPSD_PORT}
+
+sleep 1
+
+${CAN_PLAYER} -I${TEST_FILE} ${CAN_UNIT}=can0
+
+sleep 1
+
+kill `cat ${TMP_PID_FILE}`
+
+sleep 1
+
+diff ${TEST_FILE}.chk ${TMP_OUT_FILE}
+
+rm -f ${TMP_PID_FILE}
+rm -f ${TMP_OUT_FILE} \ No newline at end of file