D-Bus testing: don't depend on server output during startup, truely quiet TEST_DBUS_QUIET

When asked to run quietly via a non-empty TEST_DBUS_QUIET,
test-dbus.py still enabled INFO messages to determine that the server
is ready. Waiting for bus name (as already done when starting with a
debugger) avoids that and allows us to disable all LogOutput signals.
This commit is contained in:
Patrick Ohly 2013-07-10 15:37:37 +02:00
parent 0a3ec71e92
commit a69018e6da
1 changed files with 7 additions and 10 deletions

View File

@ -72,9 +72,11 @@ except ImportError:
DBusGMainLoop(set_as_default=True)
debugger = os.environ.get("TEST_DBUS_GDB", None) and "gdb" or ""
# Verbosity must at least include INFO messages, the "ready to run" we
# wait for is not printed otherwise. Default is DEBUG.
level = os.environ.get("TEST_DBUS_QUIET", False) and 2 or 3
# Default verbosity is DEBUG.
if os.environ.get("TEST_DBUS_QUIET", False):
level = 0
else:
level = 3
server = ("syncevo-dbus-server --no-syslog --stdout --verbosity=%d --dbus-verbosity=%d" % (level, level)).split()
# primarily for XDG files, but also other temporary files
@ -580,13 +582,8 @@ class DBusUtil(Timeout):
stdout=logfile,
stderr=subprocess.STDOUT)
if logfile != None:
while self.isServerRunning():
newsize = os.path.getsize(syncevolog)
if newsize != size:
if "] ready to run\n" in open(syncevolog).read():
break
size = newsize
time.sleep(1)
while self.isServerRunning() and not bus.name_has_owner('org.syncevolution'):
time.sleep(1)
else:
print "test-dbus.py: giving syncevo-dbus-server time to start"
time.sleep(5)