diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-07-22 20:39:13 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-28 11:50:17 +0100 |
commit | 3afd79df9e939e2dcdef7cdeb430dd81458673bc (patch) | |
tree | 70e58e88412b637184bb5317eebab266d1d705ed /meta/lib/oeqa/sdk | |
parent | 0f151cd090c787a687371683302611802186b3fb (diff) | |
download | poky-3afd79df9e939e2dcdef7cdeb430dd81458673bc.tar.gz |
oeqa/sdk: add a test class for running SDK tests directly in a Yocto build
This is a simpler version of the same class in testsdk.py, as it does not
need to unpack and set up the SDK, and can proceed to the tests straight away.
(From OE-Core rev: be21c62e5bd96164aab9e01168b7a43c6de44c17)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/sdk')
-rw-r--r-- | meta/lib/oeqa/sdk/testmetaidesupport.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oeqa/sdk/testmetaidesupport.py b/meta/lib/oeqa/sdk/testmetaidesupport.py new file mode 100644 index 0000000000..2ff76fd8e0 --- /dev/null +++ b/meta/lib/oeqa/sdk/testmetaidesupport.py | |||
@@ -0,0 +1,43 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: MIT | ||
3 | # | ||
4 | |||
5 | class TestSDK(object): | ||
6 | def run(self, d): | ||
7 | import json | ||
8 | import logging | ||
9 | from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor | ||
10 | from oeqa.utils import make_logger_bitbake_compatible | ||
11 | |||
12 | pn = d.getVar("PN") | ||
13 | |||
14 | logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) | ||
15 | |||
16 | sdk_dir = d.expand("${WORKDIR}/testsdk/") | ||
17 | bb.utils.remove(sdk_dir, True) | ||
18 | bb.utils.mkdirhier(sdk_dir) | ||
19 | |||
20 | sdk_envs = OESDKTestContextExecutor._get_sdk_environs(d.getVar("DEPLOY_DIR_IMAGE")) | ||
21 | tdname = d.expand("${DEPLOY_DIR_IMAGE}/${PN}.testdata.json") | ||
22 | test_data = json.load(open(tdname, "r")) | ||
23 | |||
24 | host_pkg_manifest = {"cmake-native":"", "gcc-cross":"", "gettext-native":"", "meson-native":"", "perl-native":"", "python3-core-native":"", } | ||
25 | target_pkg_manifest = {"gtk+3":""} | ||
26 | |||
27 | for s in sdk_envs: | ||
28 | bb.plain("meta-ide-support based SDK testing environment: %s" % s) | ||
29 | |||
30 | sdk_env = sdk_envs[s] | ||
31 | |||
32 | tc = OESDKTestContext(td=test_data, logger=logger, sdk_dir=sdk_dir, | ||
33 | sdk_env=sdk_env, target_pkg_manifest=target_pkg_manifest, | ||
34 | host_pkg_manifest=host_pkg_manifest) | ||
35 | |||
36 | tc.loadTests(OESDKTestContextExecutor.default_cases) | ||
37 | |||
38 | results = tc.runTests() | ||
39 | if results: | ||
40 | results.logSummary(pn) | ||
41 | |||
42 | if (not results) or (not results.wasSuccessful()): | ||
43 | bb.fatal('%s - FAILED' % (pn,), forcelog=True) | ||