diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-02-14 07:41:38 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-02-14 07:41:38 -0500 |
commit | 2d427766de94193023f9ffef05e5dfff1565f557 (patch) | |
tree | 54051ad9e2f49443ecce01899d5cd07f2c27bb4d /gps/fake.py | |
parent | 347b538f059066f0c9de298b9acb10f3d3cd6dec (diff) | |
download | gpsd-2d427766de94193023f9ffef05e5dfff1565f557.tar.gz |
Time out hangs in single-shot tests.
All regression tests pass.
Diffstat (limited to 'gps/fake.py')
-rw-r--r-- | gps/fake.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gps/fake.py b/gps/fake.py index 6da595df..9452ce9b 100644 --- a/gps/fake.py +++ b/gps/fake.py @@ -105,6 +105,9 @@ else: # Additional delays in slow mode WRITE_PAD_SLOWDOWN = 0.01 +# If a test takes longer than this, we deem it to have timed out +TEST_TIMEOUT = 60 + class TestLoadError(exceptions.Exception): def __init__(self, msg): exceptions.Exception.__init__(self) @@ -623,7 +626,10 @@ class TestSession: had_output = False chosen = self.choose() if isinstance(chosen, FakeGPS): - if not chosen.go_predicate(chosen.index, chosen): + if chosen.exhausted and (time.time() - chosen.exhausted > TEST_TIMEOUT) and chosen.byname in self.fakegpslist: + sys.stderr.write("Test timed out: increase WRITE_PAD = %s" % WRITE_PAD) + raise SystemExit, 1 + 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) |