summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorYeoh Ee Peng <ee.peng.yeoh@intel.com>2018-03-01 17:35:37 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-04 11:35:42 +0000
commit2bce61ee412138e1a343cbdd7e766dc2745cecaa (patch)
treee577538f177e91a2d1a7c9842d8959de37c8f191 /meta/lib/oeqa
parent5a351c2aaaf1a92f4d9da8e72a79cbf628afc918 (diff)
downloadpoky-2bce61ee412138e1a343cbdd7e766dc2745cecaa.tar.gz
oeqa/runtime/opkg.py: add runtime test for opkg
Add runtime test for opkg to test that it can install ipk package from remote source. [YOCTO# 11488] (From OE-Core rev: 9dd4af2b70f58540b2799823957aff3413068126) Signed-off-by: Yeoh Ee Peng <ee.peng.yeoh@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/runtime/cases/opkg.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/opkg.py b/meta/lib/oeqa/runtime/cases/opkg.py
new file mode 100644
index 0000000000..671ee06c73
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/opkg.py
@@ -0,0 +1,47 @@
1import os
2from oeqa.utils.httpserver import HTTPService
3from oeqa.runtime.case import OERuntimeTestCase
4from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature
5from oeqa.runtime.decorator.package import OEHasPackage
6
7class OpkgTest(OERuntimeTestCase):
8
9 def pkg(self, command, expected = 0):
10 command = 'opkg %s' % command
11 status, output = self.target.run(command, 1500)
12 message = os.linesep.join([command, output])
13 self.assertEqual(status, expected, message)
14 return output
15
16class OpkgRepoTest(OpkgTest):
17
18 @classmethod
19 def setUpClass(cls):
20 service_repo = os.path.join(cls.tc.td['DEPLOY_DIR_IPK'], 'all')
21 cls.repo_server = HTTPService(service_repo, cls.tc.target.server_ip)
22 cls.repo_server.start()
23
24 @classmethod
25 def tearDownClass(cls):
26 cls.repo_server.stop()
27
28 def setup_source_config_for_package_install(self):
29 apt_get_source_server = 'http://%s:%s/' % (self.tc.target.server_ip, self.repo_server.port)
30 apt_get_sourceslist_dir = '/etc/opkg/'
31 self.target.run('cd %s; echo src/gz all %s >> opkg.conf' % (apt_get_sourceslist_dir, apt_get_source_server))
32
33 def cleanup_source_config_for_package_install(self):
34 apt_get_sourceslist_dir = '/etc/opkg/'
35 self.target.run('cd %s; sed -i "/^src/d" opkg.conf' % (apt_get_sourceslist_dir))
36
37 @skipIfNotFeature('package-management',
38 'Test requires package-management to be in IMAGE_FEATURES')
39 @skipIfNotDataVar('IMAGE_PKGTYPE', 'ipk',
40 'IPK is not the primary package manager')
41 @OEHasPackage(['opkg'])
42 def test_opkg_install_from_repo(self):
43 self.setup_source_config_for_package_install()
44 self.pkg('update')
45 self.pkg('remove run-postinsts-dev')
46 self.pkg('install run-postinsts-dev')
47 self.cleanup_source_config_for_package_install()