summaryrefslogtreecommitdiff
path: root/poky/meta/classes/testsdk.bbclass
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2019-02-07 00:01:43 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-02-07 06:42:14 +0300
commit977dc1ac484e0c201b30f551e5f2d1d32e27eccf (patch)
treee13bde6791728dc10e5f04de29858c25f2ac5fa6 /poky/meta/classes/testsdk.bbclass
parent8fcf4c59a86ff23e3a2eb6101b5ffacdd50093f9 (diff)
downloadopenbmc-977dc1ac484e0c201b30f551e5f2d1d32e27eccf.tar.xz
poky: refresh thud: 1d987b98ed..ee7dd31944
Update poky to thud HEAD. Alex Kiernan (2): systemd: backport fix to stop enabling ECN systemd: Add PACKAGECONFIG for gnutls Alexander Kanavin (3): lighttpd: update to 1.4.51 boost: update to 1.69.0 systemd: backport a patch to fix meson 0.49.0 issue Alexey Brodkin (1): wic: sdimage-bootpart: Use mmcblk0 drive instead of bogus mmcblk André Draszik (1): meta: remove True option to getVar calls (again) Anuj Mittal (6): eudev: upgrade 3.2.5 -> 3.2.7 gsettings-desktop-schemas: upgrade 3.28.0 -> 3.28.1 libatomic-ops: upgrade 7.6.6 -> 7.6.8 libpng: upgrade 1.6.35 -> 1.6.36 common-licenses: update Libpng license text i2c-tools: upgrade 4.0 -> 4.1 Aníbal Limón (1): meta/classes/testimage.bbclass: Only validate IMAGE_FSTYPES when is QEMU Armin Kuster (1): tzdata/tzcode-native: update to 2018i Brad Bishop (1): systemd-systemctl-native: handle Install wildcards Bruce Ashfield (3): kernel: use olddefconfig as the primary target for KERNEL_CONFIG_COMMAND linux-yocto/4.18: update to v4.18.22 linux-yocto/4.18: update to v4.18.25 Changqing Li (1): libsndfile1: Security fix CVE-2017-17456/17457 CVE-2018-19661/19662 Chen Qi (3): package.bbclass: fix python unclosed file ResourceWarning eSDK.py: avoid error in tearDownClass due to race condistion eSDK.py: unset BBPATH and BUILDDIR to avoid eSDK failure Douglas Royds (6): icecc: readlink -f on the recipe-sysroot gcc/g++ icecc: Trivial simplification icecc: Syntax error meant that we weren't waiting for tarball generation icecc: Don't generate recipe-sysroot symlinks at recipe-parsing time icecc: patchelf is needed by icecc-create-env patch: reproducibility: Fix host umask leakage Erik Botö (1): testimage: Add possibility to pass parmeters to qemu Federico Sauter (1): kernel: don't assign the build user/host Joshua Watt (1): classes/testsdk: Split implementation into classes Kai Kang (2): testimage.bbclass: remove boot parameter systemd.log_target systemd: fix compile error for x32 Kevin Hao (1): meta-yocto-bsp: Bump to the latest stable kernel for the non-x86 BSPs Khem Raj (6): grub2: Fix passing null to printf formats gnupg: Upgrade to 2.2.12 release binutils: Fix build with clang binutils: Upgrade to latest on 2.31 release branch binutils: bfd doesn't handle ELF compressed data alignment systemd: Fix memory use after free errors Manjukumar Matha (1): kernel.bbclass: Fix incorrect deploying of fitimage.initramfs Marcus Cooper (3): systemd: Security fix CVE-2018-16864 systemd: Security fix CVE-2018-16865 systemd: Security fix CVE-2018-16866 Michael Ho (1): sstate: add support for caching shared workdir tasks Naveen Saini (2): linux-yocto: update genericx86* SRCREV for 4.18 linux-yocto: update genericx86* SRCREV for 4.18 Peter Kjellerstedt (2): systemd: Correct and clean up user/group definitions systemd: Correct a conditional add to SYSTEMD_PACKAGES Richard Purdie (9): nativesdk-*-provides-dummy: Fixes to allow correct operation with opkg classes: Correctly markup regex strings testimage: Remove duplicate dependencies testimage: Simplfy DEFAULT_TEST_SUITES logic testimage: Further cleanup DEFAULT_TEST_SUITES testimage: Enable autorunning of the package manager testsuites oeqa/runtime/cases: Improve test dependency information oeqa/runtime/cases: Improve dependencies of kernel/gcc/build tests oeqa/utils/buildproject: Only clean files if we've done something Robert Yang (7): oeqa/utils/qemurunner: Print output when failed to login oeqa/utils/qemurunner: set timeout to 60s for run_serial oeqa: Fix for QEMU_USE_KVM oeqa: make it work for multiple users runqemu-gen-tapdevs: Allow run --help without sudo oeqa/manual/bsp-qemu.json: Update for QEMU_USE_KVM oeqa/selftest/runqemu: Enable kvm when QEMU_USE_KVM is set Ross Burton (2): toolchain-scripts: run post-relocate scripts for every environment runqemu: clean up subprocess usage Yeoh Ee Peng (3): scripts/oe-git-archive: fix non-existent key referencing error testimage: Add support for slirp oeqa/qemu & runtime: qemu do not need ip input from external OpenBMC compatibility updates: meta-phosphor: Brad Bishop (1): phosphor: rebase i2c-tools patches Change-Id: Idc626fc076580aeebde1420bcad01e069b559504 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/classes/testsdk.bbclass')
-rw-r--r--poky/meta/classes/testsdk.bbclass217
1 files changed, 15 insertions, 202 deletions
diff --git a/poky/meta/classes/testsdk.bbclass b/poky/meta/classes/testsdk.bbclass
index 458c3f40b0..758a23ac55 100644
--- a/poky/meta/classes/testsdk.bbclass
+++ b/poky/meta/classes/testsdk.bbclass
@@ -14,218 +14,31 @@
#
# where "<image-name>" is an image like core-image-sato.
-def get_sdk_configuration(d, test_type):
- import platform
- from oeqa.utils.metadata import get_layers
- configuration = {'TEST_TYPE': test_type,
- 'MACHINE': d.getVar("MACHINE"),
- 'SDKMACHINE': d.getVar("SDKMACHINE"),
- 'IMAGE_BASENAME': d.getVar("IMAGE_BASENAME"),
- 'IMAGE_PKGTYPE': d.getVar("IMAGE_PKGTYPE"),
- 'STARTTIME': d.getVar("DATETIME"),
- 'HOST_DISTRO': oe.lsb.distro_identifier().replace(' ', '-'),
- 'LAYERS': get_layers(d.getVar("BBLAYERS"))}
- return configuration
-get_sdk_configuration[vardepsexclude] = "DATETIME"
+TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK"
+TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt"
-def get_sdk_json_result_dir(d):
- json_result_dir = os.path.join(d.getVar("LOG_DIR"), 'oeqa')
- custom_json_result_dir = d.getVar("OEQA_JSON_RESULT_DIR")
- if custom_json_result_dir:
- json_result_dir = custom_json_result_dir
- return json_result_dir
+def import_and_run(name, d):
+ import importlib
-def get_sdk_result_id(configuration):
- return '%s_%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], configuration['SDKMACHINE'], configuration['MACHINE'], configuration['STARTTIME'])
+ class_name = d.getVar(name)
+ if class_name:
+ module, cls = class_name.rsplit('.', 1)
+ m = importlib.import_module(module)
+ c = getattr(m, cls)()
+ c.run(d)
+ else:
+ bb.warn('No tests were run because %s did not define a class' % name)
-def testsdk_main(d):
- import os
- import subprocess
- import json
- import logging
-
- from bb.utils import export_proxies
- from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor
- from oeqa.utils import make_logger_bitbake_compatible
-
- pn = d.getVar("PN")
- logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
-
- # sdk use network for download projects for build
- export_proxies(d)
-
- 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 <image> -c populate_sdk' ." % tcname)
-
- tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.testdata.json")
- test_data = json.load(open(tdname, "r"))
-
- 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"))
-
- processes = d.getVar("TESTIMAGE_NUMBER_THREADS") or d.getVar("BB_NUMBER_THREADS")
- if processes:
- try:
- import testtools, subunit
- except ImportError:
- bb.warn("Failed to import testtools or subunit, the testcases will run serially")
- processes = None
-
- 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 <<EOF\n./\nY\nEOF" % (sdk_dir, tcname), shell=True)
- except subprocess.CalledProcessError as e:
- bb.fatal("Couldn't install the SDK:\n%s" % e.output.decode("utf-8"))
-
- fail = False
- sdk_envs = OESDKTestContextExecutor._get_sdk_environs(sdk_dir)
- for s in sdk_envs:
- sdk_env = sdk_envs[s]
- bb.plain("SDK testing environment: %s" % s)
- tc = OESDKTestContext(td=test_data, logger=logger, sdk_dir=sdk_dir,
- sdk_env=sdk_env, target_pkg_manifest=target_pkg_manifest,
- host_pkg_manifest=host_pkg_manifest)
-
- try:
- tc.loadTests(OESDKTestContextExecutor.default_cases)
- except Exception as e:
- import traceback
- bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
-
- if processes:
- result = tc.runTests(processes=int(processes))
- else:
- result = tc.runTests()
-
- component = "%s %s" % (pn, OESDKTestContextExecutor.name)
- context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
- configuration = get_sdk_configuration(d, 'sdk')
- result.logDetails(get_sdk_json_result_dir(d),
- configuration,
- get_sdk_result_id(configuration))
- result.logSummary(component, context_msg)
-
- if not result.wasSuccessful():
- fail = True
-
- if fail:
- bb.fatal("%s - FAILED - check the task log and the commands log" % pn)
-
-testsdk_main[vardepsexclude] =+ "BB_ORIGENV"
+import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV"
python do_testsdk() {
- testsdk_main(d)
+ import_and_run('TESTSDK_CLASS_NAME', d)
}
addtask testsdk
do_testsdk[nostamp] = "1"
-def testsdkext_main(d):
- import os
- import json
- import subprocess
- import logging
-
- from bb.utils import export_proxies
- from oeqa.utils import avoid_paths_in_environ, make_logger_bitbake_compatible, subprocesstweak
- from oeqa.sdkext.context import OESDKExtTestContext, OESDKExtTestContextExecutor
-
- pn = d.getVar("PN")
- logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
-
- # extensible sdk use network
- export_proxies(d)
-
- subprocesstweak.errors_have_output()
-
- # extensible sdk can be contaminated if native programs are
- # in PATH, i.e. use perl-native instead of eSDK one.
- paths_to_avoid = [d.getVar('STAGING_DIR'),
- d.getVar('BASE_WORKDIR')]
- os.environ['PATH'] = avoid_paths_in_environ(paths_to_avoid)
-
- tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh")
- if not os.path.exists(tcname):
- bb.fatal("The toolchain ext %s is not built. Build it before running the" \
- " tests: 'bitbake <image> -c populate_sdk_ext' ." % tcname)
-
- tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.testdata.json")
- test_data = json.load(open(tdname, "r"))
-
- target_pkg_manifest = OESDKExtTestContextExecutor._load_manifest(
- d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"))
- host_pkg_manifest = OESDKExtTestContextExecutor._load_manifest(
- d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"))
-
- sdk_dir = d.expand("${WORKDIR}/testsdkext/")
- bb.utils.remove(sdk_dir, True)
- bb.utils.mkdirhier(sdk_dir)
- try:
- subprocess.check_output("%s -y -d %s" % (tcname, sdk_dir), shell=True)
- except subprocess.CalledProcessError as e:
- msg = "Couldn't install the extensible SDK:\n%s" % e.output.decode("utf-8")
- logfn = os.path.join(sdk_dir, 'preparing_build_system.log')
- if os.path.exists(logfn):
- msg += '\n\nContents of preparing_build_system.log:\n'
- with open(logfn, 'r') as f:
- for line in f:
- msg += line
- bb.fatal(msg)
-
- fail = False
- sdk_envs = OESDKExtTestContextExecutor._get_sdk_environs(sdk_dir)
- for s in sdk_envs:
- bb.plain("Extensible SDK testing environment: %s" % s)
-
- sdk_env = sdk_envs[s]
-
- # Use our own SSTATE_DIR and DL_DIR so that updates to the eSDK come from our sstate cache
- # and we don't spend hours downloading kernels for the kernel module test
- # Abuse auto.conf since local.conf would be overwritten by the SDK
- with open(os.path.join(sdk_dir, 'conf', 'auto.conf'), 'a+') as f:
- f.write('SSTATE_MIRRORS += " \\n file://.* file://%s/PATH"\n' % test_data.get('SSTATE_DIR'))
- f.write('SOURCE_MIRROR_URL = "file://%s"\n' % test_data.get('DL_DIR'))
- f.write('INHERIT += "own-mirrors"\n')
- f.write('PREMIRRORS_prepend = " git://git.yoctoproject.org/.* git://%s/git2/git.yoctoproject.org.BASENAME \\n "\n' % test_data.get('DL_DIR'))
-
- # We need to do this in case we have a minimal SDK
- subprocess.check_output(". %s > /dev/null; devtool sdk-install meta-extsdk-toolchain" % \
- sdk_env, cwd=sdk_dir, shell=True, stderr=subprocess.STDOUT)
-
- tc = OESDKExtTestContext(td=test_data, logger=logger, sdk_dir=sdk_dir,
- sdk_env=sdk_env, target_pkg_manifest=target_pkg_manifest,
- host_pkg_manifest=host_pkg_manifest)
-
- try:
- tc.loadTests(OESDKExtTestContextExecutor.default_cases)
- except Exception as e:
- import traceback
- bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
-
- result = tc.runTests()
-
- component = "%s %s" % (pn, OESDKExtTestContextExecutor.name)
- context_msg = "%s:%s" % (os.path.basename(tcname), os.path.basename(sdk_env))
- configuration = get_sdk_configuration(d, 'sdkext')
- result.logDetails(get_sdk_json_result_dir(d),
- configuration,
- get_sdk_result_id(configuration))
- result.logSummary(component, context_msg)
-
- if not result.wasSuccessful():
- fail = True
-
- if fail:
- bb.fatal("%s - FAILED - check the task log and the commands log" % pn)
-
-testsdkext_main[vardepsexclude] =+ "BB_ORIGENV"
-
python do_testsdkext() {
- testsdkext_main(d)
+ import_and_run('TESTSDKEXT_CLASS_NAME', d)
}
addtask testsdkext
do_testsdkext[nostamp] = "1"