summaryrefslogtreecommitdiffstats
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:50 +0000
commitcc8170f1181c855e230ab08c5cae387d740fef61 (patch)
treea66ffebc6277932a999d94381d985dbf89e08c45 /meta/lib/oeqa/runtime
parent1b636173ca88e5ccca1992f9a12367a1189fa674 (diff)
downloadpoky-cc8170f1181c855e230ab08c5cae387d740fef61.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. (From OE-Core rev: 4d6422a84eba005a6fd788ce18c9dd42b079e2a8) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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):
32 def test_systemd_list(self): 32 def test_systemd_list(self):
33 self.systemctl('list-unit-files') 33 self.systemctl('list-unit-files')
34 34
35 def settle(self):
36 """
37 Block until systemd has finished activating any units being activated,
38 or until two minutes has elapsed.
39
40 Returns a tuple, either (True, None) if all units have finished
41 acitvating, or (False, message string) if there are still units
42 activating (generally, failing units that restart).
43 """
44 import time
45 settled = False
46 endtime = time.time() + (60 * 2)
47 while time.time() < endtime:
48 status = self.target.run('systemctl --state=activating | grep -q "0 loaded units listed"')
49 if status == 0:
50 settled = True
51 break
52 time.sleep(10)
53
54 if settled:
55 return (True, None)
56 else:
57 status, output = self.target.run('systemctl --state=activating')
58 return (settled, output)
59
35 @skipUnlessPassed('test_systemd_basic') 60 @skipUnlessPassed('test_systemd_basic')
36 def test_systemd_failed(self): 61 def test_systemd_failed(self):
62 settled, output = self.settle()
63 self.assertTrue(settled, msg="Timed out waiting for systemd to settle:\n" + output)
64
37 output = self.systemctl('list-units', '--failed') 65 output = self.systemctl('list-units', '--failed')
38 match = re.search("0 loaded units listed", output) 66 match = re.search("0 loaded units listed", output)
39 if not match: 67 if not match: