diff options
author | Pavel Zhukov <pavel@zhukoff.net> | 2022-12-25 13:46:58 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-01-15 11:05:15 +0000 |
commit | 36209ca38ffa9919b996d96a2e0c29f3e86372da (patch) | |
tree | 30c887291b05e790448f00ed931c22e4c1a7c1fa /meta/lib | |
parent | f8187daf0ab7b7ece4750d9b49e9bdf8778dfb25 (diff) | |
download | poky-36209ca38ffa9919b996d96a2e0c29f3e86372da.tar.gz |
oeqa/rpm.py: Increase timeout and add debug output
[Yocto #14346]
Systemd may be slow in killing pam session sometimes [1][2]. It may cause rpm
test to fail because there's process (sd_pam) running and own by "test1" user
after timeout.
Increasing timeout to 2 mins and assert earlier with debug output if
there's such process(es). If increasing of timeout doesn't help we may
want to force deletion of the user as [2] suggests.
[1] https://github.com/systemd/systemd/issues/8598
[2] https://access.redhat.com/solutions/6969188
(From OE-Core rev: 36491639258c6f9f0bd1890ee68f8e2f44a77e72)
Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 972fcc0ed1e0d36c3470071a9c667c5327c1ef78)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/rpm.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/meta/lib/oeqa/runtime/cases/rpm.py b/meta/lib/oeqa/runtime/cases/rpm.py index a4339116bf..5bdce3d522 100644 --- a/meta/lib/oeqa/runtime/cases/rpm.py +++ b/meta/lib/oeqa/runtime/cases/rpm.py | |||
@@ -49,21 +49,20 @@ class RpmBasicTest(OERuntimeTestCase): | |||
49 | msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output) | 49 | msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output) |
50 | self.assertEqual(status, 0, msg=msg) | 50 | self.assertEqual(status, 0, msg=msg) |
51 | 51 | ||
52 | def check_no_process_for_user(u): | 52 | def wait_for_no_process_for_user(u, timeout = 120): |
53 | _, output = self.target.run(self.tc.target_cmds['ps']) | 53 | timeout_at = time.time() + timeout |
54 | if u + ' ' in output: | 54 | while time.time() < timeout_at: |
55 | return False | 55 | _, output = self.target.run(self.tc.target_cmds['ps']) |
56 | else: | 56 | if u + ' ' not in output: |
57 | return True | 57 | return |
58 | time.sleep(1) | ||
59 | user_pss = [ps for ps in output.split("\n") if u + ' ' in ps] | ||
60 | msg = "There're %s 's process(es) still running: %s".format(u, "\n".join(user_pss)) | ||
61 | assertTrue(True, msg=msg) | ||
58 | 62 | ||
59 | def unset_up_test_user(u): | 63 | def unset_up_test_user(u): |
60 | # ensure no test1 process in running | 64 | # ensure no test1 process in running |
61 | timeout = time.time() + 30 | 65 | wait_for_no_process_for_user(u) |
62 | while time.time() < timeout: | ||
63 | if check_no_process_for_user(u): | ||
64 | break | ||
65 | else: | ||
66 | time.sleep(1) | ||
67 | status, output = self.target.run('userdel -r %s' % u) | 66 | status, output = self.target.run('userdel -r %s' % u) |
68 | msg = 'Failed to erase user: %s' % output | 67 | msg = 'Failed to erase user: %s' % output |
69 | self.assertTrue(status == 0, msg=msg) | 68 | self.assertTrue(status == 0, msg=msg) |