Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 1 | # |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | # Copyright OpenEmbedded Contributors |
| 3 | # |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 4 | # SPDX-License-Identifier: MIT |
| 5 | # |
| 6 | |
| 7 | class TestSDK(object): |
| 8 | def run(self, d): |
| 9 | import json |
| 10 | import logging |
| 11 | from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor |
| 12 | from oeqa.utils import make_logger_bitbake_compatible |
| 13 | |
| 14 | pn = d.getVar("PN") |
| 15 | |
| 16 | logger = make_logger_bitbake_compatible(logging.getLogger("BitBake")) |
| 17 | |
| 18 | sdk_dir = d.expand("${WORKDIR}/testsdk/") |
| 19 | bb.utils.remove(sdk_dir, True) |
| 20 | bb.utils.mkdirhier(sdk_dir) |
| 21 | |
| 22 | sdk_envs = OESDKTestContextExecutor._get_sdk_environs(d.getVar("DEPLOY_DIR_IMAGE")) |
| 23 | tdname = d.expand("${DEPLOY_DIR_IMAGE}/${PN}.testdata.json") |
| 24 | test_data = json.load(open(tdname, "r")) |
| 25 | |
| 26 | host_pkg_manifest = {"cmake-native":"", "gcc-cross":"", "gettext-native":"", "meson-native":"", "perl-native":"", "python3-core-native":"", } |
| 27 | target_pkg_manifest = {"gtk+3":""} |
| 28 | |
| 29 | for s in sdk_envs: |
| 30 | bb.plain("meta-ide-support based SDK testing environment: %s" % s) |
| 31 | |
| 32 | sdk_env = sdk_envs[s] |
| 33 | |
| 34 | tc = OESDKTestContext(td=test_data, logger=logger, sdk_dir=sdk_dir, |
| 35 | sdk_env=sdk_env, target_pkg_manifest=target_pkg_manifest, |
| 36 | host_pkg_manifest=host_pkg_manifest) |
| 37 | |
| 38 | tc.loadTests(OESDKTestContextExecutor.default_cases) |
| 39 | |
| 40 | results = tc.runTests() |
| 41 | if results: |
| 42 | results.logSummary(pn) |
| 43 | |
| 44 | if (not results) or (not results.wasSuccessful()): |
| 45 | bb.fatal('%s - FAILED' % (pn,), forcelog=True) |