From 7a1ae3149965b162fb2c71fc7067e07a7a189249 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Wed, 30 Nov 2016 10:56:09 -0600 Subject: classes/testsdk: Migrates testsdk.bbclass to use new OESDKTestContext MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The functionality provided is the same with imporvements on code reuse and better interfaces. Signed-off-by: Aníbal Limón --- meta/classes/testsdk.bbclass | 75 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 15 deletions(-) (limited to 'meta/classes/testsdk.bbclass') diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass index 063b9080a5..7304129b49 100644 --- a/meta/classes/testsdk.bbclass +++ b/meta/classes/testsdk.bbclass @@ -50,30 +50,75 @@ def run_test_context(CTestContext, d, testdir, tcname, pn, *args): def testsdk_main(d): import os - import oeqa.sdk import subprocess - from oeqa.oetest import SDKTestContext + import json + import logging - pn = d.getVar("PN") - bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR")) + from bb.utils import export_proxies + from oeqa.core.runner import OEStreamLogger + from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor + from oeqa.utils import make_logger_bitbake_compatible + + pn = d.getVar("PN", True) + logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) + + # sdk use network for download projects for build + export_proxies(d) + + test_log_dir = d.getVar("TEST_LOG_DIR", True) + + bb.utils.mkdirhier(test_log_dir) tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh") if not os.path.exists(tcname): bb.fatal("The toolchain %s is not built. Build it before running the tests: 'bitbake -c populate_sdk' ." % tcname) - sdktestdir = d.expand("${WORKDIR}/testimage-sdk/") - bb.utils.remove(sdktestdir, True) - bb.utils.mkdirhier(sdktestdir) + tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.testdata.json") + test_data = json.load(open(tdname, "r")) + test_data['TEST_LOG_DIR'] = test_log_dir + + target_pkg_manifest = OESDKTestContextExecutor._load_manifest( + d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.target.manifest")) + host_pkg_manifest = OESDKTestContextExecutor._load_manifest( + d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.host.manifest")) + + sdk_dir = d.expand("${WORKDIR}/testimage-sdk/") + bb.utils.remove(sdk_dir, True) + bb.utils.mkdirhier(sdk_dir) try: - subprocess.check_output("cd %s; %s <