12 Feb 2005 gpsfake 1 The GPSD Project GPSD Documentation gpsfake test harness for gpsd, simulating a GPS gpsfake -1 -h -b -c interval -i -D debuglevel -l -m monitor -n -o options -p -P port -r initcmd -s speed -u -v logfile DESCRIPTION gpsfake is a test harness for gpsd and its clients. It opens a pty (pseudo-TTY), launches a gpsd instance that thinks the slave side of the pty is its GPS device, and repeatedly feeds the contents of one or more test logfiles through the master side to the GPS. If there are multiple logfiles, sentences from them are interleaved in the order the files are specified. gpsfake does not require root privileges, and can be run concurrently with a production gpsd instance without causing problems. The logfiles may be of NMEA, SiRF packets, TSIP packets, or Zodiac packets. Leading lines beginning with # will be treated as comments and ignored. The gpsd instance is run in foreground. The thread sending fake GPS data to the daemon is run in background. OPTIONS With the -1 option, the logfile is interpreted once only rather than repeatedly. This option is intended to facilitate regression testing. The -b option enables a twirling-baton progress indicator on standard error. At termination, it reports elapsed time. The -c option sets the delay between sentences in seconds. Fractional values of seconds are legal. The default is zero (no delay). The -l option makes the program dump a line or packet number just before each sentence is fed to the daemon. If the sentence is textual (e.g. NMEA), the text is dumped as well. If not, the packet will be dumped in hexadecimal (except for RTCM packets, which aren't dumped at all). This option is useful for checking that gpsfake is getting packet boundaries right. The -i option is for single-stepping through logfiles. It dumps the line or packet number (and the sentence if the protocol is textual) followed by "? ". Only when the user keys Enter is the line actually fed to gpsd. The -m option specifies a monitor program inside which the daemon should be run. This option is intended to be used with valgrind1, gdb1 and similar programs. The -g option uses the monitor facility to run the gpsd instance within gpsfake under control of gdb. The -o option specifies options to pass to the daemon. The -n option passes -n to start the daemon reading the GPS without waiting for a client (equivalent to -o "-n"). The -D option passes a -D option to the daemon: thus -D 4 is shorthand for -o "-D 4". The -p ("pipe") option sets watcher mode and dumps the NMEA and GPSD notifications generated by the log to standard output. This is useful for regression-testing. The -P ("port") option sets the daemon's listening port. The -r option specifies an initialization command to use in pipe mode. The default is ?WATCH={"enable":true,"json":true}. The -s option sets the baud rate for the slave tty. The default is 4800. The -u option forces the test framework to use UDP rather than pty devices. This may be useful for testing from within chroot jails where access to pty devices is locked out. The -v option enables verbose progress reports to stderr. It is mainly useful for debugging gpsfake itself. The -x option dumps packets as gpsfake gathers them. It is mainly useful for debugging gpsfake itself. The -h option makes gpsfake print a usage message and exit. The argument must be the name of a file containing the data to be cycled at the device. gpsfake will print a notification each time it cycles. Normally, gpsfake creates a pty for each logfile and passes the slave side of the device to the daemon. If the header comment in the logfile contains the string "UDP", packets are instead shipped via UDP port 5000 to the address 192.168.0.1.255. You can monitor them with this: tcpdump -s0 -n -A -i lo udp and port 5000. CUSTOM TESTS gpsfake is a trivial wrapper around a Python module, also named gpsfake, that can be used to fully script sessions involving a gpsd instance, any number of client sessions, and any number of fake GPSes feeding the daemon instance with data from specified sentence logs. Source and embedded documentation for this module is shipped with the gpsd development tools. You can use it to torture-test either gpsd itself or any gpsd-aware client application. Logfiles for the use with gpsfake can be retrieved using gpspipe, gpscat, or gpsmon from the gpsd distribution, or any other application which is able to create a compatible output. If gpsfake exits with "Cannot execute gpsd: executable not found." the environment variable GPSD_HOME can be set to the path where gpsd can be found. (instead of adding that folder to the PATH environment variable SEE ALSO gpsd8, gps1, libgps3, libgpsd3, gpsctl1, gpspipe1, gpsprof1 gpsmon1. AUTHOR Eric S. Raymond esr@thyrsus.com. There is a project page for gpsd here.