summaryrefslogtreecommitdiff
path: root/gpsfake
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-07-25 22:26:24 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-07-25 22:26:24 +0000
commitc61d61d77f5fc2e85d01290ae7312a08e004396f (patch)
treede5dc98177b1d01b3481d49487e50bfe50f01107 /gpsfake
parent0b6ad90a01e9cc8fbd258952e30f1778b6c97588 (diff)
downloadgpsd-c61d61d77f5fc2e85d01290ae7312a08e004396f.tar.gz
Fix breakage in a test, handle faking a port for regression
tests more gracefully.
Diffstat (limited to 'gpsfake')
-rwxr-xr-xgpsfake10
1 files changed, 9 insertions, 1 deletions
diff --git a/gpsfake b/gpsfake
index 389df231..b24bfa23 100755
--- a/gpsfake
+++ b/gpsfake
@@ -9,6 +9,12 @@
import sys, os, signal, time, getopt, socket
import gpsfake
+# So we can do regression tests without stepping on 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 Baton:
"Ship progress indications to stderr."
def __init__(self, prompt, endmsg=None):
@@ -45,6 +51,7 @@ except getopt.GetoptError, msg:
print "gpsfake: " + str(msg)
raise SystemExit, 1
+port = None
progress = False
cycle = 0
monitor = ""
@@ -59,6 +66,7 @@ verbose = False
for (switch, val) in options:
if (switch == '-1'):
singleshot = True
+ port = fakeport
elif (switch == '-b'):
progress = True
elif (switch == '-c'):
@@ -116,7 +124,7 @@ def fakehook(linenumber, fakegps):
if progress:
baton = Baton("Processing %s" % logfile, "done")
-test = gpsfake.TestSession(prefix=monitor, options=doptions, verbose=verbose)
+test = gpsfake.TestSession(prefix=monitor, port=port, options=doptions, verbose=verbose)
if pipe:
test.reporter = sys.stdout.write