diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-27 15:14:43 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-27 15:14:43 -0500 |
commit | ae654f81a3bbc932d9f42b7bb6c52a84c715a4e0 (patch) | |
tree | 5e5d334cd3419cb7e95077d887a383cf8b27a5db /gps | |
parent | 9b5f8efb899eb1baa64562dd0f94c3025c6c2020 (diff) | |
download | gpsd-ae654f81a3bbc932d9f42b7bb6c52a84c715a4e0.tar.gz |
Investigating ways to get rid of CLOSE_DELAY in the test framework...
...actually revealed a bug - device-shutdown messages getting lost on the
way out to the test clients. This set of changes mostly fixes it. Some
glitches remain; this state of things passes all regression tests but
attempting to get rid of what now ought to be unnecessary code in fake.py
does not pass. To be continued...
Diffstat (limited to 'gps')
-rw-r--r-- | gps/fake.py | 13 | ||||
-rwxr-xr-x | gps/gps.py | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/gps/fake.py b/gps/fake.py index 53f988c5..fcfc245e 100644 --- a/gps/fake.py +++ b/gps/fake.py @@ -626,13 +626,14 @@ class TestSession: had_output = False chosen = self.choose() if isinstance(chosen, FakeGPS): - if chosen.exhausted and (time.time() - chosen.exhausted > CLOSE_DELAY): + if chosen.exhausted and (time.time() - chosen.exhausted > CLOSE_DELAY) and chosen.byname in self.fakegpslist: self.gps_remove(chosen.byname) - self.progress("gpsfake: GPS %s removed\n" % chosen.byname) + self.progress("gpsfake: GPS %s removed (timeout)\n" % chosen.byname) elif not chosen.go_predicate(chosen.index, chosen): if chosen.exhausted == 0: chosen.exhausted = time.time() self.progress("gpsfake: GPS %s ran out of input\n" % chosen.byname) + chosen.write("\n#EOF\n") else: chosen.feed() elif isinstance(chosen, gps.gps): @@ -643,6 +644,14 @@ class TestSession: chosen.read() if chosen.valid & gps.PACKET_SET: self.reporter(chosen.response) + # If we're lucky, this close notification reaches + # us before the device timeout. It would be nice + # if this were the only logic for device closing + # and we could get rid of CLOSE_DELAY, but this + # sometimes fails on binary logfiles. + if chosen.data["class"] == "DEVICE" and chosen.data["activated"] == 0 and chosen.data["path"] in self.fakegpslist: + self.gps_remove(chosen.data["path"]) + self.progress("gpsfake: GPS %s removed (notification)\n" % chosen.byname) had_output = True else: raise TestSessionError("test object of unknown type") @@ -53,7 +53,8 @@ POLICY_SET = (1<<29) LOGMESSAGE_SET = (1<<30) ERROR_SET = (1<<31) TIMEDRIFT_SET = (1<<32) -SET_HIGH_BIT = 33 +EOF_SET = (1<<33) +SET_HIGH_BIT = 34 UNION_SET = (RTCM2_SET|RTCM3_SET|SUBFRAME_SET|AIS_SET|VERSION_SET|DEVICELIST_SET|ERROR_SET|GST_SET) STATUS_NO_FIX = 0 STATUS_FIX = 1 |