aboutsummaryrefslogtreecommitdiff
path: root/meta-selftest
diff options
context:
space:
mode:
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>2017-06-05 12:19:34 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-09 17:12:04 +0100
commit2f6a506018973f0eaf1306555df3e74a3ab25680 (patch)
treeef9ec3e1983726ec81af338e71987b9645dd6509 /meta-selftest
parentfa3a157e437aefa24c473ec53736a26f7e9fd470 (diff)
downloadopenembedded-core-2f6a506018973f0eaf1306555df3e74a3ab25680.zip
openembedded-core-2f6a506018973f0eaf1306555df3e74a3ab25680.tar.gz
openembedded-core-2f6a506018973f0eaf1306555df3e74a3ab25680.tar.bz2
runtime-test.py: Split different tests inside selftest.py
There were two completely different tests inside selftest.py, and the only reason for them to be together was that both needed the same mechanism to execute (run testimage from within selftest) This fixes the design issue and error-prone situation by separating these tests. In add a new module for dnf-runtime and also has an extra time added to running the tests, but it is minimal since the builds reuse data from previuous build. [YOCTO #11436] Signed-off-by: Humberto Ibarra <humberto.ibarra.lopez@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta-selftest')
-rw-r--r--meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py42
-rw-r--r--meta-selftest/lib/oeqa/runtime/cases/selftest.py42
2 files changed, 42 insertions, 42 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 0000000..123e725
--- /dev/null
+++ b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
@@ -0,0 +1,42 @@
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.runtime.cases.dnf import DnfTest
+from oeqa.utils.httpserver import HTTPService
+
+class DnfSelftest(DnfTest):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
+ cls.tc.target.server_ip)
+ cls.repo_server.start()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.repo_server.stop()
+
+ @OETestDepends(['dnf.DnfBasicTest.test_dnf_help'])
+ def test_verify_package_feeds(self):
+ """
+ Summary: Check correct setting of PACKAGE_FEED_URIS var
+ Expected: 1. Feeds were correctly set for dnf
+ 2. Update recovers packages from host's repo
+ Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
+ Author: Alexander Kanavin <alexander.kanavin@intel.com>
+ """
+ # When we created an image, we had to supply fake ip and port
+ # for the feeds. Now we can patch the real ones into the config file.
+ import tempfile
+ temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name
+ self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file)
+ fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port))
+ open(temp_file, "w").write(fixed_config)
+ self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo")
+
+ import re
+ output_makecache = self.dnf('makecache')
+ self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache))
+
+ output_repoinfo = self.dnf('repoinfo')
+ matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL)
+ self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo))
+ 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 e4985a6..19de740 100644
--- a/meta-selftest/lib/oeqa/runtime/cases/selftest.py
+++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.py
@@ -1,7 +1,5 @@
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
-from oeqa.runtime.cases.dnf import DnfTest
-from oeqa.utils.httpserver import HTTPService
class Selftest(OERuntimeTestCase):
@@ -31,43 +29,3 @@ class Selftest(OERuntimeTestCase):
(status, output) = self.target.run("socat -V")
self.assertNotEqual(status, 0, msg="socat is still installed")
-
-
-class DnfSelftest(DnfTest):
-
- @classmethod
- def setUpClass(cls):
- cls.repo_server = HTTPService(os.path.join(cls.tc.td['WORKDIR'], 'oe-rootfs-repo'),
- cls.tc.target.server_ip)
- cls.repo_server.start()
-
- @classmethod
- def tearDownClass(cls):
- cls.repo_server.stop()
-
- @OETestDepends(['ssh.SSHTest.test_ssh'])
- def test_verify_package_feeds(self):
- """
- Summary: Check correct setting of PACKAGE_FEED_URIS var
- Expected: 1. Feeds were correctly set for dnf
- 2. Update recovers packages from host's repo
- Author: Humberto Ibarra <humberto.ibarra.lopez@intel.com>
- Author: Alexander Kanavin <alexander.kanavin@intel.com>
- """
- # When we created an image, we had to supply fake ip and port
- # for the feeds. Now we can patch the real ones into the config file.
- import tempfile
- temp_file = tempfile.TemporaryDirectory(prefix="oeqa-remotefeeds-").name
- self.tc.target.copyFrom("/etc/yum.repos.d/oe-remote-repo.repo", temp_file)
- fixed_config = open(temp_file, "r").read().replace("bogus_ip", self.tc.target.server_ip).replace("bogus_port", str(self.repo_server.port))
- open(temp_file, "w").write(fixed_config)
- self.tc.target.copyTo(temp_file, "/etc/yum.repos.d/oe-remote-repo.repo")
-
- import re
- output_makecache = self.dnf('makecache')
- self.assertTrue(re.match(r".*Metadata cache created", output_makecache, re.DOTALL) is not None, msg = "dnf makecache failed: %s" %(output_makecache))
-
- output_repoinfo = self.dnf('repoinfo')
- matchobj = re.match(r".*Repo-pkgs\s*:\s*(?P<n_pkgs>[0-9]+)", output_repoinfo, re.DOTALL)
- self.assertTrue(matchobj is not None, msg = "Could not find the amount of packages in dnf repoinfo output: %s" %(output_repoinfo))
- self.assertTrue(int(matchobj.group('n_pkgs')) > 0, msg = "Amount of remote packages is not more than zero: %s\n" %(output_repoinfo))