D-Bus testing: improved interactive testing with gdb
Avoid race condition after starting gdb by simply checking for the presence of syncevo-dbus-server on the session bus. Previously the output was checked, which failed due to race conditions and/or unexpected output when setting breakpoints (not investigated further). Once the test failed, print the failure or error immediately instead of in the summary after gdb quit. This is information which might be relevant for debugging the running syncevo-dbus-server. After gdb quit, don't attempt to read the syncevo-dbus-server output file (doesn't exit) and don't dump the D-Bus output to the screen (usually too long to read without less, which is not possible when doing interactive debugging). Instead point to the log file.
This commit is contained in:
parent
a8a3788a58
commit
956c3616dd
|
@ -507,19 +507,9 @@ class DBusUtil(Timeout):
|
|||
DBusUtil.pserver = subprocess.Popen([debugger] + gdbinit + server,
|
||||
env=env)
|
||||
|
||||
while True:
|
||||
check = subprocess.Popen("ps x | grep %s | grep -w -v -e %s -e grep -e ps" % \
|
||||
(server[0], debugger),
|
||||
env=env,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE)
|
||||
out, err = check.communicate()
|
||||
if out:
|
||||
# process exists, but might still be loading,
|
||||
# so give it some more time
|
||||
print "found syncevo-dbus-server, starting test in two seconds:\n", out
|
||||
time.sleep(2)
|
||||
break
|
||||
while not bus.name_has_owner('org.syncevolution'):
|
||||
time.sleep(1)
|
||||
print "\nfound org.syncevolution on session bus, starting test"
|
||||
else:
|
||||
logfile = open(syncevolog, "w")
|
||||
prefix = os.environ.get("TEST_DBUS_PREFIX", "")
|
||||
|
@ -579,7 +569,10 @@ class DBusUtil(Timeout):
|
|||
self.running = False
|
||||
self.removeTimeout(timeout_handle)
|
||||
if debugger:
|
||||
print "\ndone, quit gdb now\n"
|
||||
# Print result of this test run.
|
||||
for test, trace in result.errors[numerrors:] + result.failures[numfailures:]:
|
||||
print trace
|
||||
print "\nDone, quit gdb now to proceed.\nSee %s for D-Bus messages.\n" % dbuslog
|
||||
hasfailed = numerrors + numfailures != len(result.errors) + len(result.failures)
|
||||
|
||||
if debugger:
|
||||
|
@ -598,17 +591,23 @@ class DBusUtil(Timeout):
|
|||
print " ", error
|
||||
result.errors.append((self, error))
|
||||
|
||||
serverout = open(syncevolog).read()
|
||||
if debugger:
|
||||
serverout = '<see console>'
|
||||
else:
|
||||
serverout = open(syncevolog).read()
|
||||
if DBusUtil.pserver is not None and DBusUtil.pserver.returncode != -15:
|
||||
hasfailed = True
|
||||
if hasfailed:
|
||||
if hasfailed and not debugger:
|
||||
# give D-Bus time to settle down
|
||||
time.sleep(1)
|
||||
if not ShutdownSubprocess(self.pmonitor, 5):
|
||||
print " dbus-monitor had to be killed with SIGKILL"
|
||||
result.errors.append((self,
|
||||
"dbus-monitor had to be killed with SIGKILL"))
|
||||
monitorout = open(dbuslog).read()
|
||||
if debugger:
|
||||
monitorout = '<see %s>' % dbuslog
|
||||
else:
|
||||
monitorout = open(dbuslog).read()
|
||||
report = "\n\nD-Bus traffic:\n%s\n\nserver output:\n%s\n" % \
|
||||
(monitorout, serverout)
|
||||
if self.runTestDBusCheck:
|
||||
|
|
Loading…
Reference in New Issue