diff options
author | Daniel Istrate <daniel.alexandrux.istrate@intel.com> | 2015-07-15 17:39:52 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-23 08:48:38 +0100 |
commit | 1bfb9327b7d7bba5b739483ee8571f1fe8263197 (patch) | |
tree | 5af29779ebd79f02e472ebe8cb52b3656335f1b6 /meta/lib | |
parent | 0d1f10e6adc8aba58105c81b6bdd7e77f4f8871f (diff) | |
download | poky-1bfb9327b7d7bba5b739483ee8571f1fe8263197.tar.gz |
oeqa/runtime: Added a new automated rpm test.
testcase 195: Check rpm install/removal log file size
(From OE-Core rev: abf07439e59180a79518e8a2443930104e9e71d0)
Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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') |