[oe-commits] [openembedded-core] 01/36: oeqa/oetest.py: Add class ExportTestContext

git at git.openembedded.org git at git.openembedded.org
Wed May 18 22:24:57 UTC 2016


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

commit ef9618a6e7f99e485cc6b59484d11807475c7823
Author: Mariano Lopez <mariano.lopez at linux.intel.com>
AuthorDate: Mon May 2 13:19:14 2016 +0000

    oeqa/oetest.py: Add class ExportTestContext
    
    Adding the class is needed to separate the exported test
    from the test image; both test run under different conditions,
    i.e. an exported test doesn't require to change the signal
    handling.
    
    This change adds clasess ExportTestContext and ImageTestContext,
    both of them inherits from RuntimeTestContext. Also refactors
    RuntimeTestContext class, to keep the code common in this class.
    
    Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/oetest.py | 38 ++++++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 14 deletions(-)

diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 3ed5bb8..bef9ac4 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -331,14 +331,13 @@ class TestContext(object):
 
         return runner.run(self.suite)
 
-class ImageTestContext(TestContext):
-    def __init__(self, d, target, host_dumper):
-        super(ImageTestContext, self).__init__(d)
+class RuntimeTestContext(TestContext):
+    def __init__(self, d, target):
+        super(RuntimeTestContext, self).__init__(d)
 
         self.tagexp =  d.getVar("TEST_SUITES_TAGS", True)
 
         self.target = target
-        self.host_dumper = host_dumper
 
         manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),
                 d.getVar("IMAGE_LINK_NAME", True) + ".manifest")
@@ -352,15 +351,6 @@ class ImageTestContext(TestContext):
         else:
             self.pkgmanifest = ""
 
-        self.sigterm = False
-        self.origsigtermhandler = signal.getsignal(signal.SIGTERM)
-        signal.signal(signal.SIGTERM, self._sigterm_exception)
-
-    def _sigterm_exception(self, signum, stackframe):
-        bb.warn("TestImage received SIGTERM, shutting down...")
-        self.sigterm = True
-        self.target.stop()
-
     def _get_test_namespace(self):
         return "runtime"
 
@@ -382,9 +372,29 @@ class ImageTestContext(TestContext):
         return [t for t in self.d.getVar("TEST_SUITES", True).split() if t != "auto"]
 
     def loadTests(self):
-        super(ImageTestContext, self).loadTests()
+        super(RuntimeTestContext, self).loadTests()
         setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps")
 
+class ImageTestContext(RuntimeTestContext):
+    def __init__(self, d, target, host_dumper):
+        super(ImageTestContext, self).__init__(d, target)
+
+        self.host_dumper = host_dumper
+
+        self.sigterm = False
+        self.origsigtermhandler = signal.getsignal(signal.SIGTERM)
+        signal.signal(signal.SIGTERM, self._sigterm_exception)
+
+    def _sigterm_exception(self, signum, stackframe):
+        bb.warn("TestImage received SIGTERM, shutting down...")
+        self.sigterm = True
+        self.target.stop()
+
+class ExportTestContext(RuntimeTestContext):
+    def __init__(self, d, target):
+        super(ExportTestContext, self).__init__(d, target)
+        self.sigterm = None
+
 class SDKTestContext(TestContext):
     def __init__(self, d, sdktestdir, sdkenv, tcname, *args):
         super(SDKTestContext, self).__init__(d)

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


More information about the Openembedded-commits mailing list