diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-05-04 19:33:45 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-05-04 19:33:45 -0400 |
commit | 48548c8b3feee14da62d5a5e9932425c72f4afe9 (patch) | |
tree | a98ddbf55c58115aa4fd4ab31d7cb24a63fe1c9e | |
parent | 8e2d223d06d0787bdd9930256d99f2d2d67a9885 (diff) | |
download | gpsd-48548c8b3feee14da62d5a5e9932425c72f4afe9.tar.gz |
Implement a -u switch to force the test framework to use UDP, not ptys.
The good news is that rgression tests all pass with this case and -u off.
The bad news is that they fail with -u on. It looks like the switch
forces some other bug, previously masked, into the open.
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | gps/fake.py | 5 | ||||
-rwxr-xr-x | gpsfake | 7 | ||||
-rw-r--r-- | gpsfake.xml | 5 | ||||
-rwxr-xr-x | regress-driver | 3 |
5 files changed, 18 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am index 25f8d8e8..946eb6cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -595,7 +595,9 @@ version: # depends on each TEST as well as invokes it (with TESTS_ENVIRONMENT) # the entire list of tests is run twice. -run_regress_driver = PYTHON=$(PYTHON) $(srcdir)/regress-driver +# Use make REGRESSOPTS=-u to force running with UDP rather than pty devices + +run_regress_driver = PYTHON=$(PYTHON) $(srcdir)/regress-driver $(REGRESSOPTS) # Regression-test the daemon gps-regress: gpsd stamp-python diff --git a/gps/fake.py b/gps/fake.py index 405b21d0..3eb07029 100644 --- a/gps/fake.py +++ b/gps/fake.py @@ -383,7 +383,7 @@ class TestSessionError(exceptions.Exception): class TestSession: "Manage a session including a daemon with fake GPSes and clients." CLOSE_DELAY = 1 - def __init__(self, prefix=None, port=None, options=None, verbose=0, predump=False, expected=0): + def __init__(self, prefix=None, port=None, options=None, verbose=0, predump=False, expected=0, udp=False): "Initialize the test session by launching the daemon." self.prefix = prefix self.port = port @@ -391,6 +391,7 @@ class TestSession: self.verbose = verbose self.predump = predump self.expected = expected + self.udp = udp self.daemon = DaemonInstance() self.fakegpslist = {} self.client_id = 0 @@ -420,7 +421,7 @@ class TestSession: self.progress("gpsfake: gps_add(%s, %d)\n" % (logfile, speed)) if logfile not in self.fakegpslist: testload = TestLoad(logfile, predump=self.predump) - if testload.sourcetype == "UDP": + if testload.sourcetype == "UDP" or self.udp: newgps = FakeUDP(testload, ipaddr="127.0.1.255", port="5000", progress=self.progress) else: @@ -88,7 +88,7 @@ def fakehook(linenumber, fakegps): if __name__ == '__main__': try: - (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:fghilm:no:pr:s:vx") + (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:fghilm:no:pr:s:uvx") except getopt.GetoptError, msg: print "gpsfake: " + str(msg) raise SystemExit, 1 @@ -110,6 +110,7 @@ if __name__ == '__main__': promptme = False client_init = '?WATCH={"json":true,"nmea":true}' doptions = "" + udp = False verbose = 0 for (switch, val) in options: if (switch == '-1'): @@ -144,6 +145,8 @@ if __name__ == '__main__': client_init = val elif (switch == '-s'): speed = int(val) + elif (switch == '-u'): + udp = True elif (switch == '-v'): verbose += 1 elif (switch == '-h'): @@ -155,7 +158,7 @@ if __name__ == '__main__': else: print >>sys.stderr, "Processing %s" % ",".join(arguments) - test = gps.fake.TestSession(prefix=monitor, port=port, options=doptions, verbose=verbose, predump=predump) + test = gps.fake.TestSession(prefix=monitor, port=port, options=doptions, udp=udp, verbose=verbose, predump=predump) if pipe: test.reporter = sys.stdout.write diff --git a/gpsfake.xml b/gpsfake.xml index a3aa1e7d..cbeb8e95 100644 --- a/gpsfake.xml +++ b/gpsfake.xml @@ -35,6 +35,7 @@ BSD terms apply: see the file COPYING in the distribution root for details. <arg choice='opt'>-p</arg> <arg choice='opt'>-r <replaceable>initcmd</replaceable></arg> <arg choice='opt'>-s <replaceable>speed</replaceable></arg> + <arg choice='opt'>-u</arg> <arg choice='opt'>-v</arg> <arg rep='repeat'> <arg choice='plain'><replaceable>logfile</replaceable></arg> @@ -115,6 +116,10 @@ The default is <command>?WATCH={"enable":true,"json":true}</command>.</para> <para>The -s option sets the baud rate for the slave tty. The default is 4800.</para> +<para>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.</para> + <para>The -v option enables verbose progress reports to stderr. It is mainly useful for debugging <application>gpsfake</application> itself.</para> diff --git a/regress-driver b/regress-driver index 691630aa..97b96afb 100755 --- a/regress-driver +++ b/regress-driver @@ -35,7 +35,7 @@ export PATH mode=regress testing=daemon opts="" -while getopts cstrbvo opt +while getopts cstrbuvo opt do case $opt in c) testing=clientlib ;; # Can be 'daemon' @@ -43,6 +43,7 @@ do t) opts="-b $opts" mode=regress ;; # Run regression tests w/baton r) mode=superraw ;; # Run superraw regressions (r=2 mode) b) mode=build ;; # Rebuild regression check files + u) opts="$opts -u" ;; # Force UDP v) mode=view ;; # View result of generating a check file o) opts="$opts $OPTARG" ;; # Pass options to gpsfake esac |