summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-06-14 13:07:30 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-06-14 13:07:30 +0200
commit55569ac40f1756b879a5ee676925be7bbd985588 (patch)
tree05a72e77ca877d0123b5935244dd90a2327aabfa /src
parent2b216e7db350944e7beaf4cb881a7146402e8e0a (diff)
integration-test: fail on CRITICALs
Crash the daemon on any CRITICAL message, and also set WARNING and CRITICAL messages to be fatal on the client side. On the server side we might have some legitimate warnings, such as failing to load the config file from /usr/local/etc (if you build a tree without passing correct --sysconfdir options, etc.). This exposes the current CRITICAL the daemon raises at startup. As with that the daemon never starts up, fix the "wait for the daemon" loop to time out after 10 seconds.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/linux/integration-test12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/linux/integration-test b/src/linux/integration-test
index df61495..986d98d 100755
--- a/src/linux/integration-test
+++ b/src/linux/integration-test
@@ -58,6 +58,11 @@ class Tests(unittest.TestCase):
break
assert daemon_path, 'could not determine daemon path from D-BUS .service file'
+ # fail on CRITICALs on client side
+ GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_WARNING|
+ GLib.LogLevelFlags.LEVEL_ERROR|
+ GLib.LogLevelFlags.LEVEL_CRITICAL)
+
# if we are root, test the real thing on the system bus, otherwise
# start on the session bus
if os.geteuid() == 0:
@@ -163,19 +168,24 @@ class Tests(unittest.TestCase):
When done, this sets self.proxy a the Gio.DBusProxy for upowerd.
'''
env = os.environ.copy()
+ env['G_DEBUG'] = 'fatal-criticals'
env['SYSFS_PATH'] = self.sysfs
self.log = tempfile.NamedTemporaryFile()
self.daemon = subprocess.Popen(self.daemon_argv,
env=env, stdout=self.log, stderr=subprocess.STDOUT)
# wait until the daemon gets online
- while True:
+ timeout = 100
+ while timeout > 0:
time.sleep(0.1)
+ timeout -= 1
try:
self.get_dbus_property('DaemonVersion')
break
except GLib.GError:
pass
+ else:
+ self.fail('daemon did not start in 10 seconds')
self.proxy = Gio.DBusProxy.new_sync(self.dbus,
Gio.DBusProxyFlags.DO_NOT_AUTO_START, None,