mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

* 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>
123 lines
4.3 KiB
Python
123 lines
4.3 KiB
Python
#
|
|
# Copyright OpenEmbedded Contributors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
import tempfile
|
|
import shutil
|
|
import os
|
|
import glob
|
|
import time
|
|
from oeqa.selftest.case import OESelftestTestCase
|
|
from oeqa.utils.commands import runCmd, bitbake, get_bb_vars
|
|
|
|
class oeSDKExtSelfTest(OESelftestTestCase):
|
|
"""
|
|
# Bugzilla Test Plan: 6033
|
|
# This code is planned to be part of the automation for eSDK containig
|
|
# Install libraries and headers, image generation binary feeds, sdk-update.
|
|
"""
|
|
|
|
@staticmethod
|
|
def get_esdk_environment(env_eSDK, tmpdir_eSDKQA):
|
|
# XXX: at this time use the first env need to investigate
|
|
# what environment load oe-selftest, i586, x86_64
|
|
pattern = os.path.join(tmpdir_eSDKQA, 'environment-setup-*')
|
|
return glob.glob(pattern)[0]
|
|
|
|
@staticmethod
|
|
def run_esdk_cmd(env_eSDK, tmpdir_eSDKQA, cmd, postconfig=None, **options):
|
|
if postconfig:
|
|
esdk_conf_file = os.path.join(tmpdir_eSDKQA, 'conf', 'local.conf')
|
|
with open(esdk_conf_file, 'a+') as f:
|
|
f.write(postconfig)
|
|
if not options:
|
|
options = {}
|
|
if not 'shell' in options:
|
|
options['shell'] = True
|
|
|
|
runCmd("cd %s; unset BBPATH; unset BUILDDIR; . %s; %s" % (tmpdir_eSDKQA, env_eSDK, cmd), **options)
|
|
|
|
@staticmethod
|
|
def generate_eSDK(image):
|
|
pn_task = '%s -c populate_sdk_ext' % image
|
|
bitbake(pn_task)
|
|
|
|
@staticmethod
|
|
def get_eSDK_toolchain(image):
|
|
pn_task = '%s -c populate_sdk_ext' % image
|
|
|
|
bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task)
|
|
sdk_deploy = bb_vars['SDK_DEPLOY']
|
|
toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME']
|
|
return os.path.join(sdk_deploy, toolchain_name + '.sh')
|
|
|
|
@staticmethod
|
|
def update_configuration(cls, image, tmpdir_eSDKQA, env_eSDK, ext_sdk_path):
|
|
sstate_dir = os.path.join(os.environ['BUILDDIR'], 'sstate-cache')
|
|
|
|
oeSDKExtSelfTest.generate_eSDK(cls.image)
|
|
|
|
cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
|
|
runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))
|
|
|
|
cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)
|
|
|
|
sstate_config="""
|
|
ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS"
|
|
SSTATE_MIRRORS = "file://.* file://%s/PATH"
|
|
CORE_IMAGE_EXTRA_INSTALL = "perl"
|
|
""" % sstate_dir
|
|
|
|
with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
|
|
f.write(sstate_config)
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(oeSDKExtSelfTest, cls).setUpClass()
|
|
cls.image = 'core-image-minimal'
|
|
|
|
bb_vars = get_bb_vars(['SSTATE_DIR', 'WORKDIR'], cls.image)
|
|
bb.utils.mkdirhier(bb_vars["WORKDIR"])
|
|
cls.tmpdirobj = tempfile.TemporaryDirectory(prefix="selftest-esdk-", dir=bb_vars["WORKDIR"])
|
|
cls.tmpdir_eSDKQA = cls.tmpdirobj.name
|
|
|
|
oeSDKExtSelfTest.generate_eSDK(cls.image)
|
|
|
|
# Install eSDK
|
|
cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
|
|
runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))
|
|
|
|
cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)
|
|
|
|
# Configure eSDK to use sstate mirror from poky
|
|
sstate_config="""
|
|
ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS"
|
|
SSTATE_MIRRORS = "file://.* file://%s/PATH"
|
|
""" % bb_vars["SSTATE_DIR"]
|
|
with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
|
|
f.write(sstate_config)
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
for i in range(0, 10):
|
|
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')):
|
|
time.sleep(1)
|
|
else:
|
|
break
|
|
cls.tmpdirobj.cleanup()
|
|
super().tearDownClass()
|
|
|
|
def test_install_libraries_headers(self):
|
|
pn_sstate = 'bc'
|
|
bitbake(pn_sstate)
|
|
cmd = "devtool sdk-install %s " % pn_sstate
|
|
oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
|
|
|
|
def test_image_generation_binary_feeds(self):
|
|
image = 'core-image-minimal'
|
|
cmd = "devtool build-image %s" % image
|
|
oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd)
|
|
|