diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/rpm.py')
-rw-r--r-- | meta/lib/oeqa/runtime/rpm.py | 49 |
1 files changed, 49 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..154cad5014 --- /dev/null +++ b/meta/lib/oeqa/runtime/rpm.py | |||
@@ -0,0 +1,49 @@ | |||
1 | import unittest | ||
2 | import os | ||
3 | from oeqa.oetest import oeRuntimeTest, skipModule | ||
4 | from oeqa.utils.decorators import * | ||
5 | import oe.packagedata | ||
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 | 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 | |||