From fd1517e2b51a170f2427122c6b95396db251d827 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 10 Aug 2022 14:35:29 +0100 Subject: classes: Update classes to match new bitbake class scope functionality Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie --- meta/classes-recipe/testsdk.bbclass | 52 +++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 meta/classes-recipe/testsdk.bbclass (limited to 'meta/classes-recipe/testsdk.bbclass') diff --git a/meta/classes-recipe/testsdk.bbclass b/meta/classes-recipe/testsdk.bbclass new file mode 100644 index 0000000000..fd82e6ef41 --- /dev/null +++ b/meta/classes-recipe/testsdk.bbclass @@ -0,0 +1,52 @@ +# Copyright (C) 2013 - 2016 Intel Corporation +# +# SPDX-License-Identifier: MIT + +# testsdk.bbclass enables testing for SDK and Extensible SDK +# +# To run SDK tests, run the commands: +# $ bitbake -c populate_sdk +# $ bitbake -c testsdk +# +# To run eSDK tests, run the commands: +# $ bitbake -c populate_sdk_ext +# $ bitbake -c testsdkext +# +# where "" 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" +do_testsdk[network] = "1" + +python do_testsdkext() { + import_and_run('TESTSDKEXT_CLASS_NAME', d) +} +addtask testsdkext +do_testsdkext[nostamp] = "1" +do_testsdkext[network] = "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) +} -- cgit v1.2.3-54-g00ecf