1GPSFAKE(1)                    GPSD Documentation                    GPSFAKE(1)
2
3
4

NAME

6       gpsfake - test harness for gpsd, simulating a GPS
7

SYNOPSIS

9       gpsfake [-1] [-h] [-b] [-c interval] [-i] [-D debuglevel] [-l]
10               [-m monitor] [-g] [-G] [-n] [-o options] [-p] [-P port] [-q]
11               [-r initcmd] [-s speed] [-S] [-u] [-t] [-T] [-v] [-W timeout]
12               [logfile...]
13

DESCRIPTION

15       gpsfake is a test harness for gpsd and its clients. It opens a pty
16       (pseudo-TTY), launches a gpsd instance that thinks the slave side of
17       the pty is its GPS device, and repeatedly feeds the contents of one or
18       more test logfiles through the master side to the GPS. If there are
19       multiple logfiles, sentences from them are interleaved in the order the
20       files are specified.
21
22       gpsfake does not require root privileges, and can be run concurrently
23       with a production gpsd instance without causing problems.
24
25       The logfiles may contain packets in any supported format, including in
26       particular NMEA, SiRF, TSIP, or Zodiac. Leading lines beginning with #
27       will be treated as comments and ignored, except in the following
28       special cases:
29
30       ·   a comment of the form #Date: yyyy-mm-dd (ISO8601 date format) may
31           be used to set the initial date for the log.
32
33       ·   a comment of the form #Serial: [0-9]* [78][NOE][12] may be used to
34           set serial parameters for the log - baud rate, word length, stop
35           bits.
36
37       ·   a comment of the form #Transport: UDP may be used to fake a UDP
38           source rather than the normal pty.
39
40       The gpsd instance is run in foreground. The thread sending fake GPS
41       data to the daemon is run in background.
42

OPTIONS

44       With the -1 option, the logfile is interpreted once only rather than
45       repeatedly. This option is intended to facilitate regression testing.
46
47       The -b enables a twirling-baton progress indicator on standard error.
48       At termination, it reports elapsed time.
49
50       The -c sets the delay between sentences in seconds. Fractional values
51       of seconds are legal. The default is zero (no delay).
52
53       The -l makes the program dump a line or packet number just before each
54       sentence is fed to the daemon. If the sentence is textual (e.g. NMEA),
55       the text is dumped as well. If not, the packet will be dumped in
56       hexadecimal (except for RTCM packets, which aren't dumped at all). This
57       option is useful for checking that gpsfake is getting packet boundaries
58       right.
59
60       The -i is for single-stepping through logfiles. It dumps the line or
61       packet number (and the sentence if the protocol is textual) followed by
62       "? ". Only when the user keys Enter is the line actually fed to gpsd.
63
64       The -m specifies a monitor program inside which the daemon should be
65       run. This option is intended to be used with valgrind(1), gdb(1) and
66       similar programs.
67
68       The -g and -G options use the monitor facility to run the gpsd instance
69       within gpsfake under control of gdb or lldb, respectively. They also
70       disable the timeout on daemon inactivity, to allow for breakpointing.
71       If necessary, the timeout can be reenabled by a subsequent -W.
72
73       The -o specifies options to pass to the daemon. The -n option passes -n
74       to start the daemon reading the GPS without waiting for a client
75       (equivalent to -o "-n"). The -D passes a -D option to the daemon: thus
76       -D 4 is shorthand for -o "-D 4".
77
78       The -p ("pipe") option sets watcher mode and dumps the NMEA and GPSD
79       notifications generated by the log to standard output. This is useful
80       for regression-testing.
81
82       The -P ("port") option sets the daemon's listening port.
83
84       The -q tells gpsfake to suppress normal progress output and thus act in
85       a quiet manner.
86
87       The -r specifies an initialization command to use in pipe mode. The
88       default is ?WATCH={"enable":true,"json":true}.
89
90       The -s sets the baud rate for the slave tty. The default is 4800.
91
92       The option -S tells gpsfake to insert realistic delays in the test
93       input rather than trying to stuff it through the daemon as fast as
94       possible. This will make the test(s) run much slower, but avoids flaky
95       failures due to machine lode and possible race conditions in the pty
96       layer.
97
98       The -t forces the test framework to use TCP rather than pty devices.
99       Besides being a test of TCP source handling, this may be useful for
100       testing from within chroot jails where access to pty devices is locked
101       out.
102
103       The -T makes gpsfake print some system information and then exits.
104
105       The -u forces the test framework to use UDP rather than pty devices.
106       Besides being a test of UDP source handling, this may be useful for
107       testing from within chroot jails where access to pty devices is locked
108       out.
109
110       The -v enables verbose progress reports to stderr. It is mainly useful
111       for debugging gpsfake itself.
112
113       The -W ("wait") option sets the timeout on daemon inactivity, in
114       seconds. The default timeout is 60 seconds, and a value of 0 suppresses
115       the timeout altogether. Note that the actual timeout is longer due to
116       internal delays, typically by about 20 seconds.
117
118       The -x dumps packets as gpsfake gathers them. It is mainly useful for
119       debugging gpsfake itself.
120
121       The -h makes gpsfake print a usage message and exit.
122
123       The argument must be the name of a file containing the data to be
124       cycled at the device.  gpsfake will print a notification each time it
125       cycles.
126
127       Normally, gpsfake creates a pty for each logfile and passes the slave
128       side of the device to the daemon. If the header comment in the logfile
129       contains the string "UDP", packets are instead shipped via UDP port
130       5000 to the address 192.168.0.1.255. You can monitor them with this:
131       tcpdump -s0 -n -A -i lo udp and port 5000.
132

MAGIC COMMENTS

134       Certain magic comments in test load headers can change the conditions
135       of the test. These are:
136
137       Serial:
138           May contain a serial-port setting such as 4800 7N2 - baud rate
139           followed by 7 or 8 for byte length, N or O or E for parity and 1 or
140           2 for stop bits. The test is run with those settings on the slave
141           port that the daemon sees.
142
143       Transport:
144           Values 'TCP' and 'UDP' force the use of TCP and UDP feeds
145           respectively (the default is a pty).
146
147       Delay-Cookie:
148           Must be followed by two whitespace-separated fields, a delimiter
149           character and a numeric delay in seconds. Instead of being broken
150           up by packet boundaries, the test load is split on the delimiters.
151           The delay is performed after each feed. Can be useful for imposing
152           write boundaries in the middle of packets.
153

CUSTOM TESTS

155       gpsfake is a trivial wrapper around a Python module, also named
156       gpsfake, that can be used to fully script sessions involving a gpsd
157       instance, any number of client sessions, and any number of fake GPSes
158       feeding the daemon instance with data from specified sentence logs.
159
160       Source and embedded documentation for this module is shipped with the
161       gpsd development tools. You can use it to torture-test either gpsd
162       itself or any gpsd-aware client application.
163
164       Logfiles for the use with gpsfake can be retrieved using gpspipe,
165       gpscat, or gpsmon from the gpsd distribution, or any other application
166       which is able to create a compatible output.
167
168       If gpsfake exits with "Cannot execute gpsd: executable not found." the
169       environment variable GPSD_HOME can be set to the path where gpsd can be
170       found. (instead of adding that folder to the PATH environment variable
171

SEE ALSO

173       gpsd(8), gps(1), libgps(3), libgpsmm(3), gpsctl(1), gpspipe(1),
174       gpsprof(1) gpsmon(1).
175

AUTHOR

177       Eric S. Raymond <esr@thyrsus.com>.
178
179
180
181The GPSD Project                  12 Feb 2005                       GPSFAKE(1)
Impressum