summaryrefslogtreecommitdiff
path: root/gpsfake.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-06-09 18:40:04 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-06-09 18:40:04 +0000
commit166257cea5a321f24c2efe07e22af9375472e9c3 (patch)
tree533d264d37cbd08d40c18b54098038f25c17e261 /gpsfake.py
parent564ab5dbcfd6f62333bdcb2a045f0515d0b9a6fa (diff)
downloadgpsd-166257cea5a321f24c2efe07e22af9375472e9c3.tar.gz
Make gpsfake use a port that doesn't collide with a production gpsd.
Fix a comment typo in packet.c
Diffstat (limited to 'gpsfake.py')
-rw-r--r--gpsfake.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/gpsfake.py b/gpsfake.py
index 3cfe62bd..b65a863a 100644
--- a/gpsfake.py
+++ b/gpsfake.py
@@ -71,6 +71,12 @@ import sys, os, time, signal, pty, termios
import string, exceptions, threading, socket
import gps
+# So we can do regression tests without stepping omn a production daemon
+# According to IANA port 12000 belongs to an IBM SNA service. Picking an
+# obsolete service seems safer than picking an unused number that IANA might
+# allocate in the future.
+fakeport = 12000
+
class PacketError(exceptions.Exception):
def __init__(self, msg):
self.msg = msg
@@ -240,7 +246,7 @@ class DaemonInstance:
self.pidfile = "/tmp/gpsfake_pid-%s" % os.getpid()
def spawn(self, options, background=False, prefix=""):
"Spawn a daemon instance."
- self.spawncmd = "gpsd -N -F %s -P %s %s" % (self.control_socket, self.pidfile, options)
+ self.spawncmd = "gpsd -N -S %s -F %s -P %s %s" % (fakeport, self.control_socket, self.pidfile, options)
if prefix:
self.spawncmd = prefix + " " + self.spawncmd.strip()
if background:
@@ -358,7 +364,7 @@ class TestSession:
def client_add(self, commands):
"Initiate a client session and force connection to a fake GPS."
self.progress("gpsfake: client_add()\n")
- newclient = gps.gps()
+ newclient = gps.gps(port=fakeport)
self.clients.append(newclient)
newclient.id = self.client_id + 1
self.client_id += 1