diff options
| author | Martin Jansa <Martin.Jansa@gmail.com> | 2023-03-13 15:20:32 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-30 23:26:04 +0100 |
| commit | 953007b68ba61003700e9907df04e4a05b65a3f8 (patch) | |
| tree | ab4831ff5549132c5a9a38e75cf5e22382c5cc2d /meta/lib/oeqa/selftest/cases/esdk.py | |
| parent | df3ce81ed3e5491b084041c5bcbd16dada129cf9 (diff) | |
| download | poky-953007b68ba61003700e9907df04e4a05b65a3f8.tar.gz | |
selftest: eSDK rename to esdk
* I was hit by oe-selftest -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers
running all tests except only this selected one:
poky $ oe-selftest -v -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers -K -B /OE/build/poky/build-eSDK
2023-03-13 14:00:52,955 - oe-selftest - DEBUG - Selected tests with -r: ['eSDK.oeSDKExtSelfTest.test_install_libraries_headers']
2023-03-13 14:00:55,531 - oe-selftest - INFO - Changing cwd to /OE/build/poky/build
..
2023-03-13 14:00:58,128 - oe-selftest - INFO - test_archiver_allows_to_filter_on_recipe_name (archiver.Archiver.test_archiver_allows_to_filter_on_recipe_name)
this is caused by _built_modules_dict(modules) function
which filters out eSDK.oeSDKExtSelfTest.test_install_libraries_headers
based on the regexp and then it runs all loaded tests, because
modules are empty
the initial regexp and comment from 2017:
https://git.openembedded.org/openembedded-core/commit/?id=80db3d999ae26d298d9d5418a32b11a4f27af9d5
# Assumption: package and module names do not contain upper case
# characters, whereas class names do
m = re.match(r'^([^A-Z]+)(?:\.([A-Z][^.]*)(?:\.([^.]+))?)?$', module)
might still be valid, but it was loosened in 2018 to accept upper case in module:
https://git.openembedded.org/openembedded-core/commit/?id=1ecf48fd286a77078451b67879a44f9c9dc7a894
Some test cases (eSDK.oeSDK*, runtime_test/*) does not match with current regex, fix it accept all.
Then skipping the not matching modules was added later in 2018:
https://git.openembedded.org/openembedded-core/commit/?id=f2042bf3638ed4edfb167e7f7d4be6da60997ead
and regexp was updated again in 2020 not to accept upper case in modules:
https://git.openembedded.org/openembedded-core/commit/?id=ad81ea90a815389e45ff302a85151724c71f71c3
oeqa/core/loader: refine regex to find module
test case in format <module name>.<class name>.<test case name>
this is clear when test cases is only 3 item deep.
but confused when it is 4 item deep, eg,
oelib.types.TestList.test_list_nosep
I'm afraid that changing this regexp again to accept eSDK will break
someone's favorite test case, renaming eSDK looks much safer option
There is only 1 such case in poky:
$ oe-selftest --list-modules | grep INFO.- | sed 's/^.*INFO - //g' | grep -v '^[a-z_\.]*$'
Listing all available test modules:
eSDK
Most modules are just a-z (52x), then oelib.<foo> (6x) and 7 modules with underscore '_'.
(From OE-Core rev: 173ef4397b5be19f72385b1a0d892a1fa8979d53)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/esdk.py')
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/esdk.py | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/esdk.py b/meta/lib/oeqa/selftest/cases/esdk.py new file mode 100644 index 0000000000..9f5de2cde7 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/esdk.py | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | # | ||
| 2 | # Copyright OpenEmbedded Contributors | ||
| 3 | # | ||
| 4 | # SPDX-License-Identifier: MIT | ||
| 5 | # | ||
| 6 | |||
| 7 | import tempfile | ||
| 8 | import shutil | ||
| 9 | import os | ||
| 10 | import glob | ||
| 11 | import time | ||
| 12 | from oeqa.selftest.case import OESelftestTestCase | ||
| 13 | from oeqa.utils.commands import runCmd, bitbake, get_bb_vars | ||
| 14 | |||
| 15 | class oeSDKExtSelfTest(OESelftestTestCase): | ||
| 16 | """ | ||
| 17 | # Bugzilla Test Plan: 6033 | ||
| 18 | # This code is planned to be part of the automation for eSDK containig | ||
| 19 | # Install libraries and headers, image generation binary feeds, sdk-update. | ||
| 20 | """ | ||
| 21 | |||
| 22 | @staticmethod | ||
| 23 | def get_esdk_environment(env_eSDK, tmpdir_eSDKQA): | ||
| 24 | # XXX: at this time use the first env need to investigate | ||
| 25 | # what environment load oe-selftest, i586, x86_64 | ||
| 26 | pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*') | ||
| 27 | return glob.glob(pattern)[0] | ||
| 28 | |||
| 29 | @staticmethod | ||
| 30 | def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options): | ||
| 31 | if postconfig: | ||
| 32 | esdk_conf_file = os.path.join(tmpdir_eSDKQA, 'conf', 'local.conf') | ||
| 33 | with open(esdk_conf_file, 'a+') as f: | ||
| 34 | f.write(postconfig) | ||
| 35 | if not options: | ||
| 36 | options = {} | ||
| 37 | if not 'shell' in options: | ||
| 38 | options['shell'] = True | ||
| 39 | |||
| 40 | runCmd("cd %s; unset BBPATH; unset BUILDDIR; . %s; %s" % (tmpdir_eSDKQA, env_eSDK, cmd), **options) | ||
| 41 | |||
| 42 | @staticmethod | ||
| 43 | def generate_eSDK(image): | ||
| 44 | pn_task = '%s -c populate_sdk_ext' % image | ||
| 45 | bitbake(pn_task) | ||
| 46 | |||
| 47 | @staticmethod | ||
| 48 | def get_eSDK_toolchain(image): | ||
| 49 | pn_task = '%s -c populate_sdk_ext' % image | ||
| 50 | |||
| 51 | bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task) | ||
| 52 | sdk_deploy = bb_vars['SDK_DEPLOY'] | ||
| 53 | toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME'] | ||
| 54 | return os.path.join(sdk_deploy, toolchain_name + '.sh') | ||
| 55 | |||
| 56 | @staticmethod | ||
| 57 | def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path): | ||
| 58 | sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache') | ||
| 59 | |||
| 60 | oeSDKExtSelfTest.generate_eSDK(cls.image) | ||
| 61 | |||
| 62 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) | ||
| 63 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) | ||
| 64 | |||
| 65 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) | ||
| 66 | |||
| 67 | sstate_config=""" | ||
| 68 | ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS" | ||
| 69 | SSTATE_MIRRORS = "file://.* file://%s/PATH" | ||
| 70 | CORE_IMAGE_EXTRA_INSTALL = "perl" | ||
| 71 | """ % sstate_dir | ||
| 72 | |||
| 73 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | ||
| 74 | f.write(sstate_config) | ||
| 75 | |||
| 76 | @classmethod | ||
| 77 | def setUpClass(cls): | ||
| 78 | super(oeSDKExtSelfTest, cls).setUpClass() | ||
| 79 | cls.image = 'core-image-minimal' | ||
| 80 | |||
| 81 | bb_vars = get_bb_vars(['SSTATE_DIR', 'WORKDIR'], cls.image) | ||
| 82 | bb.utils.mkdirhier(bb_vars["WORKDIR"]) | ||
| 83 | cls.tmpdirobj = tempfile.TemporaryDirectory(prefix="selftest-esdk-", dir=bb_vars["WORKDIR"]) | ||
| 84 | cls.tmpdir_eSDKQA = cls.tmpdirobj.name | ||
| 85 | |||
| 86 | oeSDKExtSelfTest.generate_eSDK(cls.image) | ||
| 87 | |||
| 88 | # Install eSDK | ||
| 89 | cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) | ||
| 90 | runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) | ||
| 91 | |||
| 92 | cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) | ||
| 93 | |||
| 94 | # Configure eSDK to use sstate mirror from poky | ||
| 95 | sstate_config=""" | ||
| 96 | ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS" | ||
| 97 | SSTATE_MIRRORS = "file://.* file://%s/PATH" | ||
| 98 | """ % bb_vars["SSTATE_DIR"] | ||
| 99 | with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: | ||
| 100 | f.write(sstate_config) | ||
| 101 | |||
| 102 | @classmethod | ||
| 103 | def tearDownClass(cls): | ||
| 104 | for i in range(0, 10): | ||
| 105 | if os.path.exists(os.path.join(cls.tmpdir_eSDKQA, 'bitbake.lock')) or os.path.exists(os.path.join(cls.tmpdir_eSDKQA, 'cache/hashserv.db-wal')): | ||
| 106 | time.sleep(1) | ||
| 107 | else: | ||
| 108 | break | ||
| 109 | cls.tmpdirobj.cleanup() | ||
| 110 | super().tearDownClass() | ||
| 111 | |||
| 112 | def test_install_libraries_headers(self): | ||
| 113 | pn_sstate = 'bc' | ||
| 114 | bitbake(pn_sstate) | ||
| 115 | cmd = "devtool sdk-install %s " % pn_sstate | ||
| 116 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | ||
| 117 | |||
| 118 | def test_image_generation_binary_feeds(self): | ||
| 119 | image = 'core-image-minimal' | ||
| 120 | cmd = "devtool build-image %s" % image | ||
| 121 | oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) | ||
| 122 | |||
