summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/cases/rpm.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/rpm.py')
-rw-r--r--meta/lib/oeqa/runtime/cases/rpm.py32
1 files changed, 11 insertions, 21 deletions
diff --git a/meta/lib/oeqa/runtime/cases/rpm.py b/meta/lib/oeqa/runtime/cases/rpm.py
index 8e18b426f8..203fcc8505 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 = "User %s has processes still running: %s" % (u, "\n".join(user_pss))
61 self.fail(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)
@@ -141,13 +140,4 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
141 140
142 self.tc.target.run('rm -f %s' % self.dst) 141 self.tc.target.run('rm -f %s' % self.dst)
143 142
144 # if using systemd this should ensure all entries are flushed to /var
145 status, output = self.target.run("journalctl --sync")
146 # Get the amount of entries in the log file
147 status, output = self.target.run(check_log_cmd)
148 msg = 'Failed to get the final size of the log file.'
149 self.assertEqual(0, status, msg=msg)
150 143
151 # Check that there's enough of them
152 self.assertGreaterEqual(int(output), 80,
153 'Cound not find sufficient amount of rpm entries in /var/log/messages, found {} entries'.format(output))