summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/cases/rpm.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2017-01-30 20:03:53 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-14 14:42:17 +0000
commitea4bac7e45188cd35f2c88cd0021fc8cfb8b3642 (patch)
tree93f1a0b32707b98e4bcb12bd69c27d3a2bbb6729 /meta/lib/oeqa/runtime/cases/rpm.py
parentdfa298762350289772ef6841d8660912ad00a245 (diff)
downloadpoky-ea4bac7e45188cd35f2c88cd0021fc8cfb8b3642.tar.gz
testimage.bbclass: fix runtime test for rpm, port smart tests to dnf
(From OE-Core rev: 749a496d273f9fd378588e309cf976294584ca5f) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/rpm.py')
-rw-r--r--meta/lib/oeqa/runtime/cases/rpm.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/meta/lib/oeqa/runtime/cases/rpm.py b/meta/lib/oeqa/runtime/cases/rpm.py
index 532fbf82eb..05b94c7b40 100644
--- a/meta/lib/oeqa/runtime/cases/rpm.py
+++ b/meta/lib/oeqa/runtime/cases/rpm.py
@@ -102,14 +102,15 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
102 @OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_remove']) 102 @OETestDepends(['rpm.RpmInstallRemoveTest.test_rpm_remove'])
103 def test_check_rpm_install_removal_log_file_size(self): 103 def test_check_rpm_install_removal_log_file_size(self):
104 """ 104 """
105 Summary: Check rpm install/removal log file size 105 Summary: Check that rpm writes into /var/log/messages
106 Expected: There should be some method to keep rpm log in a small size . 106 Expected: There should be some RPM prefixed entries in the above file.
107 Product: BSPs 107 Product: BSPs
108 Author: Alexandru Georgescu <alexandru.c.georgescu@intel.com> 108 Author: Alexandru Georgescu <alexandru.c.georgescu@intel.com>
109 Author: Alexander Kanavin <alexander.kanavin@intel.com>
109 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> 110 AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
110 """ 111 """
111 db_files_cmd = 'ls /var/lib/rpm/__db.*' 112 db_files_cmd = 'ls /var/lib/rpm/__db.*'
112 get_log_size_cmd = "du /var/lib/rpm/log/log.* | awk '{print $1}'" 113 check_log_cmd = "grep RPM /var/log/messages | wc -l"
113 114
114 # Make sure that some database files are under /var/lib/rpm as '__db.xxx' 115 # Make sure that some database files are under /var/lib/rpm as '__db.xxx'
115 status, output = self.target.run(db_files_cmd) 116 status, output = self.target.run(db_files_cmd)
@@ -129,13 +130,13 @@ class RpmInstallRemoveTest(OERuntimeTestCase):
129 msg = 'Failed to remove rpm-doc package. Reason: {}'.format(output) 130 msg = 'Failed to remove rpm-doc package. Reason: {}'.format(output)
130 self.assertEqual(0, status, msg=msg) 131 self.assertEqual(0, status, msg=msg)
131 132
132 # Get the size of log file 133 # if using systemd this should ensure all entries are flushed to /var
133 status, output = self.target.run(get_log_size_cmd) 134 status, output = self.target.run("journalctl --sync")
135 # Get the amount of entries in the log file
136 status, output = self.target.run(check_log_cmd)
134 msg = 'Failed to get the final size of the log file.' 137 msg = 'Failed to get the final size of the log file.'
135 self.assertEqual(0, status, msg=msg) 138 self.assertEqual(0, status, msg=msg)
136 139
137 # Compare each log size 140 # Check that there's enough of them
138 for log_file_size in output: 141 self.assertGreaterEqual(int(output), 80,
139 msg = ('Log file size is greater that expected (~10MB), ' 142 'Cound not find sufficient amount of rpm entries in /var/log/messages, found {} entries'.format(output))
140 'found {} bytes'.format(log_file_size))
141 self.assertLessEqual(int(log_file_size), 11264, msg=msg)