# Copyright (C) 2013 - 2016 Intel Corporation # # Released under the MIT license (see COPYING.MIT) TEST_LOG_DIR ?= "${WORKDIR}/testimage" TESTSDKLOCK = "${TMPDIR}/testsdk.lock" def testsdk_main(d): import unittest import os import glob import oeqa.runtime import oeqa.sdk import time import subprocess 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)) # tests in TEST_SUITES become required tests # they won't be skipped even if they aren't suitable. # testslist is what we'll actually pass to the unittest loader testslist = get_tests_list(get_test_suites(d, "sdk"), d.getVar("BBPATH", True).split(':'), "sdk") testsrequired = [t for t in (d.getVar("TEST_SUITES_SDK", True) or "auto").split() if t != "auto"] 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 -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 < -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" % (tcname, testdir), shell=True) except subprocess.CalledProcessError as e: bb.fatal("Couldn't install the SDK EXT:\n%s" % e.output) testsdkext_main[vardepsexclude] =+ "BB_ORIGENV" python do_testsdkext() { testsdkext_main(d) } addtask testsdkext do_testsdkext[nostamp] = "1" do_testsdkext[lockfiles] += "${TESTSDKEXTLOCK}"