1GPSFAKE(1) GPSD Documentation GPSFAKE(1)
2
3
4
6 gpsfake - test harness for gpsd, simulating a GPS
7
9 gpsfake [-1] [-h] [-b] [-c interval] [-i] [-D debuglevel] [-l]
10 [-m monitor] [-g] [-n] [-o options] [-p] [-P port] [-q]
11 [-r initcmd] [-s speed] [-S] [-u] [-t] [-T] [-v] [logfile...]
12
14 gpsfake is a test harness for gpsd and its clients. It opens a pty
15 (pseudo-TTY), launches a gpsd instance that thinks the slave side of
16 the pty is its GPS device, and repeatedly feeds the contents of one or
17 more test logfiles through the master side to the GPS. If there are
18 multiple logfiles, sentences from them are interleaved in the order the
19 files are specified.
20
21 gpsfake does not require root privileges, and can be run concurrently
22 with a production gpsd instance without causing problems.
23
24 The logfiles may contain packets in any supported format, including in
25 particular NMEA, SiRF, TSIP, or Zodiac. Leading lines beginning with #
26 will be treated as comments and ignored, except in the following
27 special cases:
28
29 · a comment of the form #Date: yyyy-mm-dd (ISO8601 date format) may
30 be used to set the initial date for the log.
31
32 · a comment of the form #Serial: [0-9]* [78][NOE][12] may be used to
33 set serial parameters for the log - baud rate, word length, stop
34 bits.
35
36 · a comment of the form #Transport: UDP may be used to fake a UDP
37 source rather than the normal pty.
38
39 The gpsd instance is run in foreground. The thread sending fake GPS
40 data to the daemon is run in background.
41
43 With the -1 option, the logfile is interpreted once only rather than
44 repeatedly. This option is intended to facilitate regression testing.
45
46 The -b enables a twirling-baton progress indicator on standard error.
47 At termination, it reports elapsed time.
48
49 The -c sets the delay between sentences in seconds. Fractional values
50 of seconds are legal. The default is zero (no delay).
51
52 The -l makes the program dump a line or packet number just before each
53 sentence is fed to the daemon. If the sentence is textual (e.g. NMEA),
54 the text is dumped as well. If not, the packet will be dumped in
55 hexadecimal (except for RTCM packets, which aren't dumped at all). This
56 option is useful for checking that gpsfake is getting packet boundaries
57 right.
58
59 The -i is for single-stepping through logfiles. It dumps the line or
60 packet number (and the sentence if the protocol is textual) followed by
61 "? ". Only when the user keys Enter is the line actually fed to gpsd.
62
63 The -m specifies a monitor program inside which the daemon should be
64 run. This option is intended to be used with valgrind(1), gdb(1) and
65 similar programs.
66
67 The -g uses the monitor facility to run the gpsd instance within
68 gpsfake under control of gdb.
69
70 The -o specifies options to pass to the daemon. The -n option passes -n
71 to start the daemon reading the GPS without waiting for a client
72 (equivalent to -o "-n"). The -D passes a -D option to the daemon: thus
73 -D 4 is shorthand for -o "-D 4".
74
75 The -p ("pipe") option sets watcher mode and dumps the NMEA and GPSD
76 notifications generated by the log to standard output. This is useful
77 for regression-testing.
78
79 The -P ("port") option sets the daemon's listening port.
80
81 The -q tells gpsfake to suppress normal progress output and thus act in
82 a quiet manner.
83
84 The -r specifies an initialization command to use in pipe mode. The
85 default is ?WATCH={"enable":true,"json":true}.
86
87 The -s sets the baud rate for the slave tty. The default is 4800.
88
89 The option -S tells gpsfake to insert realistic delays in the test
90 input rather than trying to stuff it through the daemon as fast as
91 possible. This will make the test(s) run much slower, but avoids flaky
92 failures due to machine lode and possible race conditions in the pty
93 layer.
94
95 The -t forces the test framework to use TCP rather than pty devices.
96 Besides being a test of TCP source handling, this may be useful for
97 testing from within chroot jails where access to pty devices is locked
98 out.
99
100 The -T makes gpsfake print some system information and then exits.
101
102 The -u forces the test framework to use UDP rather than pty devices.
103 Besides being a test of UDP source handling, this may be useful for
104 testing from within chroot jails where access to pty devices is locked
105 out.
106
107 The -v enables verbose progress reports to stderr. It is mainly useful
108 for debugging gpsfake itself.
109
110 The -x dumps packets as gpsfake gathers them. It is mainly useful for
111 debugging gpsfake itself.
112
113 The -h makes gpsfake print a usage message and exit.
114
115 The argument must be the name of a file containing the data to be
116 cycled at the device. gpsfake will print a notification each time it
117 cycles.
118
119 Normally, gpsfake creates a pty for each logfile and passes the slave
120 side of the device to the daemon. If the header comment in the logfile
121 contains the string "UDP", packets are instead shipped via UDP port
122 5000 to the address 192.168.0.1.255. You can monitor them with this:
123 tcpdump -s0 -n -A -i lo udp and port 5000.
124
126 Certain magic comments in test load headers can change the conditions
127 of the test. These are:
128
129 Serial:
130 May contain a serial-port setting such as 4800 7N2 - baud rate
131 followed by 7 or 8 for byte length, N or O or E for parity and 1 or
132 2 for stop bits. The test is run with those settings on the slave
133 port that the daemon sees.
134
135 Transport:
136 Values 'TCP' and 'UDP' force the use of TCP and UDP feeds
137 respectively (the default is a pty).
138
139 Delay-Cookie:
140 Must be followed by two whitespace-separated fields, a delimiter
141 character and a numeric delay in seconds. Instead of being broken
142 up by packet boundaries, the test load is split on the delimiters.
143 The delay is performed after each feed. Can be useful for imposing
144 write boundaries in the middle of packets.
145
147 gpsfake is a trivial wrapper around a Python module, also named
148 gpsfake, that can be used to fully script sessions involving a gpsd
149 instance, any number of client sessions, and any number of fake GPSes
150 feeding the daemon instance with data from specified sentence logs.
151
152 Source and embedded documentation for this module is shipped with the
153 gpsd development tools. You can use it to torture-test either gpsd
154 itself or any gpsd-aware client application.
155
156 Logfiles for the use with gpsfake can be retrieved using gpspipe,
157 gpscat, or gpsmon from the gpsd distribution, or any other application
158 which is able to create a compatible output.
159
160 If gpsfake exits with "Cannot execute gpsd: executable not found." the
161 environment variable GPSD_HOME can be set to the path where gpsd can be
162 found. (instead of adding that folder to the PATH environment variable
163
165 gpsd(8), gps(1), libgps(3), libgpsmm(3), gpsctl(1), gpspipe(1),
166 gpsprof(1) gpsmon(1).
167
169 Eric S. Raymond <esr@thyrsus.com>.
170
171
172
173The GPSD Project 12 Feb 2005 GPSFAKE(1)