[oe-commits] [openembedded-core] 03/25: runtime-test.py: Split different tests inside selftest.py

git at git.openembedded.org git at git.openembedded.org
Fri Jun 9 16:12:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 2f6a506018973f0eaf1306555df3e74a3ab25680
Author: Humberto Ibarra <humberto.ibarra.lopez at intel.com>
AuthorDate: Mon Jun 5 12:19:34 2017 -0500

    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 at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 .../runtime/cases/{selftest.py => dnf-runtime.py}  | 33 +----------------
 meta-selftest/lib/oeqa/runtime/cases/selftest.py   | 42 ----------------------
 meta/lib/oeqa/selftest/cases/runtime_test.py       | 20 +++++++++--
 3 files changed, 19 insertions(+), 76 deletions(-)

diff --git a/meta-selftest/lib/oeqa/runtime/cases/selftest.py b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
similarity index 63%
copy from meta-selftest/lib/oeqa/runtime/cases/selftest.py
copy to meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
index e4985a6..123e725 100644
--- a/meta-selftest/lib/oeqa/runtime/cases/selftest.py
+++ b/meta-selftest/lib/oeqa/runtime/cases/dnf-runtime.py
@@ -1,38 +1,7 @@
-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):
-
-    @OETestDepends(['ssh.SSHTest.test_ssh'])
-    def test_install_package(self):
-        """
-        Summary: Check basic package installation functionality.
-        Expected: 1. Before the test socat must be installed using scp.
-                  2. After the test socat must be uninstalled using ssh.
-                     This can't be checked in this test.
-        Product: oe-core
-        Author: Mariano Lopez <mariano.lopez at intel.com>
-        """
-
-        (status, output) = self.target.run("socat -V")
-        self.assertEqual(status, 0, msg="socat is not installed")
-
-    @OETestDepends(['selftest.Selftest.test_install_package'])
-    def test_verify_uninstall(self):
-        """
-        Summary: Check basic package installation functionality.
-        Expected: 1. test_install_package must uninstall socat.
-                     This test is just to verify that.
-        Product: oe-core
-        Author: Mariano Lopez <mariano.lopez at intel.com>
-        """
-
-        (status, output) = self.target.run("socat -V")
-        self.assertNotEqual(status, 0, msg="socat is still installed")
-
-
 class DnfSelftest(DnfTest):
 
     @classmethod
@@ -45,7 +14,7 @@ class DnfSelftest(DnfTest):
     def tearDownClass(cls):
         cls.repo_server.stop()
 
-    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    @OETestDepends(['dnf.DnfBasicTest.test_dnf_help'])
     def test_verify_package_feeds(self):
         """
         Summary: Check correct setting of PACKAGE_FEED_URIS var
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 at intel.com>
-        Author: Alexander Kanavin <alexander.kanavin at 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/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 9fec4d8..2ac0a29 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):
         Summary: Check install packages functionality for testimage/testexport.
         Expected: 1. Import tests from a directory other than meta.
                   2. Check install/uninstall of socat.
-                  3. Check that remote package feeds can be accessed
         Product: oe-core
         Author: Mariano Lopez <mariano.lopez at intel.com>
-        Author: Alexander Kanavin <alexander.kanavin at intel.com>
         """
         if get_bb_var('DISTRO') == 'poky-tiny':
             self.skipTest('core-image-full-cmdline not buildable for poky-tiny')
 
         features = 'INHERIT += "testimage"\n'
         features += 'TEST_SUITES = "ping ssh selftest"\n'
+        self.write_config(features)
+
+        # Build core-image-sato and testimage
+        bitbake('core-image-full-cmdline socat')
+        bitbake('-c testimage core-image-full-cmdline')
+
+    def test_testimage_dnf(self):
+        """
+        Summary: Check package feeds functionality for dnf
+        Expected: 1. Check that remote package feeds can be accessed
+        Product: oe-core
+        Author: Alexander Kanavin <alexander.kanavin at intel.com>
+        """
+        if get_bb_var('DISTRO') == 'poky-tiny':
+            self.skipTest('core-image-full-cmdline not buildable for poky-tiny')
+
+        features = 'INHERIT += "testimage"\n'
+        features += 'TEST_SUITES = "ping ssh dnf-runtime"\n'
         # We don't yet know what the server ip and port will be - they will be patched
         # in at the start of the on-image test
         features += 'PACKAGE_FEED_URIS = "http://bogus_ip:bogus_port"\n'

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list