diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/rpm.py')
| -rw-r--r-- | meta/lib/oeqa/runtime/rpm.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/rpm.py b/meta/lib/oeqa/runtime/rpm.py new file mode 100644 index 0000000000..084d22f96b --- /dev/null +++ b/meta/lib/oeqa/runtime/rpm.py | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | import unittest | ||
| 2 | import os | ||
| 3 | import fnmatch | ||
| 4 | from oeqa.oetest import oeRuntimeTest, skipModule | ||
| 5 | from oeqa.utils.decorators import * | ||
| 6 | |||
| 7 | def setUpModule(): | ||
| 8 | if not oeRuntimeTest.hasFeature("package-management"): | ||
| 9 | skipModule("rpm module skipped: target doesn't have package-management in IMAGE_FEATURES") | ||
| 10 | if "package_rpm" != oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES", True).split()[0]: | ||
| 11 | skipModule("rpm module skipped: target doesn't have rpm as primary package manager") | ||
| 12 | |||
| 13 | |||
| 14 | class RpmBasicTest(oeRuntimeTest): | ||
| 15 | |||
| 16 | @skipUnlessPassed('test_ssh') | ||
| 17 | def test_rpm_help(self): | ||
| 18 | (status, output) = self.target.run('rpm --help') | ||
| 19 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | ||
| 20 | |||
| 21 | @skipUnlessPassed('test_rpm_help') | ||
| 22 | def test_rpm_query(self): | ||
| 23 | (status, output) = self.target.run('rpm -q rpm') | ||
| 24 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | ||
| 25 | |||
| 26 | class RpmInstallRemoveTest(oeRuntimeTest): | ||
| 27 | |||
| 28 | @classmethod | ||
| 29 | def setUpClass(self): | ||
| 30 | pkgarch = oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True).replace("-", "_") | ||
| 31 | rpmdir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), "rpm", pkgarch) | ||
| 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 | for f in fnmatch.filter(os.listdir(rpmdir), "rpm-doc-*.%s.rpm" % pkgarch): | ||
| 34 | testrpmfile = f | ||
| 35 | oeRuntimeTest.tc.target.copy_to(os.path.join(rpmdir,testrpmfile), "/tmp/rpm-doc.rpm") | ||
| 36 | |||
| 37 | @skipUnlessPassed('test_rpm_help') | ||
| 38 | def test_rpm_install(self): | ||
| 39 | (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm') | ||
| 40 | self.assertEqual(status, 0, msg="Failed to install rpm-doc package: %s" % output) | ||
| 41 | |||
| 42 | @skipUnlessPassed('test_rpm_install') | ||
| 43 | def test_rpm_remove(self): | ||
| 44 | (status,output) = self.target.run('rpm -e rpm-doc') | ||
| 45 | self.assertEqual(status, 0, msg="Failed to remove rpm-doc package: %s" % output) | ||
| 46 | |||
| 47 | @classmethod | ||
| 48 | def tearDownClass(self): | ||
| 49 | oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') | ||
| 50 | |||
