summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-05-02 13:19:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-19 09:05:17 +0100
commita9eb22e3d30b9bfd06eea55556894c256be3a4b0 (patch)
tree5da15dfd5fdc315f415c4ed3f980e51261d9ab8d /meta
parente090775f7e3b4af2345e835bbebcd5d4a580798b (diff)
downloadpoky-a9eb22e3d30b9bfd06eea55556894c256be3a4b0.tar.gz
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. (From OE-Core rev: ef9618a6e7f99e485cc6b59484d11807475c7823) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/oetest.py38
1 files changed, 24 insertions, 14 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 3ed5bb8c2b..bef9ac4961 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -331,14 +331,13 @@ class TestContext(object):
331 331
332 return runner.run(self.suite) 332 return runner.run(self.suite)
333 333
334class ImageTestContext(TestContext): 334class RuntimeTestContext(TestContext):
335 def __init__(self, d, target, host_dumper): 335 def __init__(self, d, target):
336 super(ImageTestContext, self).__init__(d) 336 super(RuntimeTestContext, self).__init__(d)
337 337
338 self.tagexp = d.getVar("TEST_SUITES_TAGS", True) 338 self.tagexp = d.getVar("TEST_SUITES_TAGS", True)
339 339
340 self.target = target 340 self.target = target
341 self.host_dumper = host_dumper
342 341
343 manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), 342 manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),
344 d.getVar("IMAGE_LINK_NAME", True) + ".manifest") 343 d.getVar("IMAGE_LINK_NAME", True) + ".manifest")
@@ -352,15 +351,6 @@ class ImageTestContext(TestContext):
352 else: 351 else:
353 self.pkgmanifest = "" 352 self.pkgmanifest = ""
354 353
355 self.sigterm = False
356 self.origsigtermhandler = signal.getsignal(signal.SIGTERM)
357 signal.signal(signal.SIGTERM, self._sigterm_exception)
358
359 def _sigterm_exception(self, signum, stackframe):
360 bb.warn("TestImage received SIGTERM, shutting down...")
361 self.sigterm = True
362 self.target.stop()
363
364 def _get_test_namespace(self): 354 def _get_test_namespace(self):
365 return "runtime" 355 return "runtime"
366 356
@@ -382,9 +372,29 @@ class ImageTestContext(TestContext):
382 return [t for t in self.d.getVar("TEST_SUITES", True).split() if t != "auto"] 372 return [t for t in self.d.getVar("TEST_SUITES", True).split() if t != "auto"]
383 373
384 def loadTests(self): 374 def loadTests(self):
385 super(ImageTestContext, self).loadTests() 375 super(RuntimeTestContext, self).loadTests()
386 setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps") 376 setattr(oeRuntimeTest, "pscmd", "ps -ef" if oeTest.hasPackage("procps") else "ps")
387 377
378class ImageTestContext(RuntimeTestContext):
379 def __init__(self, d, target, host_dumper):
380 super(ImageTestContext, self).__init__(d, target)
381
382 self.host_dumper = host_dumper
383
384 self.sigterm = False
385 self.origsigtermhandler = signal.getsignal(signal.SIGTERM)
386 signal.signal(signal.SIGTERM, self._sigterm_exception)
387
388 def _sigterm_exception(self, signum, stackframe):
389 bb.warn("TestImage received SIGTERM, shutting down...")
390 self.sigterm = True
391 self.target.stop()
392
393class ExportTestContext(RuntimeTestContext):
394 def __init__(self, d, target):
395 super(ExportTestContext, self).__init__(d, target)
396 self.sigterm = None
397
388class SDKTestContext(TestContext): 398class SDKTestContext(TestContext):
389 def __init__(self, d, sdktestdir, sdkenv, tcname, *args): 399 def __init__(self, d, sdktestdir, sdkenv, tcname, *args):
390 super(SDKTestContext, self).__init__(d) 400 super(SDKTestContext, self).__init__(d)