summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2017-02-19 00:15:15 -0800
committerFred Wright <fw@fwright.net>2017-02-19 00:23:55 -0800
commitbb66fc3b0987a8a9f9b2cee48be2cd195612ad40 (patch)
tree11e78e82d11214a819381595d54e628187984c6e
parent447c7762b8794ef7876853ee69b8645b77f10f85 (diff)
downloadgpsd-bb66fc3b0987a8a9f9b2cee48be2cd195612ad40.tar.gz
Makes connect failure to dead fake.py daemon more informative.
This generates a more specific exception when a connect from client_add() fails due to the daemon's having died. Aside from real daemon failures, this also catches some broken valgrind cases. TESTED: Ran "scons build-all check" on OSX. Also ran failing valgrind-audit and observed more informative (and less verbose) backtrace. Note that this is due to an OSX issue with valgrind itself, not the daemon.
-rw-r--r--gps/fake.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gps/fake.py b/gps/fake.py
index 08923d5e..b2da7ae1 100644
--- a/gps/fake.py
+++ b/gps/fake.py
@@ -641,7 +641,12 @@ class TestSession(object):
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(port=self.port, verbose=self.verbose)
+ try:
+ newclient = gps.gps(port=self.port, verbose=self.verbose)
+ except socket.error:
+ if not self.daemon.is_alive():
+ raise TestSessionError("daemon died")
+ raise
self.append(newclient)
newclient.id = self.client_id + 1
self.client_id += 1