# 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 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' .") 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) try: subprocess.check_output("cd %s; %s <