summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2013-02-15 09:29:42 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2013-02-26 12:03:43 +0100
commit5ae059affcd72987b9881fc2421140258cdb84f8 (patch)
tree4106f58fec1c7348d41c58db4dc39727e6c934f7 /test
parent9156ff3598ccf33f919b8a947a9978ac3f181320 (diff)
D-Bus testing: optionally use gzip
The dbus-monitor output can be very large. Handle that a bit better by compressing the file with a gzip pipe. Experimental and a bit broken: output is not flushed properly when killing dbus-monitor + gzip.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-dbus.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/test-dbus.py b/test/test-dbus.py
index 856a03c5..ecabd02b 100755
--- a/test/test-dbus.py
+++ b/test/test-dbus.py
@@ -35,6 +35,7 @@ import traceback
import ConfigParser
import io
import inspect
+import gzip
import dbus
from dbus.mainloop.glib import DBusGMainLoop
@@ -494,15 +495,21 @@ class DBusUtil(Timeout):
# of the D-Bus log
self.runTestDBusCheck = None
+ # Compress dbus log with gzip. Warning, can lead to truncated logs
+ # when gzip doesn't flush everything in time.
+ useGZip = os.environ.get("TEST_DBUS_GZIP", False)
+
# testAutoSyncFailure (__main__.TestSessionAPIsDummy) => testAutoSyncFailure_TestSessionAPIsDummy
testname = str(self).replace(" ", "_").replace("__main__.", "").replace("(", "").replace(")", "")
dbuslog = testname + ".dbus.log"
+ if useGZip:
+ dbuslog = dbuslog + ".gz"
syncevolog = testname + ".syncevo.log"
- self.pmonitor = subprocess.Popen(monitor,
+ self.pmonitor = subprocess.Popen(useGZip and ['sh', '-c', 'dbus-monitor | gzip'] or ['dbus-monitor'],
stdout=open(dbuslog, "w"),
stderr=subprocess.STDOUT)
-
+
if debugger:
print "\n%s: %s\n" % (self.id(), self.shortDescription())
if env.get("HOME") != os.environ.get("HOME") and \
@@ -610,10 +617,14 @@ class DBusUtil(Timeout):
print " dbus-monitor had to be killed with SIGKILL"
result.errors.append((self,
"dbus-monitor had to be killed with SIGKILL"))
+
+ dbusLogLimit = 1000 * 80 # roughly 1000 lines as limit
if debugger:
monitorout = '<see %s>' % dbuslog
+ elif useGZip:
+ monitorout = dbuslog + ':\n' + gzip.GzipFile(dbuslog).read(dbusLogLimit)
else:
- monitorout = open(dbuslog).read()
+ monitorout = dbuslog + ':\n' + open(dbuslog).read(dbusLogLimit)
report = "\n\nD-Bus traffic:\n%s\n\nserver output:\n%s\n" % \
(monitorout, serverout)
if self.runTestDBusCheck: