mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
59791d1f49
commit
b588b80d66
@@ -13,7 +13,8 @@ def testsdk_main(d):
|
||||
import oeqa.sdk
|
||||
import time
|
||||
import subprocess
|
||||
from oeqa.oetest import loadTests, runTests, get_test_suites, get_tests_list
|
||||
from oeqa.oetest import loadTests, runTests, \
|
||||
get_test_suites, get_tests_list, SDKTestContext
|
||||
|
||||
pn = d.getVar("PN", True)
|
||||
bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True))
|
||||
@@ -28,29 +29,6 @@ def testsdk_main(d):
|
||||
if not os.path.exists(tcname):
|
||||
bb.fatal("The toolchain is not built. Build it before running the tests: 'bitbake <image> -c populate_sdk' .")
|
||||
|
||||
class TestContext(object):
|
||||
def __init__(self):
|
||||
self.d = d
|
||||
self.testslist = testslist
|
||||
self.testsrequired = testsrequired
|
||||
self.filesdir = os.path.join(os.path.dirname(os.path.abspath(oeqa.runtime.__file__)),"files")
|
||||
self.sdktestdir = sdktestdir
|
||||
self.sdkenv = sdkenv
|
||||
self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split()
|
||||
self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split()
|
||||
manifest = d.getVar("SDK_TARGET_MANIFEST", True)
|
||||
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 sdk image?\n%s" % e)
|
||||
hostmanifest = d.getVar("SDK_HOST_MANIFEST", True)
|
||||
try:
|
||||
with open(hostmanifest) as f:
|
||||
self.hostpkgmanifest = f.read()
|
||||
except IOError as e:
|
||||
bb.fatal("No host package manifest file found. Did you build the sdk image?\n%s" % e)
|
||||
|
||||
sdktestdir = d.expand("${WORKDIR}/testimage-sdk/")
|
||||
bb.utils.remove(sdktestdir, True)
|
||||
bb.utils.mkdirhier(sdktestdir)
|
||||
@@ -63,8 +41,7 @@ def testsdk_main(d):
|
||||
targets = glob.glob(d.expand(sdktestdir + "/tc/environment-setup-*"))
|
||||
for sdkenv in targets:
|
||||
bb.plain("Testing %s" % sdkenv)
|
||||
# test context
|
||||
tc = TestContext()
|
||||
tc = SDKTestContext(d, testslist, testsrequired, sdktestdir, sdkenv)
|
||||
|
||||
# this is a dummy load of tests
|
||||
# we are doing that to find compile errors in the tests themselves
|
||||
|
||||
Reference in New Issue
Block a user