diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-10 14:35:29 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-12 15:27:17 +0100 |
commit | fd1517e2b51a170f2427122c6b95396db251d827 (patch) | |
tree | dabfe3e631339c2fc99a9ee7febb0f9c128e325e /meta/classes-recipe/testsdk.bbclass | |
parent | 10317912ee319ccf7f83605d438b5cbf9663f296 (diff) | |
download | poky-fd1517e2b51a170f2427122c6b95396db251d827.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/testsdk.bbclass')
-rw-r--r-- | meta/classes-recipe/testsdk.bbclass | 52 |
1 files changed, 52 insertions, 0 deletions
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 @@ | |||
1 | # Copyright (C) 2013 - 2016 Intel Corporation | ||
2 | # | ||
3 | # SPDX-License-Identifier: MIT | ||
4 | |||
5 | # testsdk.bbclass enables testing for SDK and Extensible SDK | ||
6 | # | ||
7 | # To run SDK tests, run the commands: | ||
8 | # $ bitbake <image-name> -c populate_sdk | ||
9 | # $ bitbake <image-name> -c testsdk | ||
10 | # | ||
11 | # To run eSDK tests, run the commands: | ||
12 | # $ bitbake <image-name> -c populate_sdk_ext | ||
13 | # $ bitbake <image-name> -c testsdkext | ||
14 | # | ||
15 | # where "<image-name>" is an image like core-image-sato. | ||
16 | |||
17 | TESTSDK_CLASS_NAME ?= "oeqa.sdk.testsdk.TestSDK" | ||
18 | TESTSDKEXT_CLASS_NAME ?= "oeqa.sdkext.testsdk.TestSDKExt" | ||
19 | |||
20 | def import_and_run(name, d): | ||
21 | import importlib | ||
22 | |||
23 | class_name = d.getVar(name) | ||
24 | if class_name: | ||
25 | module, cls = class_name.rsplit('.', 1) | ||
26 | m = importlib.import_module(module) | ||
27 | c = getattr(m, cls)() | ||
28 | c.run(d) | ||
29 | else: | ||
30 | bb.warn('No tests were run because %s did not define a class' % name) | ||
31 | |||
32 | import_and_run[vardepsexclude] = "DATETIME BB_ORIGENV" | ||
33 | |||
34 | python do_testsdk() { | ||
35 | import_and_run('TESTSDK_CLASS_NAME', d) | ||
36 | } | ||
37 | addtask testsdk | ||
38 | do_testsdk[nostamp] = "1" | ||
39 | do_testsdk[network] = "1" | ||
40 | |||
41 | python do_testsdkext() { | ||
42 | import_and_run('TESTSDKEXT_CLASS_NAME', d) | ||
43 | } | ||
44 | addtask testsdkext | ||
45 | do_testsdkext[nostamp] = "1" | ||
46 | do_testsdkext[network] = "1" | ||
47 | |||
48 | python () { | ||
49 | if oe.types.boolean(d.getVar("TESTIMAGE_AUTO") or "False"): | ||
50 | bb.build.addtask("testsdk", None, "do_populate_sdk", d) | ||
51 | bb.build.addtask("testsdkext", None, "do_populate_sdk_ext", d) | ||
52 | } | ||