[oe-commits] Daniel Istrate : oeqa/runtime: Added a new automated rpm test.

git at git.openembedded.org git at git.openembedded.org
Wed Jul 22 22:34:20 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: abf07439e59180a79518e8a2443930104e9e71d0
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=abf07439e59180a79518e8a2443930104e9e71d0

Author: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
Date:   Wed Jul 15 17:39:52 2015 +0300

oeqa/runtime: Added a new automated rpm test.

testcase 195: Check rpm install/removal log file size

Signed-off-by: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/runtime/rpm.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py
index 4ca193b..32aae24 100644
--- a/meta/lib/oeqa/runtime/rpm.py
+++ b/meta/lib/oeqa/runtime/rpm.py
@@ -58,6 +58,43 @@ class RpmInstallRemoveTest(oeRuntimeTest):
         (status, output) = self.target.run('sudo -u test1 rpm -qa')
         self.assertEqual(status, 0, msg="status: %s. Cannot run rpm -qa" % status)
 
+    @testcase(195)
+    @skipUnlessPassed('test_rpm_install')
+    def test_check_rpm_install_removal_log_file_size(self):
+        """
+        Summary:     Check rpm install/removal log file size
+        Expected:    There should be some method to keep rpm log in a small size .
+        Product:     BSPs
+        Author:      Alexandru Georgescu <alexandru.c.georgescu at intel.com>
+        AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate at intel.com>
+        """
+        db_files_cmd = 'ls /var/lib/rpm/__db.*'
+        get_log_size_cmd = "du /var/lib/rpm/log/log.* | awk '{print $1}'"
+
+        # Make sure that some database files are under /var/lib/rpm as '__db.xxx'
+        (status, output) = self.target.run(db_files_cmd)
+        self.assertEqual(0, status, 'Failed to find database files under /var/lib/rpm/ as __db.xxx')
+
+        # Remove the package just in case
+        self.target.run('rpm -e rpm-doc')
+
+        # Install/Remove a package 10 times
+        for i in range(10):
+            (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm')
+            self.assertEqual(0, status, "Failed to install rpm-doc package. Reason: {}".format(output))
+
+            (status, output) = self.target.run('rpm -e rpm-doc')
+            self.assertEqual(0, status, "Failed to remove rpm-doc package. Reason: {}".format(output))
+
+        # Get the size of log file
+        (status, output) = self.target.run(get_log_size_cmd)
+        self.assertEqual(0, status, 'Failed to get the final size of the log file.')
+
+        # Compare each log size
+        for log_file_size in output:
+            self.assertLessEqual(int(log_file_size), 11264,
+                                   'Log file size is greater that expected (~10MB), found {} bytes'.format(log_file_size))
+
     @classmethod
     def tearDownClass(self):
         oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm')



More information about the Openembedded-commits mailing list