mirror of
https://git.yoctoproject.org/poky
synced 2026-06-05 09:52:39 +02:00
When run SDK tests over eSDK we need to use SDKExtTestContext instead of SDKTestContext because if we use SDKTestContext search for SDK manifest and depends on the SDK manifest generation so populate_sdk needs to be executed. Adds a compatibility mode flag to SDKExtTestContext for search tests over sdk module instead of sdkext module and change testsdk calls to comply with this new param. (From OE-Core rev: ebe743235b383b17225553d84bf8e6f80d364dcd) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
135 lines
4.3 KiB
Plaintext
135 lines
4.3 KiB
Plaintext
# Copyright (C) 2013 - 2016 Intel Corporation
|
|
#
|
|
# Released under the MIT license (see COPYING.MIT)
|
|
|
|
TEST_LOG_DIR ?= "${WORKDIR}/testimage"
|
|
TESTSDKLOCK = "${TMPDIR}/testsdk.lock"
|
|
|
|
def run_test_context(CTestContext, d, testdir, tcname, pn, *args):
|
|
import glob
|
|
import time
|
|
|
|
targets = glob.glob(d.expand(testdir + "/tc/environment-setup-*"))
|
|
for sdkenv in targets:
|
|
bb.plain("Testing %s" % sdkenv)
|
|
tc = CTestContext(d, testdir, sdkenv, args)
|
|
|
|
# this is a dummy load of tests
|
|
# we are doing that to find compile errors in the tests themselves
|
|
# before booting the image
|
|
try:
|
|
tc.loadTests()
|
|
except Exception as e:
|
|
import traceback
|
|
bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
|
|
|
|
starttime = time.time()
|
|
result = tc.runTests()
|
|
stoptime = time.time()
|
|
if result.wasSuccessful():
|
|
bb.plain("%s SDK(%s):%s - Ran %d test%s in %.3fs" % (pn, os.path.basename(tcname), os.path.basename(sdkenv),result.testsRun, result.testsRun != 1 and "s" or "", stoptime - starttime))
|
|
msg = "%s - OK - All required tests passed" % pn
|
|
skipped = len(result.skipped)
|
|
if skipped:
|
|
msg += " (skipped=%d)" % skipped
|
|
bb.plain(msg)
|
|
else:
|
|
raise bb.build.FuncFailed("%s - FAILED - check the task log and the commands log" % pn )
|
|
|
|
def testsdk_main(d):
|
|
import os
|
|
import oeqa.sdk
|
|
import subprocess
|
|
from oeqa.oetest import SDKTestContext
|
|
|
|
pn = d.getVar("PN", True)
|
|
bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR", True))
|
|
|
|
tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh")
|
|
if not os.path.exists(tcname):
|
|
bb.fatal("The toolchain is not built. Build it before running the tests: 'bitbake <image> -c populate_sdk' .")
|
|
|
|
sdktestdir = d.expand("${WORKDIR}/testimage-sdk/")
|
|
bb.utils.remove(sdktestdir, True)
|
|
bb.utils.mkdirhier(sdktestdir)
|
|
try:
|
|
subprocess.check_output("cd %s; %s <<EOF\n./tc\nY\nEOF" % (sdktestdir, tcname), shell=True)
|
|
except subprocess.CalledProcessError as e:
|
|
bb.fatal("Couldn't install the SDK:\n%s" % e.output)
|
|
|
|
try:
|
|
run_test_context(SDKTestContext, d, sdktestdir, tcname, pn)
|
|
finally:
|
|
bb.utils.remove(sdktestdir, True)
|
|
|
|
testsdk_main[vardepsexclude] =+ "BB_ORIGENV"
|
|
|
|
python do_testsdk() {
|
|
testsdk_main(d)
|
|
}
|
|
addtask testsdk
|
|
do_testsdk[nostamp] = "1"
|
|
do_testsdk[lockfiles] += "${TESTSDKLOCK}"
|
|
|
|
TEST_LOG_SDKEXT_DIR ?= "${WORKDIR}/testsdkext"
|
|
TESTSDKEXTLOCK = "${TMPDIR}/testsdkext.lock"
|
|
|
|
def testsdkext_main(d):
|
|
import os
|
|
import oeqa.sdkext
|
|
import subprocess
|
|
from oeqa.oetest import SDKTestContext, SDKExtTestContext
|
|
from bb.utils import export_proxies
|
|
|
|
# extensible sdk use network
|
|
export_proxies(d)
|
|
|
|
# extensible sdk shows a warning if found bitbake in the path
|
|
# because can cause problems so clean it
|
|
new_path = ''
|
|
for p in os.environ['PATH'].split(':'):
|
|
if 'bitbake/bin' in p or 'poky/scripts' in p:
|
|
continue
|
|
new_path = new_path + p + ':'
|
|
new_path = new_path[:-1]
|
|
os.environ['PATH'] = new_path
|
|
|
|
pn = d.getVar("PN", True)
|
|
bb.utils.mkdirhier(d.getVar("TEST_LOG_SDKEXT_DIR", True))
|
|
|
|
tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh")
|
|
if not os.path.exists(tcname):
|
|
bb.fatal("The toolchain ext is not built. Build it before running the" \
|
|
" tests: 'bitbake <image> -c populate_sdk_ext' .")
|
|
|
|
testdir = d.expand("${WORKDIR}/testsdkext/")
|
|
bb.utils.remove(testdir, True)
|
|
bb.utils.mkdirhier(testdir)
|
|
try:
|
|
subprocess.check_output("%s -y -d %s/tc" % (tcname, testdir), shell=True)
|
|
except subprocess.CalledProcessError as e:
|
|
bb.fatal("Couldn't install the SDK EXT:\n%s" % e.output)
|
|
|
|
try:
|
|
bb.plain("Running SDK Compatibility tests ...")
|
|
run_test_context(SDKExtTestContext, d, testdir, tcname, pn, True)
|
|
finally:
|
|
pass
|
|
|
|
try:
|
|
bb.plain("Running Extensible SDK tests ...")
|
|
run_test_context(SDKExtTestContext, d, testdir, tcname, pn)
|
|
finally:
|
|
pass
|
|
|
|
bb.utils.remove(testdir, True)
|
|
|
|
testsdkext_main[vardepsexclude] =+ "BB_ORIGENV"
|
|
|
|
python do_testsdkext() {
|
|
testsdkext_main(d)
|
|
}
|
|
addtask testsdkext
|
|
do_testsdkext[nostamp] = "1"
|
|
do_testsdkext[lockfiles] += "${TESTSDKEXTLOCK}"
|