aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2014-01-09 16:01:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-14 11:33:16 +0000
commit4d6422a84eba005a6fd788ce18c9dd42b079e2a8 (patch)
tree426395816da54695d4c353e3d432d60bd155d2bc /meta/lib/oeqa/runtime
parenta5e6926cd409140d16391c72316da00ffbfe5429 (diff)
downloadopenembedded-core-contrib-4d6422a84eba005a6fd788ce18c9dd42b079e2a8.tar.gz
oeqa/runtime/systemd: wait for services to start/fail
When checking that no services have failed to start, actually wait for services to finish starting by waiting for there not be no units in the "activating" state. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/lib/oeqa/runtime')
-rw-r--r--meta/lib/oeqa/runtime/systemd.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py
index eed29d3952..6414dd6e0e 100644
--- a/meta/lib/oeqa/runtime/systemd.py
+++ b/meta/lib/oeqa/runtime/systemd.py
@@ -32,8 +32,36 @@ class SystemdBasicTests(SystemdTest):
def test_systemd_list(self):
self.systemctl('list-unit-files')
+ def settle(self):
+ """
+ Block until systemd has finished activating any units being activated,
+ or until two minutes has elapsed.
+
+ Returns a tuple, either (True, None) if all units have finished
+ acitvating, or (False, message string) if there are still units
+ activating (generally, failing units that restart).
+ """
+ import time
+ settled = False
+ endtime = time.time() + (60 * 2)
+ while time.time() < endtime:
+ status = self.target.run('systemctl --state=activating | grep -q "0 loaded units listed"')
+ if status == 0:
+ settled = True
+ break
+ time.sleep(10)
+
+ if settled:
+ return (True, None)
+ else:
+ status, output = self.target.run('systemctl --state=activating')
+ return (settled, output)
+
@skipUnlessPassed('test_systemd_basic')
def test_systemd_failed(self):
+ settled, output = self.settle()
+ self.assertTrue(settled, msg="Timed out waiting for systemd to settle:\n" + output)
+
output = self.systemctl('list-units', '--failed')
match = re.search("0 loaded units listed", output)
if not match: