summaryrefslogtreecommitdiff
path: root/gpsfake.py
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2007-12-10 18:01:30 +0000
committerEric S. Raymond <esr@thyrsus.com>2007-12-10 18:01:30 +0000
commit74e4c4fb5f939f3f65d8dbae643f77f0354c1bf2 (patch)
tree88749e77cd79ecc3733a1078a314042343e6ad15 /gpsfake.py
parent5a6270d72ac71ecdaae4af569a2f5174d538def0 (diff)
downloadgpsd-74e4c4fb5f939f3f65d8dbae643f77f0354c1bf2.tar.gz
Add more write padding to banish some fluky test failures.
Diffstat (limited to 'gpsfake.py')
-rw-r--r--gpsfake.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/gpsfake.py b/gpsfake.py
index d38948c2..7b592c9c 100644
--- a/gpsfake.py
+++ b/gpsfake.py
@@ -286,8 +286,12 @@ class FakeGPS:
line = self.testload.sentences[self.index % len(self.testload.sentences)]
os.write(self.master_fd, line)
# Delay so we won't spam the buffers in the pty layer or gpsd itself.
- # Assumptions: 1 character is 10 bits (generous; at 8N1 it will be 9).
- time.sleep((10.0 * len(line)) / self.speed)
+ # The magic number here has to be derived from observation. If it's
+ # too high you'll slow the tests down a lot. If it's too low you'll
+ # get random spurious regression failures that usually look like
+ # lines missing from the end of the test output relative to the
+ # check file. It might have to be ajusted upward on faster machines.
+ time.sleep((12.0 * len(line)) / self.speed)
self.index += 1
class DaemonError(exceptions.Exception):