diff options
-rw-r--r-- | meta/lib/oeqa/runtime/rpm.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py index 4ca193b045..32aae24232 100644 --- a/meta/lib/oeqa/runtime/rpm.py +++ b/meta/lib/oeqa/runtime/rpm.py | |||
@@ -58,6 +58,43 @@ class RpmInstallRemoveTest(oeRuntimeTest): | |||
58 | (status, output) = self.target.run('sudo -u test1 rpm -qa') | 58 | (status, output) = self.target.run('sudo -u test1 rpm -qa') |
59 | self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa" % status) | 59 | self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa" % status) |
60 | 60 | ||
61 | @testcase(195) | ||
62 | @skipUnlessPassed('test_rpm_install') | ||
63 | def test_check_rpm_install_removal_log_file_size(self): | ||
64 | """ | ||
65 | Summary: Check rpm install/removal log file size | ||
66 | Expected: There should be some method to keep rpm log in a small size . | ||
67 | Product: BSPs | ||
68 | Author: Alexandru Georgescu <alexandru.c.georgescu@intel.com> | ||
69 | AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> | ||
70 | """ | ||
71 | db_files_cmd = 'ls /var/lib/rpm/__db.*' | ||
72 | get_log_size_cmd = "du /var/lib/rpm/log/log.* | awk '{print $1}'" | ||
73 | |||
74 | # Make sure that some database files are under /var/lib/rpm as '__db.xxx' | ||
75 | (status, output) = self.target.run(db_files_cmd) | ||
76 | self.assertEqual(0, status, 'Failed to find database files under /var/lib/rpm/ as __db.xxx') | ||
77 | |||
78 | # Remove the package just in case | ||
79 | self.target.run('rpm -e rpm-doc') | ||
80 | |||
81 | # Install/Remove a package 10 times | ||
82 | for i in range(10): | ||
83 | (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm') | ||
84 | self.assertEqual(0, status, "Failed to install rpm-doc package. Reason: {}".format(output)) | ||
85 | |||
86 | (status, output) = self.target.run('rpm -e rpm-doc') | ||
87 | self.assertEqual(0, status, "Failed to remove rpm-doc package. Reason: {}".format(output)) | ||
88 | |||
89 | # Get the size of log file | ||
90 | (status, output) = self.target.run(get_log_size_cmd) | ||
91 | self.assertEqual(0, status, 'Failed to get the final size of the log file.') | ||
92 | |||
93 | # Compare each log size | ||
94 | for log_file_size in output: | ||
95 | self.assertLessEqual(int(log_file_size), 11264, | ||
96 | 'Log file size is greater that expected (~10MB), found {} bytes'.format(log_file_size)) | ||
97 | |||
61 | @classmethod | 98 | @classmethod |
62 | def tearDownClass(self): | 99 | def tearDownClass(self): |
63 | oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') | 100 | oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') |