[gnome-settings-daemon] tests: Add dbus-monitor logging



commit c97c65b42aced616488ec66800e93be21635ae75
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 24 16:54:05 2013 +0100

    tests: Add dbus-monitor logging

 tests/gsdtestcase.py |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py
index 3dd902e..0947805 100644
--- a/tests/gsdtestcase.py
+++ b/tests/gsdtestcase.py
@@ -80,6 +80,7 @@ class GSDTestCase(dbusmock.DBusTestCase):
         set_nonblock(klass.p_notify.stdout)
 
         klass.start_session()
+        klass.start_monitor()
 
         klass.settings_session = Gio.Settings('org.gnome.desktop.session')
 
@@ -87,6 +88,7 @@ class GSDTestCase(dbusmock.DBusTestCase):
     def tearDownClass(klass):
         klass.p_notify.terminate()
         klass.p_notify.wait()
+        klass.stop_monitor()
         klass.stop_session()
         dbusmock.DBusTestCase.tearDownClass()
         klass.stop_xorg()
@@ -157,6 +159,28 @@ class GSDTestCase(dbusmock.DBusTestCase):
         klass.session_log.flush()
         klass.session_log.close()
 
+    @classmethod
+    def start_monitor(klass):
+        '''Start dbus-monitor'''
+
+        # You can rename the log file to *.log if you want to see it on test
+        # case failures
+        klass.monitor_log = open(os.path.join(klass.workdir, 'dbus-monitor.out'), 'wb')
+        klass.monitor = subprocess.Popen(['dbus-monitor', '--monitor'],
+                                         stdout=klass.monitor_log,
+                                         stderr=subprocess.STDOUT)
+
+    @classmethod
+    def stop_monitor(klass):
+        '''Stop dbus-monitor'''
+
+        assert klass.monitor
+        klass.monitor.terminate()
+        klass.monitor.wait()
+
+        klass.monitor_log.flush()
+        klass.monitor_log.close()
+
     def start_logind(self):
         '''start mock logind'''
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]