diff options
-rw-r--r-- | meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py | 42 | ||||
-rw-r--r-- | meta-selftest/lib/oeqa/runtime/cases/selftest.py | 42 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/runtime_test.py | 20 |
3 files changed, 60 insertions, 44 deletions
diff --git a/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py new file mode 100644 index 0000000000..123e7259f1 --- /dev/null +++ b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py | |||
@@ -0,0 +1,42 @@ | |||
1 | from oeqa.core.decorator.depends import OETestDepends | ||
2 | from oeqa.runtime.cases.dnf import DnfTest | ||
3 | from oeqa.utils.httpserver import HTTPService | ||
4 | |||
5 | class DnfSelftest(DnfTest): | ||
6 | |||
7 | @classmethod | ||
8 | def setUpClass(cls): | ||
9 | cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), | ||
10 | cls.tc.target.server_ip) | ||
11 | cls.repo_server.start() | ||
12 | |||
13 | @classmethod | ||
14 | def tearDownClass(cls): | ||
15 | cls.repo_server.stop() | ||
16 | |||
17 | @OETestDepends(['dnf.DnfBasicTest.test_dnf_help']) | ||
18 | def test_verify_package_feeds(self): | ||
19 | """ | ||
20 | Summary: Check correct setting of PACKAGE_FEED_URIS var | ||
21 | Expected: 1. Feeds were correctly set for dnf | ||
22 | 2. Update recovers packages from host's repo | ||
23 | Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com> | ||
24 | Author: Alexander Kanavin <alexander.kanavin@intel.com> | ||
25 | """ | ||
26 | # When we created an image, we had to supply fake ip and port | ||
27 | # for the feeds. Now we can patch the real ones into the config file. | ||
28 | import tempfile | ||
29 | temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name | ||
30 | self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) | ||
31 | fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) | ||
32 | open(temp_file, "w").write(fixed_config) | ||
33 | self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") | ||
34 | |||
35 | import re | ||
36 | output_makecache = self.dnf('makecache') | ||
37 | self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache)) | ||
38 | |||
39 | output_repoinfo = self.dnf('repoinfo') | ||
40 | matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL) | ||
41 | self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo)) | ||
42 | self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo)) | ||
diff --git a/meta-selftest/lib/oeqa/runtime/cases/selftest.py b/meta-selftest/lib/oeqa/runtime/cases/selftest.py index e4985a6edd..19de740623 100644 --- a/meta-selftest/lib/oeqa/runtime/cases/selftest.py +++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.py | |||
@@ -1,7 +1,5 @@ | |||
1 | from oeqa.runtime.case import OERuntimeTestCase | 1 | from oeqa.runtime.case import OERuntimeTestCase |
2 | from oeqa.core.decorator.depends import OETestDepends | 2 | from oeqa.core.decorator.depends import OETestDepends |
3 | from oeqa.runtime.cases.dnf import DnfTest | ||
4 | from oeqa.utils.httpserver import HTTPService | ||
5 | 3 | ||
6 | class Selftest(OERuntimeTestCase): | 4 | class Selftest(OERuntimeTestCase): |
7 | 5 | ||
@@ -31,43 +29,3 @@ class Selftest(OERuntimeTestCase): | |||
31 | 29 | ||
32 | (status, output) = self.target.run("socat -V") | 30 | (status, output) = self.target.run("socat -V") |
33 | self.assertNotEqual(status, 0, msg="socat is still installed") | 31 | self.assertNotEqual(status, 0, msg="socat is still installed") |
34 | |||
35 | |||
36 | class DnfSelftest(DnfTest): | ||
37 | |||
38 | @classmethod | ||
39 | def setUpClass(cls): | ||
40 | cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'), | ||
41 | cls.tc.target.server_ip) | ||
42 | cls.repo_server.start() | ||
43 | |||
44 | @classmethod | ||
45 | def tearDownClass(cls): | ||
46 | cls.repo_server.stop() | ||
47 | |||
48 | @OETestDepends(['ssh.SSHTest.test_ssh']) | ||
49 | def test_verify_package_feeds(self): | ||
50 | """ | ||
51 | Summary: Check correct setting of PACKAGE_FEED_URIS var | ||
52 | Expected: 1. Feeds were correctly set for dnf | ||
53 | 2. Update recovers packages from host's repo | ||
54 | Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com> | ||
55 | Author: Alexander Kanavin <alexander.kanavin@intel.com> | ||
56 | """ | ||
57 | # When we created an image, we had to supply fake ip and port | ||
58 | # for the feeds. Now we can patch the real ones into the config file. | ||
59 | import tempfile | ||
60 | temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name | ||
61 | self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file) | ||
62 | fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port)) | ||
63 | open(temp_file, "w").write(fixed_config) | ||
64 | self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo") | ||
65 | |||
66 | import re | ||
67 | output_makecache = self.dnf('makecache') | ||
68 | self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache)) | ||
69 | |||
70 | output_repoinfo = self.dnf('repoinfo') | ||
71 | matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL) | ||
72 | self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo)) | ||
73 | self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo)) | ||
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 9fec4d869b..2ac0a29761 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py | |||
@@ -109,16 +109,32 @@ class TestImage(OESelftestTestCase): | |||
109 | Summary: Check install packages functionality for testimage/testexport. | 109 | Summary: Check install packages functionality for testimage/testexport. |
110 | Expected: 1. Import tests from a directory other than meta. | 110 | Expected: 1. Import tests from a directory other than meta. |
111 | 2. Check install/uninstall of socat. | 111 | 2. Check install/uninstall of socat. |
112 | 3. Check that remote package feeds can be accessed | ||
113 | Product: oe-core | 112 | Product: oe-core |
114 | Author: Mariano Lopez <mariano.lopez@intel.com> | 113 | Author: Mariano Lopez <mariano.lopez@intel.com> |
115 | Author: Alexander Kanavin <alexander.kanavin@intel.com> | ||
116 | """ | 114 | """ |
117 | if get_bb_var('DISTRO') == 'poky-tiny': | 115 | if get_bb_var('DISTRO') == 'poky-tiny': |
118 | self.skipTest('core-image-full-cmdline not buildable for poky-tiny') | 116 | self.skipTest('core-image-full-cmdline not buildable for poky-tiny') |
119 | 117 | ||
120 | features = 'INHERIT += "testimage"\n' | 118 | features = 'INHERIT += "testimage"\n' |
121 | features += 'TEST_SUITES = "ping ssh selftest"\n' | 119 | features += 'TEST_SUITES = "ping ssh selftest"\n' |
120 | self.write_config(features) | ||
121 | |||
122 | # Build core-image-sato and testimage | ||
123 | bitbake('core-image-full-cmdline socat') | ||
124 | bitbake('-c testimage core-image-full-cmdline') | ||
125 | |||
126 | def test_testimage_dnf(self): | ||
127 | """ | ||
128 | Summary: Check package feeds functionality for dnf | ||
129 | Expected: 1. Check that remote package feeds can be accessed | ||
130 | Product: oe-core | ||
131 | Author: Alexander Kanavin <alexander.kanavin@intel.com> | ||
132 | """ | ||
133 | if get_bb_var('DISTRO') == 'poky-tiny': | ||
134 | self.skipTest('core-image-full-cmdline not buildable for poky-tiny') | ||
135 | |||
136 | features = 'INHERIT += "testimage"\n' | ||
137 | features += 'TEST_SUITES = "ping ssh dnf-runtime"\n' | ||
122 | # We don't yet know what the server ip and port will be - they will be patched | 138 | # We don't yet know what the server ip and port will be - they will be patched |
123 | # in at the start of the on-image test | 139 | # in at the start of the on-image test |
124 | features += 'PACKAGE_FEED_URIS = "http://bogus_ip:bogus_port"\n' | 140 | features += 'PACKAGE_FEED_URIS = "http://bogus_ip:bogus_port"\n' |