diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/rpm.py')
-rw-r--r-- | meta/lib/oeqa/runtime/rpm.py | 53 |
1 files changed, 53 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..b17e8b46a8 --- /dev/null +++ b/meta/lib/oeqa/runtime/rpm.py | |||
@@ -0,0 +1,53 @@ | |||
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 | @testcase(191) | ||
22 | @skipUnlessPassed('test_rpm_help') | ||
23 | def test_rpm_query(self): | ||
24 | (status, output) = self.target.run('rpm -q rpm') | ||
25 | self.assertEqual(status, 0, msg="status and output: %s and %s" % (status,output)) | ||
26 | |||
27 | class RpmInstallRemoveTest(oeRuntimeTest): | ||
28 | |||
29 | @classmethod | ||
30 | def setUpClass(self): | ||
31 | pkgarch = oeRuntimeTest.tc.d.getVar('TUNE_PKGARCH', True).replace("-", "_") | ||
32 | rpmdir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), "rpm", pkgarch) | ||
33 | # pick rpm-doc as a test file to get installed, because it's small and it will always be built for standard targets | ||
34 | for f in fnmatch.filter(os.listdir(rpmdir), "rpm-doc-*.%s.rpm" % pkgarch): | ||
35 | testrpmfile = f | ||
36 | oeRuntimeTest.tc.target.copy_to(os.path.join(rpmdir,testrpmfile), "/tmp/rpm-doc.rpm") | ||
37 | |||
38 | @testcase(192) | ||
39 | @skipUnlessPassed('test_rpm_help') | ||
40 | def test_rpm_install(self): | ||
41 | (status, output) = self.target.run('rpm -ivh /tmp/rpm-doc.rpm') | ||
42 | self.assertEqual(status, 0, msg="Failed to install rpm-doc package: %s" % output) | ||
43 | |||
44 | @testcase(194) | ||
45 | @skipUnlessPassed('test_rpm_install') | ||
46 | def test_rpm_remove(self): | ||
47 | (status,output) = self.target.run('rpm -e rpm-doc') | ||
48 | self.assertEqual(status, 0, msg="Failed to remove rpm-doc package: %s" % output) | ||
49 | |||
50 | @classmethod | ||
51 | def tearDownClass(self): | ||
52 | oeRuntimeTest.tc.target.run('rm -f /tmp/rpm-doc.rpm') | ||
53 | |||