diff options
author | Mikko Rapeli <mikko.rapeli@linaro.org> | 2024-01-04 15:51:12 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-07 12:24:57 +0000 |
commit | a703d8ddef64b5fd0942af321ee1dab23bb1742f (patch) | |
tree | 374586c2901230f2f63b7ffaa00fb2c17d68e182 /meta/lib | |
parent | 64d5db2f89b4f3712b55127215ae02ce50dd747a (diff) | |
download | poky-a703d8ddef64b5fd0942af321ee1dab23bb1742f.tar.gz |
oeqa systemd.py: settle() using "running" or "degraded" state
systemd boot has completed when system is in "running" or "degraded"
(some services failed) state. Check for that in the systemd settle()
function instead of listing all services and checking their activation
state since some services are in activation state even when whole
system is already in "running" state. Examples of services which can be
in activation state are rootfs auto mounting related generated services.
Without this patch systemd test_systemd_list (systemd.SystemdBasicTests) times
out on an image with dm-verity /usr partition and systemd generated
rootfs:
NOTE: ... FAIL
Traceback (most recent call last):
File "/home/builder/src/base/build/../poky/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
return func(*args, **kwargs)
File "/home/builder/src/base/poky/meta/lib/oeqa/runtime/cases/systemd.py", line 97, in test_systemd_failed
self.assertTrue(settled, msg=msg)
AssertionError: False is not true : Timed out waiting for systemd to settle:
UNIT LOAD ACTIVE SUB
DESCRIPTION
dev-disk-by\x2did-dm\x2dname\x2droot.device loaded activating tentativ
e /dev/disk/by-id/dm-name-root
dev-disk-by\x2did-dm\x2dname\x2dusr.device loaded activating tentativ
e /dev/disk/by-id/dm-name-usr
dev-disk-by\x2did-dm\x2duuid\x2dCRYPT\x2dLUKS2\x2df2b944f394174eb5918cb6af2c6b4cb2\x2droot.device loaded activating tentativ
e /dev/disk/by-id/dm-uuid-CRYPT-LUKS2-f2b944f394174eb5918cb6af2c6b4cb2-root
dev-disk-by\x2did-dm\x2duuid\x2dCRYPT\x2dVERITY\x2d3dd703c88f1946658697a6d57617473b\x2dusr.device loaded activating tentativ
e /dev/disk/by-id/dm-uuid-CRYPT-VERITY-3dd703c88f1946658697a6d57617473b-usr
dev-disk-by\x2duuid-bfbf856e\x2d3c65\x2d4eb2\x2d9ffb\x2d8e0b11641d85.device loaded activating tentativ
e /dev/disk/by-uuid/bfbf856e-3c65-4eb2-9ffb-8e0b11641d85
dev-dm\x2d0.device loaded activating tentativ
e /dev/dm-0
dev-dm\x2d1.device loaded activating tentativ
e /dev/dm-1
...
Fix is to check for the systemd global "running" or "degraded" state.
Note that it would be possible to use a blocking call
"systemctl is-system-running --wait" to exit after system enters "running"
or "degraded" state but using the existing loop for a 2 minute timeout.
(From OE-Core rev: 3b013ae441d117adeda0d9950e02e9f7d0deba2f)
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/systemd.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/oeqa/runtime/cases/systemd.py b/meta/lib/oeqa/runtime/cases/systemd.py index 2865887959..5481e1d840 100644 --- a/meta/lib/oeqa/runtime/cases/systemd.py +++ b/meta/lib/oeqa/runtime/cases/systemd.py | |||
@@ -69,8 +69,8 @@ class SystemdBasicTests(SystemdTest): | |||
69 | """ | 69 | """ |
70 | endtime = time.time() + (60 * 2) | 70 | endtime = time.time() + (60 * 2) |
71 | while True: | 71 | while True: |
72 | status, output = self.target.run('SYSTEMD_BUS_TIMEOUT=240s systemctl --state=activating') | 72 | status, output = self.target.run('SYSTEMD_BUS_TIMEOUT=240s systemctl is-system-running') |
73 | if "0 loaded units listed" in output: | 73 | if "running" in output or "degraded" in output: |
74 | return (True, '') | 74 | return (True, '') |
75 | if time.time() >= endtime: | 75 | if time.time() >= endtime: |
76 | return (False, output) | 76 | return (False, output) |