diff options
author | Aníbal Limón <limon.anibal@gmail.com> | 2016-01-30 11:05:15 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 16:06:22 +0000 |
commit | b588b80d667052f2864d529793bf7db155b29f90 (patch) | |
tree | 2e5e5cb0b2f2d98a9afc66fae53868684b3f2ef6 /meta/classes/testimage.bbclass | |
parent | 59791d1f49591354c31c652af6c7c482461a878c (diff) | |
download | openembedded-core-contrib-b588b80d667052f2864d529793bf7db155b29f90.tar.gz |
testimage/testsdk: Modularize TestContext.
Move anonymous duplicated class TestContext from testimage/testsdk to
oeqa/oetest now we have two new classes ImageTestContext and
SDKTestContext with common code in TestContext class.
(From OE-Core rev: 593f2fdf6ee94c5f91761a669048da3598cbe3fa)
Signed-off-by: Aníbal Limón <limon.anibal@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/testimage.bbclass')
-rw-r--r-- | meta/classes/testimage.bbclass | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 6eea3f8a27..bdd6c9de6f 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass @@ -195,7 +195,8 @@ def testimage_main(d): import oeqa.runtime import time import signal - from oeqa.oetest import loadTests, runTests, get_test_suites, get_tests_list + from oeqa.oetest import loadTests, runTests, \ + get_test_suites, get_tests_list, ImageTestContext from oeqa.targetcontrol import get_target_controller from oeqa.utils.dump import get_host_dumper @@ -212,48 +213,14 @@ def testimage_main(d): testslist = get_tests_list(get_test_suites(d), d.getVar("BBPATH", True).split(':')) testsrequired = [t for t in d.getVar("TEST_SUITES", True).split() if t != "auto"] - tagexp = d.getVar("TEST_SUITES_TAGS", True) - # we need the host dumper in test context host_dumper = get_host_dumper(d) # the robot dance target = get_target_controller(d) - class TestContext(object): - def __init__(self): - self.d = d - self.testslist = testslist - self.tagexp = tagexp - self.testsrequired = testsrequired - self.filesdir = os.path.join(os.path.dirname(os.path.abspath(oeqa.runtime.__file__)),"files") - self.target = target - self.host_dumper = host_dumper - self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split() - self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split() - manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + ".manifest") - nomanifest = d.getVar("IMAGE_NO_MANIFEST", True) - - self.sigterm = False - self.origsigtermhandler = signal.getsignal(signal.SIGTERM) - signal.signal(signal.SIGTERM, self.sigterm_exception) - - if nomanifest is None or nomanifest != "1": - try: - with open(manifest) as f: - self.pkgmanifest = f.read() - except IOError as e: - bb.fatal("No package manifest file found. Did you build the image?\n%s" % e) - else: - self.pkgmanifest = "" - - def sigterm_exception(self, signum, stackframe): - bb.warn("TestImage received SIGTERM, shutting down...") - self.sigterm = True - self.target.stop() - # test context - tc = TestContext() + tc = ImageTestContext(d, testslist, testsrequired, target, host_dumper) # this is a dummy load of tests # we are doing that to find compile errors in the tests themselves @@ -264,7 +231,6 @@ def testimage_main(d): import traceback bb.fatal("Loading tests failed:\n%s" % traceback.format_exc()) - if export: signal.signal(signal.SIGTERM, tc.origsigtermhandler) tc.origsigtermhandler = None |