summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-03-04 07:23:42 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2013-03-04 07:36:22 -0800
commitf5286a09fa21f380a251c8d0f80576830348fa5f (patch)
tree71f0c27e5f741e9dc200300eeb2dba49061c0fd6
parente8f7753573909306af0593984a956af2d9e22155 (diff)
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.
-rwxr-xr-xtest/test-dbus.py12
1 files 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