[oe-commits] Stefan Stanacar : lib/oeqa/runtime: rpm: add install and erase tests

git at git.openembedded.org git at git.openembedded.org
Mon Aug 26 09:55:54 UTC 2013


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

Author: Stefan Stanacar <stefanx.stanacar at intel.com>
Date:   Tue Aug 20 16:13:29 2013 +0300

lib/oeqa/runtime: rpm: add install and erase tests

Copies to target rpm-doc file from deploy_dir
and tries to install and then remove that package.
rpm-doc was chosen because it's small, it only adds
a few files to target, and it's almost always found in
deploy_dir for images with package-management/rpm.

Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>

---

 meta/lib/oeqa/runtime/rpm.py |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py
index 57101b0..154cad5 100644
--- a/meta/lib/oeqa/runtime/rpm.py
+++ b/meta/lib/oeqa/runtime/rpm.py
@@ -1,6 +1,8 @@
 import unittest
+import os
 from oeqa.oetest import oeRuntimeTest, skipModule
 from oeqa.utils.decorators import *
+import oe.packagedata
 
 def setUpModule():
     if not oeRuntimeTest.hasFeature("package-management"):
@@ -9,17 +11,39 @@ def setUpModule():
             skipModule("rpm module skipped: target doesn't have rpm as primary package manager")
 
 
-class RpmHelpTest(oeRuntimeTest):
+class RpmBasicTest(oeRuntimeTest):
 
     @skipUnlessPassed('test_ssh')
     def test_rpm_help(self):
         (status, output) = self.target.run('rpm --help')
         self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
 
-class RpmQueryTest(oeRuntimeTest):
-
     @skipUnlessPassed('test_rpm_help')
     def test_rpm_query(self):
         (status, output) = self.target.run('rpm -q rpm')
         self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output))
 
+class RpmInstallRemoveTest(oeRuntimeTest):
+
+    @classmethod
+    def setUpClass(self):
+        deploydir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), "rpm", oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True))
+        pkgdata = oe.packagedata.read_subpkgdata("rpm-doc", oeRuntimeTest.tc.d)
+        # pick rpm-doc as a test file to get installed, because it's small and it will always be built for standard targets
+        testrpmfile = "rpm-doc-%s-%s.%s.rpm" % (pkgdata["PKGV"], pkgdata["PKGR"], oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True))
+        oeRuntimeTest.tc.target.copy_to(os.path.join(deploydir,testrpmfile), "/tmp/rpm-doc.rpm")
+
+    @skipUnlessPassed('test_rpm_help')
+    def test_rpm_install(self):
+        (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm')
+        self.assertEqual(status, 0, msg="Failed to install rpm-doc package: %s" % output)
+
+    @skipUnlessPassed('test_rpm_install')
+    def test_rpm_remove(self):
+        (status,output) = self.target.run('rpm -e rpm-doc')
+        self.assertEqual(status, 0, msg="Failed to remove rpm-doc package: %s" % output)
+
+    @classmethod
+    def tearDownClass(self):
+        oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm')
+



More information about the Openembedded-commits mailing list