diff options
author | Ross Burton <ross.burton@intel.com> | 2014-02-04 12:41:15 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-04 12:43:03 +0000 |
commit | 8d107e0a828868702cfe035104c1f0b51da4291e (patch) | |
tree | 4722ca83f91fddd07861a817bb93b6aaf9ca41e6 /meta/lib/oeqa/runtime/systemd.py | |
parent | b01db0424b9cf73e51808f57043710a1c665b2c5 (diff) | |
download | openembedded-core-8d107e0a828868702cfe035104c1f0b51da4291e.tar.gz openembedded-core-8d107e0a828868702cfe035104c1f0b51da4291e.tar.bz2 openembedded-core-8d107e0a828868702cfe035104c1f0b51da4291e.zip |
oeqa/runtime/systemd: remove race in settle()
The settle() function had a race where services could still be activating at two
minutes but then when the final log is output, they've activated.
Remove this race and generally clean up the code.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/systemd.py')
-rw-r--r-- | meta/lib/oeqa/runtime/systemd.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/meta/lib/oeqa/runtime/systemd.py b/meta/lib/oeqa/runtime/systemd.py index 6414dd6e0e..6de84f891b 100644 --- a/meta/lib/oeqa/runtime/systemd.py +++ b/meta/lib/oeqa/runtime/systemd.py @@ -37,25 +37,19 @@ class SystemdBasicTests(SystemdTest): 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 + Returns a tuple, either (True, '') if all units have finished + activating, 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: + while True: status, output = self.target.run('systemctl --state=activating') - return (settled, output) + if "0 loaded units listed" in output: + return (True, '') + if time.time() >= endtime: + return (False, output) + time.sleep(10) @skipUnlessPassed('test_systemd_basic') def test_systemd_failed(self): |