testing: run syncevo-dbus-server under valgrind (BMC #5609)

The test prefix needs to be passed through test-dbus.py to the
invocation of syncevo-dbus-server. Done with the new
TEST_DBUS_PREFIX env variable: set by runtests.py, used by test-dbus.py.

Also cleaned up the delay loop for starting syncevo-dbus-server:
the logic for reloading the log file was overly conservative. The file
only needs to be re-read when the file size has changed since the
last check (in contrast to the previous behavior or checkings always
if different from before the loop).
This commit is contained in:
Patrick Ohly 2011-11-29 16:25:08 +00:00
parent 26f31f5be6
commit 29fee7a2bc
2 changed files with 17 additions and 6 deletions

View File

@ -960,13 +960,15 @@ evolutiontest = SyncEvolutionTest("evolution", compile,
testPrefix=options.testprefix)
context.add(evolutiontest)
# test-dbus.py doesn't need valgrind, remove it
# test-dbus.py itself doesn't need to run under valgrind, remove it...
shell = re.sub(r'\S*valgrind\S*', '', options.shell)
testprefix = re.sub(r'\S*valgrind\S*', '', options.testprefix)
dbustest = SyncEvolutionTest("dbus", compile,
"", shell,
"",
[],
# ... but syncevo-dbus-server started by test-dbus.py should use valgrind
testenv="TEST_DBUS_PREFIX='%s'" % options.testprefix,
testPrefix=testprefix,
testBinary=os.path.join(sync.basedir,
"test",

View File

@ -410,16 +410,25 @@ class DBusUtil(Timeout):
break
else:
logfile = open(syncevolog, "w")
logfile.write("env:\n%s\n\nargs:\n%s\n\n" % (env, server + serverArgs))
prefix = os.environ.get("TEST_DBUS_PREFIX", "")
args = []
if prefix:
args.append(prefix)
args.extend(server)
args.extend(serverArgs)
logfile.write("env:\n%s\n\nargs:\n%s\n\n" % (env, args))
logfile.flush()
size = os.path.getsize(syncevolog)
DBusUtil.pserver = subprocess.Popen(server + serverArgs,
DBusUtil.pserver = subprocess.Popen(args,
env=env,
stdout=logfile,
stderr=subprocess.STDOUT)
while (os.path.getsize(syncevolog) == size or \
not ("syncevo-dbus-server: ready to run" in open(syncevolog).read())) and \
self.isServerRunning():
while self.isServerRunning():
newsize = os.path.getsize(syncevolog)
if newsize != size:
if "syncevo-dbus-server: ready to run" in open(syncevolog).read():
break
size = newsize
time.sleep(1)
numerrors = len(result.errors)