diff options
| -rw-r--r-- | 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 57101b0704..154cad5014 100644 --- a/meta/lib/oeqa/runtime/rpm.py +++ b/meta/lib/oeqa/runtime/rpm.py | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | import unittest | 1 | import unittest |
| 2 | import os | ||
| 2 | from oeqa.oetest import oeRuntimeTest, skipModule | 3 | from oeqa.oetest import oeRuntimeTest, skipModule |
| 3 | from oeqa.utils.decorators import * | 4 | from oeqa.utils.decorators import * |
| 5 | import oe.packagedata | ||
| 4 | 6 | ||
| 5 | def setUpModule(): | 7 | def setUpModule(): |
| 6 | if not oeRuntimeTest.hasFeature("package-management"): | 8 | if not oeRuntimeTest.hasFeature("package-management"): |
| @@ -9,17 +11,39 @@ def setUpModule(): | |||
| 9 | skipModule("rpm module skipped: target doesn't have rpm as primary package manager") | 11 | skipModule("rpm module skipped: target doesn't have rpm as primary package manager") |
| 10 | 12 | ||
| 11 | 13 | ||
| 12 | class RpmHelpTest(oeRuntimeTest): | 14 | class RpmBasicTest(oeRuntimeTest): |
| 13 | 15 | ||
| 14 | @skipUnlessPassed('test_ssh') | 16 | @skipUnlessPassed('test_ssh') |
| 15 | def test_rpm_help(self): | 17 | def test_rpm_help(self): |
| 16 | (status, output) = self.target.run('rpm --help') | 18 | (status, output) = self.target.run('rpm --help') |
| 17 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | 19 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) |
| 18 | 20 | ||
| 19 | class RpmQueryTest(oeRuntimeTest): | ||
| 20 | |||
| 21 | @skipUnlessPassed('test_rpm_help') | 21 | @skipUnlessPassed('test_rpm_help') |
| 22 | def test_rpm_query(self): | 22 | def test_rpm_query(self): |
| 23 | (status, output) = self.target.run('rpm -q rpm') | 23 | (status, output) = self.target.run('rpm -q rpm') |
| 24 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | 24 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) |
| 25 | 25 | ||
| 26 | class RpmInstallRemoveTest(oeRuntimeTest): | ||
| 27 | |||
| 28 | @classmethod | ||
| 29 | def setUpClass(self): | ||
| 30 | deploydir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), "rpm", oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True)) | ||
| 31 | pkgdata = oe.packagedata.read_subpkgdata("rpm-doc", oeRuntimeTest.tc.d) | ||
| 32 | # pick rpm-doc as a test file to get installed, because it's small and it will always be built for standard targets | ||
| 33 | testrpmfile = "rpm-doc-%s-%s.%s.rpm" % (pkgdata["PKGV"], pkgdata["PKGR"], oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True)) | ||
| 34 | oeRuntimeTest.tc.target.copy_to(os.path.join(deploydir,testrpmfile), "/tmp/rpm-doc.rpm") | ||
| 35 | |||
| 36 | @skipUnlessPassed('test_rpm_help') | ||
| 37 | def test_rpm_install(self): | ||
| 38 | (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm') | ||
| 39 | self.assertEqual(status, 0, msg="Failed to install rpm-doc package: %s" % output) | ||
| 40 | |||
| 41 | @skipUnlessPassed('test_rpm_install') | ||
| 42 | def test_rpm_remove(self): | ||
| 43 | (status,output) = self.target.run('rpm -e rpm-doc') | ||
| 44 | self.assertEqual(status, 0, msg="Failed to remove rpm-doc package: %s" % output) | ||
| 45 | |||
| 46 | @classmethod | ||
| 47 | def tearDownClass(self): | ||
| 48 | oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') | ||
| 49 | |||
