From f5286a09fa21f380a251c8d0f80576830348fa5f Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 4 Mar 2013 07:23:42 -0800 Subject: D-Bus testing: catch server startup failure When starting the server fails, an exception gets thrown when trying to determine its pid. This used to abort the whole test script without recording much information. In particular the server's output was not included. Now the exception is caught, recorded as error and testing continues with the next test. This did not fix the root cause (a stuck process occupied the D-Bus name) but at least it helped to identify the problem. --- test/test-dbus.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/test-dbus.py b/test/test-dbus.py index 4d8278c0..29c04092 100755 --- a/test/test-dbus.py +++ b/test/test-dbus.py @@ -564,7 +564,13 @@ class DBusUtil(Timeout): # pserver.pid is not necessarily the pid of syncevo-dbus-server. # It might be the child of the pserver process. - self.pserverpid = self.serverPid() + try: + self.pserverpid = self.serverPid() + self.running = True + except: + result.errors.append((self, + "server startup failed: %s\nchildren: %s" % (traceback.format_exc(), self.getChildren()))) + self.running = False numerrors = len(result.errors) numfailures = len(result.failures) @@ -587,8 +593,8 @@ class DBusUtil(Timeout): else: logging.printf('killing test disabled') try: - self.running = True - unittest.TestCase.run(self, result) + if self.running: + unittest.TestCase.run(self, result) except KeyboardInterrupt, ex: # somehow this happens when timedout() above raises the exception # while inside glib main loop -- cgit v1.2.3