summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Zhukov <pavel@zhukoff.net>2022-12-25 13:46:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-26 18:49:07 +0000
commitf2c5a99994b5634b682ac324d63880427de95d1a (patch)
treed44f1e2429a497b884174dfc1f2fad6921204c74
parent9caff14abbb742e5083056b899ee6fc0a5fba8f3 (diff)
downloadpoky-f2c5a99994b5634b682ac324d63880427de95d1a.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: 972fcc0ed1e0d36c3470071a9c667c5327c1ef78) Signed-off-by: Pavel Zhukov <pavel@zhukoff.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/runtime/cases/rpm.py23
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 e3cd818b2b..fa86eb0537 100644
--- a/meta/lib/oeqa/runtime/cases/rpm.py
+++ b/meta/lib/oeqa/runtime/cases/rpm.py
@@ -51,21 +51,20 @@ class RpmBasicTest(OERuntimeTestCase):
51 msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output) 51 msg = 'status: %s. Cannot run rpm -qa: %s' % (status, output)
52 self.assertEqual(status, 0, msg=msg) 52 self.assertEqual(status, 0, msg=msg)
53 53
54 def check_no_process_for_user(u): 54 def wait_for_no_process_for_user(u, timeout = 120):
55 _, output = self.target.run(self.tc.target_cmds['ps']) 55 timeout_at = time.time() + timeout
56 if u + ' ' in output: 56 while time.time() < timeout_at:
57 return False 57 _, output = self.target.run(self.tc.target_cmds['ps'])
58 else: 58 if u + ' ' not in output:
59 return True 59 return
60 time.sleep(1)
61 user_pss = [ps for ps in output.split("\n") if u + ' ' in ps]
62 msg = "There're %s 's process(es) still running: %s".format(u, "\n".join(user_pss))
63 assertTrue(True, msg=msg)
60 64
61 def unset_up_test_user(u): 65 def unset_up_test_user(u):
62 # ensure no test1 process in running 66 # ensure no test1 process in running
63 timeout = time.time() + 30 67 wait_for_no_process_for_user(u)
64 while time.time() < timeout:
65 if check_no_process_for_user(u):
66 break
67 else:
68 time.sleep(1)
69 status, output = self.target.run('userdel -r %s' % u) 68 status, output = self.target.run('userdel -r %s' % u)
70 msg = 'Failed to erase user: %s' % output 69 msg = 'Failed to erase user: %s' % output
71 self.assertTrue(status == 0, msg=msg) 70 self.assertTrue(status == 0, msg=msg)