summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorStefan Stanacar <stefanx.stanacar@intel.com>2013-08-20 16:13:29 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:47:20 +0100
commitdb7e4849c3999ed73c6349405e9680d466642598 (patch)
tree89036b5a074020d91bf4f20e96406395213b6eb5 /meta
parent3d30fd2eb06258aa2048f8fadf7b592f9844432f (diff)
downloadpoky-db7e4849c3999ed73c6349405e9680d466642598.tar.gz
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. (From OE-Core rev: a2d2f2b7b111863d3c50dedded37aab813d9634f) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/rpm.py30
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 @@
1import unittest 1import unittest
2import os
2from oeqa.oetest import oeRuntimeTest, skipModule 3from oeqa.oetest import oeRuntimeTest, skipModule
3from oeqa.utils.decorators import * 4from oeqa.utils.decorators import *
5import oe.packagedata
4 6
5def setUpModule(): 7def 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
12class RpmHelpTest(oeRuntimeTest): 14class 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
19class 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
26class 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