poky/meta/classes/testsdk.bbclass
Joshua Watt 1554c7c3a6 classes/testsdk: Split implementation into classes
Splits the SDK test implementation into configurable Python classes. The
classes used for the normal and extensible SDKs are
${TESTSDK_CLASS_NAME} and ${TESTSDKEXT_CLASS_NAME} respectively.

This allows SDK machines to override the classes used to implement the
tests. For the traditional SDK, a common "run()" function is provided by
the class (oeqa.sdk.testsdk.TestSDK), with several hook member functions
that can be overridden in child classes, making it easier to have
consistent behavior. The extensible SDK class
(oeqa.sdkext.testsdk.TestSDKEXT) also has a common "run()" function, but
no hooks have yet been added as there is not currently a known use case
for create derived classes.

These changes should be purely organizational; no functional changes
have been made to either the standard SDK or extensible SDK tests.

[YOCTO #13020]

(From OE-Core rev: a06d53928b22d5f88276023c4d57b206db2f27f9)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-21 11:54:14 +00:00

51 lines
1.4 KiB
Plaintext

# Copyright (C) 2013 - 2016 Intel Corporation
#
# Released under the MIT license (see COPYING.MIT)
# testsdk.bbclass enables testing for SDK and Extensible SDK
#
# To run SDK tests, run the commands:
# $ bitbake <image-name> -c populate_sdk
# $ bitbake <image-name> -c testsdk
#
# To run eSDK tests, run the commands:
# $ bitbake <image-name> -c populate_sdk_ext
# $ bitbake <image-name> -c testsdkext
#
# where "<image-name>" is an image like core-image-sato.
TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK"
TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt"
def import_and_run(name, d):
import importlib
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)
import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV"
python do_testsdk() {
import_and_run('TESTSDK_CLASS_NAME', d)
}
addtask testsdk
do_testsdk[nostamp] = "1"
python do_testsdkext() {
import_and_run('TESTSDKEXT_CLASS_NAME', d)
}
addtask testsdkext
do_testsdkext[nostamp] = "1"
python () {
if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"):
bb.build.addtask("testsdk", None, "do_populate_sdk", d)
bb.build.addtask("testsdkext", None, "do_populate_sdk_ext", d)
}