diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | devtools/README | 21 | ||||
-rwxr-xr-x | devtools/aivdmtable | 31 | ||||
-rwxr-xr-x | devtools/editcomment | 8 | ||||
-rwxr-xr-x | devtools/fakecompare | 20 | ||||
-rwxr-xr-x | devtools/maskaudit | 61 | ||||
-rwxr-xr-x | devtools/regressdiff | 44 |
7 files changed, 184 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index a6137105..4ca9a391 100644 --- a/Makefile.am +++ b/Makefile.am @@ -388,7 +388,6 @@ EXTRA_DIST = \ gpslib.c \ driver_proto.c \ monitor_proto.c \ - logextract \ setup.py \ packet_states.h \ libgps.pc.in \ diff --git a/devtools/README b/devtools/README index 5fa2abe4..705b626c 100644 --- a/devtools/README +++ b/devtools/README @@ -7,6 +7,15 @@ the outline headers. Ctl-C Ctl-a will unfold them again. AIS packet decoder in Python. Useful as a check on the C code. +** aidvmtable + +Generate an asciidoc table of the six-bit encoding used in AIVDM packets. + +** editcomment + +Edit the change comment at the revision level specified as $1. +Only works if you have developer ssh access to the repo. + ** fakecompare Compare the results from running gpsfake on a logfile between this @@ -26,13 +35,23 @@ Gets the current leap-second correction forom IERS and/or the USNO. ** logextract Extract pure NMEA from an emailed gpsd error log. The output can be fed -to gpsfake. (This one goes in the tarball.) +to gpsfake. + +** maskaudit + +# Report on which status masks are used in the daemon vs. the client-side +# library. ** regress-builder This script runs an exhaustive test on combinations of compilation options, looking for ones that break the build. +** regressdiff + +Walk through a pair of textfiles looking for where they begin to differ. +May be useful for comparing logs when regression tests break. + ** striplog Strip leading comment lines from NMEA sentence logs. gpsfake can do diff --git a/devtools/aivdmtable b/devtools/aivdmtable new file mode 100755 index 00000000..b1a1e550 --- /dev/null +++ b/devtools/aivdmtable @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# +# Generate an asciidoc table of the six-bit encoding used in AIVDM packets. + +sixbits = ( + "000000", "000001", "000010", "000011", "000100", + "000101", "000110", "000111", "001000", "001001", + "001010", "001011", "001100", "001101", "001110", + "001111", "010000", "010001", "010010", "010011", + "010100", "010101", "010110", "010111", "011000", + "011001", "011010", "011011", "011100", "011101", + "011110", "011111", "100000", "100001", "100010", + "100011", "100100", "100101", "100110", "100111", + "101000", "101001", "101010", "101011", "101100", + "101101", "101110", "101111", "110000", "110001", + "110010", "110011", "110100", "110101", "110110", + "110111", "111000", "111001", "111010", "111011", + "111100", "111101", "111110", "111111", + ) + +def asciiarmor(): + print("`--------`-------`---------`-------") + print(" Char ASCII Decimal Bits") + for ch in range(ord('0'), ord('W')+1) + range(ord('`'), ord('w')+1): + n = ch - 48 + if n >= 40: n -= 8 + print '"%s" %3d %3d %s' % (chr(ch), ch, n, sixbits[n]) + print("---------------------------------------") + +if __name__ == "__main__": + asciiarmor() diff --git a/devtools/editcomment b/devtools/editcomment new file mode 100755 index 00000000..0ea4349b --- /dev/null +++ b/devtools/editcomment @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Emacs-edit the change comment at the revision level specified as $1. +# Only works if you have developer ssh access to the repo. + +svn -r $1 log | sed -e "/^-/d" -e "/^r[0-9]/d" -e '1d' -e '$d' >/tmp/hackcommentemacsclient /tmp/hackcomment +scp /tmp/hackcomment "shell.berlios.de:~" +ssh svn.berlios.de "svnadmin setlog --bypass-hooks /svnroot/repos/gpsd -r $1 ~/hackcomment; rm hackcomment" diff --git a/devtools/fakecompare b/devtools/fakecompare new file mode 100755 index 00000000..08086302 --- /dev/null +++ b/devtools/fakecompare @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Compare the results from running gpsfake on a logfile between this +# machine and a remote one. Especially useful when remote and local +# have different word lengths. +# +file=$1 +remote=$2 + +directory=svn/gpsd/trunk +options="-D 4" + +./gpsfake $options -s 38400 -1 -p $file >/tmp/fcmp-local-$$ 2>&1 +scp -q $file ${remote}:${directory} +ssh $remote "cd ${directory}; PATH=$PATH:. ./gpsfake $options -s 38400 -1 -p $file" >/tmp/fcmp-remote-$$ 2>&1 +echo "*** Local:" +cat /tmp/fcmp-local-$$ +echo "*** Diff:" +diff -u /tmp/fcmp-local-$$ /tmp/fcmp-remote-$$ +rm /tmp/fcmp-local-$$ /tmp/fcmp-remote-$$ diff --git a/devtools/maskaudit b/devtools/maskaudit new file mode 100755 index 00000000..1be71145 --- /dev/null +++ b/devtools/maskaudit @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# +# Report on which status masks are used in the daemon vs. the client-side +# library. Warning: both the symbol list and the source list could be stale +# when you run this next - best to regenerate them. + +import commands, glob + +masks = ( + "ONLINE_SET ", + "TIME_SET", + "TIMERR_SET", + "LATLON_SET", + "ALTITUDE_SET", + "SPEED_SET", + "TRACK_SET", + "CLIMB_SET", + "STATUS_SET", + "MODE_SET", + "HDOP_SET", + "VDOP_SET", + "PDOP_SET", + "TDOP_SET", + "VERSION_SET", + "GDOP_SET", + "HERR_SET", + "VERR_SET", + "PERR_SET", + "POLICY_SET", + "SATELLITE_SET", + "RAW_SET", + "USED_SET", + "SPEEDERR_SET", + "TRACKERR_SET", + "CLIMBERR_SET", + "DEVICE_SET", + "DEVICELIST_SET", + "DEVICEID_SET", + "ERROR_SET", + "CYCLE_START", + "RTCM2_SET", + "RTCM3_SET", + "AIS_SET", +) + +def in_library(flag): + return commands.getstatus("grep %s libgps.c libgps_json.c") == 0 + +daemonfiles = " ".join(['serial.c', 'rtcm2_json.c', 'driver_garmin_txt.c', 'driver_zodiac.c', 'monitor_italk.c', 'bits.c', 'net_gnss_dispatch.c', 'crc24q.c', 'ntpshm.c', 'driver_rtcm3.c', 'subframe.c', 'net_remotegpsd.c', 'driver_garmin.c', 'driver_nmea.c', 'libgpsd_core.c', 'driver_superstar2.c', 'drivers.c', 'driver_aivdm.c', 'strl.c', 'gpsd_json.c', 'driver_rtcm2.c', 'gpsd_report.c', 'driver_ubx.c', 'gpspacket.c', 'driver_sirf.c', 'hex.c', 'ais_json.c', 'driver_tsip.c', 'bsd-base64.c', 'gpsd_dbus.c', 'monitor_sirf.c', 'net_ntrip.c', 'gpsutils.c', 'netlib.c', 'driver_proto.c', 'driver_navcom.c', 'gpsctl.c', 'driver_oncore.c', 'geoid.c','srecord.c', 'packet.c', 'driver_evermore.c', 'net_dgpsip.c', 'driver_italk.c', 'json.c', 'gpsd.c', 'isgps.c']) + + +def in_library(flag): + (status, output) = commands.getstatusoutput("grep %s libgps.c libgps_json.c" % flag) + return status == 0 + +def in_daemon(flag): + (status, output) = commands.getstatusoutput("grep %s %s" % (flag, daemonfiles)) + return status == 0 + +for flag in masks: + print "%-14s %8s %8s" % (flag, in_library(flag), in_daemon(flag)) diff --git a/devtools/regressdiff b/devtools/regressdiff new file mode 100755 index 00000000..89c72a6d --- /dev/null +++ b/devtools/regressdiff @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# +# Walk through a pair of textfiles looking for where they begin to differ. +# May be useful for comparing logs when regression tests break. + +import sys + +class BufferedFile(file): + def __init__(self, name): + file.__init__(self, name) + self.linebuffer = [] + self.lineno = 0 + def readline(self): + self.lineno += 1 + if self.linebuffer: + return self.linebuffer.pop() + else: + return file.readline(self) + def pushback(self, line): + self.lineno -= 1 + self.linebuffer.append(line) + def peek(self): + return self.linebuffer[-1] + +def eatspan(f1, f2): + consumed = 0 + while True: + line1 = f1.readline() + line2 = f2.readline() + if line1 and line2 and line1 == line2: + consumed += 1 + continue + f1.pushback(line1) + f2.pushback(line2) + return consumed + +if __name__ == "__main__": + f1 = BufferedFile(sys.argv[1]) + f2 = BufferedFile(sys.argv[2]) + + eaten = eatspan(f1, f2) + print "First %d lines match" % eaten + print `f1.peek()` + print `f2.peek()` |