From 193236933b0f4ab91b1625b64e2187e2db4e0e8f Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Fri, 5 Apr 2019 15:28:33 -0400 Subject: reset upstream subtrees to HEAD Reset the following subtrees on HEAD: poky: 8217b477a1(master) meta-xilinx: 64aa3d35ae(master) meta-openembedded: 0435c9e193(master) meta-raspberrypi: 490a4441ac(master) meta-security: cb6d1c85ee(master) Squashed patches: meta-phosphor: drop systemd 239 patches meta-phosphor: mrw-api: use correct install path Change-Id: I268e2646d9174ad305630c6bbd3fbc1a6105f43d Signed-off-by: Brad Bishop --- poky/meta/lib/oeqa/selftest/cases/bbtests.py | 6 +- poky/meta/lib/oeqa/selftest/cases/buildoptions.py | 12 +- poky/meta/lib/oeqa/selftest/cases/devtool.py | 2 +- poky/meta/lib/oeqa/selftest/cases/distrodata.py | 88 ++++++------- poky/meta/lib/oeqa/selftest/cases/imagefeatures.py | 26 ++++ poky/meta/lib/oeqa/selftest/cases/multiconfig.py | 43 +++++++ poky/meta/lib/oeqa/selftest/cases/package.py | 2 +- poky/meta/lib/oeqa/selftest/cases/pkgdata.py | 5 +- poky/meta/lib/oeqa/selftest/cases/prservice.py | 4 +- poky/meta/lib/oeqa/selftest/cases/recipeutils.py | 137 +++++++++++++++++++++ poky/meta/lib/oeqa/selftest/cases/runcmd.py | 4 +- poky/meta/lib/oeqa/selftest/cases/runtime_test.py | 66 ++++++++++ poky/meta/lib/oeqa/selftest/cases/sstatetests.py | 18 +-- poky/meta/lib/oeqa/selftest/context.py | 1 + 14 files changed, 339 insertions(+), 75 deletions(-) create mode 100644 poky/meta/lib/oeqa/selftest/cases/multiconfig.py create mode 100644 poky/meta/lib/oeqa/selftest/cases/recipeutils.py (limited to 'poky/meta/lib/oeqa/selftest') diff --git a/poky/meta/lib/oeqa/selftest/cases/bbtests.py b/poky/meta/lib/oeqa/selftest/cases/bbtests.py index 005fdd096..c503e4eed 100644 --- a/poky/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/poky/meta/lib/oeqa/selftest/cases/bbtests.py @@ -40,8 +40,8 @@ class BitbakeTests(OESelftestTestCase): def test_event_handler(self): self.write_config("INHERIT += \"test_events\"") result = bitbake('m4-native') - find_build_started = re.search("NOTE: Test for bb\.event\.BuildStarted(\n.*)*NOTE: Executing RunQueue Tasks", result.output) - find_build_completed = re.search("Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) + find_build_started = re.search(r"NOTE: Test for bb\.event\.BuildStarted(\n.*)*NOTE: Executing RunQueue Tasks", result.output) + find_build_completed = re.search(r"Tasks Summary:.*(\n.*)*NOTE: Test for bb\.event\.BuildCompleted", result.output) self.assertTrue(find_build_started, msg = "Match failed in:\n%s" % result.output) self.assertTrue(find_build_completed, msg = "Match failed in:\n%s" % result.output) self.assertFalse('Test for bb.event.InvalidEvent' in result.output, msg = "\"Test for bb.event.InvalidEvent\" message found during bitbake process. bitbake output: %s" % result.output) @@ -196,7 +196,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" @OETestID(1031) def test_version(self): result = runCmd('bitbake -s | grep wget') - find = re.search("wget *:([0-9a-zA-Z\.\-]+)", result.output) + find = re.search(r"wget *:([0-9a-zA-Z\.\-]+)", result.output) self.assertTrue(find, "No version returned for searched recipe. bitbake output: %s" % result.output) @OETestID(1032) diff --git a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py index f234bac05..6a18eb836 100644 --- a/poky/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/poky/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -37,13 +37,13 @@ class ImageOptionsTests(OESelftestTestCase): p = bb_vars['SYSROOT_DESTDIR'] + bb_vars['bindir'] + "/" + "ccache" self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) self.write_config('INHERIT += "ccache"') - self.add_command_to_tearDown('bitbake -c clean m4') - bitbake("m4 -c clean") - bitbake("m4 -f -c compile") - log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile") + self.add_command_to_tearDown('bitbake -c clean m4-native') + bitbake("m4-native -c clean") + bitbake("m4-native -f -c compile") + log_compile = os.path.join(get_bb_var("WORKDIR","m4-native"), "temp/log.do_compile") with open(log_compile, "r") as f: loglines = "".join(f.readlines()) - self.assertIn("ccache", loglines, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile) + self.assertIn("ccache", loglines, msg="No match for ccache in m4-native log.do_compile. For further details: %s" % log_compile) @OETestID(1435) def test_read_only_image(self): @@ -187,6 +187,8 @@ class SourceMirroring(OESelftestTestCase): BB_ALLOWED_NETWORKS = "downloads.yoctoproject.org" MIRRORS = "" DL_DIR = "${TMPDIR}/test_downloads" +STAMPS_DIR = "${TMPDIR}/test_stamps" +SSTATE_DIR = "${TMPDIR}/test_sstate-cache" PREMIRRORS = "\\ bzr://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n \\ cvs://.*/.* http://downloads.yoctoproject.org/mirror/sources/ \\n \\ diff --git a/poky/meta/lib/oeqa/selftest/cases/devtool.py b/poky/meta/lib/oeqa/selftest/cases/devtool.py index 9eb9badf8..58f3e5846 100644 --- a/poky/meta/lib/oeqa/selftest/cases/devtool.py +++ b/poky/meta/lib/oeqa/selftest/cases/devtool.py @@ -1291,7 +1291,7 @@ class DevtoolExtractTests(DevtoolBase): installdir = bb_vars['D'] fakerootenv = bb_vars['FAKEROOTENV'] fakerootcmd = bb_vars['FAKEROOTCMD'] - result = runCmd('%s %s find . -type f -exec ls -l {} \;' % (fakerootenv, fakerootcmd), cwd=installdir) + result = runCmd('%s %s find . -type f -exec ls -l {} \\;' % (fakerootenv, fakerootcmd), cwd=installdir) filelist1 = self._process_ls_output(result.output) # Now look on the target diff --git a/poky/meta/lib/oeqa/selftest/cases/distrodata.py b/poky/meta/lib/oeqa/selftest/cases/distrodata.py index e7b5e3495..0b454714e 100644 --- a/poky/meta/lib/oeqa/selftest/cases/distrodata.py +++ b/poky/meta/lib/oeqa/selftest/cases/distrodata.py @@ -4,16 +4,9 @@ from oeqa.utils.decorators import testcase from oeqa.utils.ftools import write_file from oeqa.core.decorator.oeid import OETestID -class Distrodata(OESelftestTestCase): - - @classmethod - def setUpClass(cls): - super(Distrodata, cls).setUpClass() - feature = 'INHERIT += "distrodata"\n' - feature += 'LICENSE_FLAGS_WHITELIST += " commercial"\n' +import oe.recipeutils - cls.write_config(cls, feature) - bitbake('-c checkpkg world') +class Distrodata(OESelftestTestCase): @OETestID(1902) def test_checkpkg(self): @@ -23,9 +16,13 @@ class Distrodata(OESelftestTestCase): Product: oe-core Author: Alexander Kanavin """ - checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] - regressed_failures = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'UNKNOWN_BROKEN'] - regressed_successes = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] if pkg_data[11] == 'KNOWN_BROKEN'] + feature = 'LICENSE_FLAGS_WHITELIST += " commercial"\n' + self.write_config(feature) + + pkgs = oe.recipeutils.get_recipe_upgrade_status() + + regressed_failures = [pkg[0] for pkg in pkgs if pkg[1] == 'UNKNOWN_BROKEN'] + regressed_successes = [pkg[0] for pkg in pkgs if pkg[1] == 'KNOWN_BROKEN'] msg = "" if len(regressed_failures) > 0: msg = msg + """ @@ -55,45 +52,36 @@ but their recipes claim otherwise by setting UPSTREAM_VERSION_UNKNOWN. Please re return True return False - def is_in_oe_core(recipe, recipes): - self.assertTrue(recipe in recipes.keys(), "Recipe %s was not in 'bitbake-layers show-recipes' output" %(recipe)) - self.assertTrue(len(recipes[recipe]) > 0, "'bitbake-layers show-recipes' could not determine what layer(s) a recipe %s is in" %(recipe)) - try: - recipes[recipe].index('meta') - return True - except ValueError: - return False + feature = 'require conf/distro/include/maintainers.inc\n' + self.write_config(feature) - def get_recipe_layers(): - import re + with bb.tinfoil.Tinfoil() as tinfoil: + tinfoil.prepare(config_only=False) - recipes = {} - recipe_regex = re.compile('^(?P.*):$') - layer_regex = re.compile('^ (?P\S*) +') - output = runCmd('bitbake-layers show-recipes').output - for line in output.split('\n'): - recipe_name_obj = recipe_regex.search(line) - if recipe_name_obj: - recipe_name = recipe_name_obj.group('name') - recipes[recipe_name] = [] - recipe_layer_obj = layer_regex.search(line) - if recipe_layer_obj: - layer_name = recipe_layer_obj.group('name') - recipes[recipe_name].append(layer_name) - return recipes + with_maintainer_list = [] + no_maintainer_list = [] + # We could have used all_recipes() here, but this method will find + # every recipe if we ever move to setting RECIPE_MAINTAINER in recipe files + # instead of maintainers.inc + for fn in tinfoil.all_recipe_files(variants=False): + if not '/meta/recipes-' in fn: + # We are only interested in OE-Core + continue + rd = tinfoil.parse_recipe_file(fn, appends=False) + pn = rd.getVar('PN') + if is_exception(pn): + continue + if rd.getVar('RECIPE_MAINTAINER'): + with_maintainer_list.append((pn, fn)) + else: + no_maintainer_list.append((pn, fn)) - checkpkg_result = open(os.path.join(get_bb_var("LOG_DIR"), "checkpkg.csv")).readlines()[1:] - recipes_layers = get_recipe_layers() - no_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \ - if pkg_data[14] == '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])] - msg = """ -The following packages do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file. -""" + "\n".join(no_maintainer_list) - self.assertTrue(len(no_maintainer_list) == 0, msg) + if no_maintainer_list: + self.fail(""" +The following recipes do not have a maintainer assigned to them. Please add an entry to meta/conf/distro/include/maintainers.inc file. +""" + "\n".join(['%s (%s)' % i for i in no_maintainer_list])) - with_maintainer_list = [pkg_data[0] for pkg_data in [pkg_line.split('\t') for pkg_line in checkpkg_result] \ - if pkg_data[14] != '' and is_in_oe_core(pkg_data[0], recipes_layers) and not is_exception(pkg_data[0])] - msg = """ -The list of oe-core packages with maintainers is empty. This may indicate that the test has regressed and needs fixing. -""" - self.assertTrue(len(with_maintainer_list) > 0, msg) + if not with_maintainer_list: + self.fail(""" +The list of oe-core recipes with maintainers is empty. This may indicate that the test has regressed and needs fixing. +""") diff --git a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py index 8c95432e0..aed63e547 100644 --- a/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/poky/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -236,3 +236,29 @@ USERADD_GID_TABLES += "files/static-group" """ self.write_config(config) bitbake("core-image-base") + + def test_no_busybox_base_utils(self): + config = """ +# Enable x11 +DISTRO_FEATURES_append += "x11" + +# Switch to systemd +DISTRO_FEATURES += "systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" +VIRTUAL-RUNTIME_initscripts = "" +VIRTUAL-RUNTIME_syslog = "" +VIRTUAL-RUNTIME_login_manager = "shadow-base" +DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit" + +# Replace busybox +PREFERRED_PROVIDER_virtual/base-utils = "packagegroup-core-base-utils" +VIRTUAL-RUNTIME_base-utils = "packagegroup-core-base-utils" +VIRTUAL-RUNTIME_base-utils-hwclock = "util-linux-hwclock" +VIRTUAL-RUNTIME_base-utils-syslog = "" + +# Blacklist busybox +PNBLACKLIST[busybox] = "Don't build this" +""" + self.write_config(config) + + bitbake("--graphviz core-image-sato") diff --git a/poky/meta/lib/oeqa/selftest/cases/multiconfig.py b/poky/meta/lib/oeqa/selftest/cases/multiconfig.py new file mode 100644 index 000000000..3c36f6e5d --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/multiconfig.py @@ -0,0 +1,43 @@ +import os +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake +import oeqa.utils.ftools as ftools + +class MultiConfig(OESelftestTestCase): + + def test_multiconfig(self): + """ + Test that a simple multiconfig build works. This uses the mcextend class and the + multiconfig-image-packager test recipe to build a core-image-full-cmdline image which + contains a tiny core-image-minimal and a musl core-image-minimal, installed as packages. + """ + + config = """ +IMAGE_INSTALL_append_pn-core-image-full-cmdline = " multiconfig-image-packager-tiny multiconfig-image-packager-musl" +BBMULTICONFIG = "tiny musl" +""" + self.write_config(config) + + muslconfig = """ +MACHINE = "qemux86-64" +DISTRO = "poky" +TCLIBC = "musl" +TMPDIR = "${TOPDIR}/tmp-mc-musl" +""" + + tinyconfig = """ +MACHINE = "qemux86" +DISTRO = "poky-tiny" +TMPDIR = "${TOPDIR}/tmp-mc-tiny" +""" + + multiconfigdir = self.builddir + "/conf/multiconfig" + os.makedirs(multiconfigdir, exist_ok=True) + self.track_for_cleanup(multiconfigdir + "/musl.conf") + ftools.write_file(multiconfigdir + "/musl.conf", muslconfig) + self.track_for_cleanup(multiconfigdir + "/tiny.conf") + ftools.write_file(multiconfigdir + "/tiny.conf", tinyconfig) + + # Build a core-image-minimal + bitbake('core-image-full-cmdline') + diff --git a/poky/meta/lib/oeqa/selftest/cases/package.py b/poky/meta/lib/oeqa/selftest/cases/package.py index 0a88dc25b..6596dabc3 100644 --- a/poky/meta/lib/oeqa/selftest/cases/package.py +++ b/poky/meta/lib/oeqa/selftest/cases/package.py @@ -137,7 +137,7 @@ class PackageTests(OESelftestTestCase): elif "Breakpoint 1, main () at hello.c:4" in l: return True - self.logger.error("GDB result:\n%s: %s" % output) + self.logger.error("GDB result:\n%d: %s", status, output) return False with runqemu('core-image-minimal') as qemu: diff --git a/poky/meta/lib/oeqa/selftest/cases/pkgdata.py b/poky/meta/lib/oeqa/selftest/cases/pkgdata.py index 0b4caf1b2..aa05f40d6 100644 --- a/poky/meta/lib/oeqa/selftest/cases/pkgdata.py +++ b/poky/meta/lib/oeqa/selftest/cases/pkgdata.py @@ -13,6 +13,7 @@ class OePkgdataUtilTests(OESelftestTestCase): super(OePkgdataUtilTests, cls).setUpClass() # Ensure we have the right data in pkgdata cls.logger.info('Running bitbake to generate pkgdata') + bitbake('target-sdk-provides-dummy -c clean') bitbake('busybox zlib m4') @OETestID(1203) @@ -82,7 +83,7 @@ class OePkgdataUtilTests(OESelftestTestCase): pkglist.remove('zlib-ptest') # in case ptest is disabled except ValueError: pass - self.assertEqual(pkglist, ['zlib', 'zlib-dbg', 'zlib-dev', 'zlib-doc', 'zlib-staticdev'], "Packages listed after remove: %s" % result.output) + self.assertEqual(pkglist, ['zlib', 'zlib-dbg', 'zlib-dev', 'zlib-doc', 'zlib-src', 'zlib-staticdev'], "Packages listed after remove: %s" % result.output) # With recipe specified, runtime result = runCmd('oe-pkgdata-util list-pkgs -p zlib -r') pkglist = sorted(result.output.split()) @@ -90,7 +91,7 @@ class OePkgdataUtilTests(OESelftestTestCase): pkglist.remove('libz-ptest') # in case ptest is disabled except ValueError: pass - self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc', 'libz-staticdev', 'libz1'], "Packages listed after remove: %s" % result.output) + self.assertEqual(pkglist, ['libz-dbg', 'libz-dev', 'libz-doc', 'libz-src', 'libz-staticdev', 'libz1'], "Packages listed after remove: %s" % result.output) # With recipe specified and unpackaged result = runCmd('oe-pkgdata-util list-pkgs -p zlib -u') pkglist = sorted(result.output.split()) diff --git a/poky/meta/lib/oeqa/selftest/cases/prservice.py b/poky/meta/lib/oeqa/selftest/cases/prservice.py index 479e52061..796ad4f5f 100644 --- a/poky/meta/lib/oeqa/selftest/cases/prservice.py +++ b/poky/meta/lib/oeqa/selftest/cases/prservice.py @@ -19,7 +19,7 @@ class BitbakePrTests(OESelftestTestCase): def get_pr_version(self, package_name): package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name) package_data = ftools.read_file(package_data_file) - find_pr = re.search("PKGR: r[0-9]+\.([0-9]+)", package_data) + find_pr = re.search(r"PKGR: r[0-9]+\.([0-9]+)", package_data) self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file) return int(find_pr.group(1)) @@ -29,7 +29,7 @@ class BitbakePrTests(OESelftestTestCase): package_stamps_path = "/".join(stampdata[:-1]) stamps = [] for stamp in os.listdir(package_stamps_path): - find_stamp = re.match("%s\.%s\.([a-z0-9]{32})" % (re.escape(prefix), recipe_task), stamp) + find_stamp = re.match(r"%s\.%s\.([a-z0-9]{32})" % (re.escape(prefix), recipe_task), stamp) if find_stamp: stamps.append(find_stamp.group(1)) self.assertFalse(len(stamps) == 0, msg="Cound not find stamp for task %s for recipe %s" % (recipe_task, package_name)) diff --git a/poky/meta/lib/oeqa/selftest/cases/recipeutils.py b/poky/meta/lib/oeqa/selftest/cases/recipeutils.py new file mode 100644 index 000000000..dd2f55839 --- /dev/null +++ b/poky/meta/lib/oeqa/selftest/cases/recipeutils.py @@ -0,0 +1,137 @@ +import os +import re +import time +import logging +import bb.tinfoil + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import runCmd, get_test_layer +from oeqa.core.decorator.oeid import OETestID + + +def setUpModule(): + global tinfoil + global metaselftestpath + metaselftestpath = get_test_layer() + tinfoil = bb.tinfoil.Tinfoil(tracking=True) + tinfoil.prepare(config_only=False, quiet=2) + + +def tearDownModule(): + tinfoil.shutdown() + + +class RecipeUtilsTests(OESelftestTestCase): + """ Tests for the recipeutils module functions """ + + def test_patch_recipe_varflag(self): + import oe.recipeutils + rd = tinfoil.parse_recipe('python3-async-test') + vals = {'SRC_URI[md5sum]': 'aaaaaa', 'LICENSE': 'something'} + patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath) + + expected_patch = """ +--- a/recipes-devtools/python/python-async-test.inc ++++ b/recipes-devtools/python/python-async-test.inc +@@ -1,14 +1,14 @@ + SUMMARY = "Python framework to process interdependent tasks in a pool of workers" + HOMEPAGE = "http://github.com/gitpython-developers/async" + SECTION = "devel/python" +-LICENSE = "BSD" ++LICENSE = "something" + LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=88df8e78b9edfd744953862179f2d14e" + + inherit pypi + + PYPI_PACKAGE = "async" + +-SRC_URI[md5sum] = "9b06b5997de2154f3bc0273f80bcef6b" ++SRC_URI[md5sum] = "aaaaaa" + SRC_URI[sha256sum] = "ac6894d876e45878faae493b0cf61d0e28ec417334448ac0a6ea2229d8343051" + + RDEPENDS_${PN} += "${PYTHON_PN}-threading" +""" + patchlines = [] + for f in patches: + for line in f: + patchlines.append(line) + self.maxDiff = None + self.assertEqual(''.join(patchlines).strip(), expected_patch.strip()) + + + def test_patch_recipe_singleappend(self): + import oe.recipeutils + rd = tinfoil.parse_recipe('recipeutils-test') + val = rd.getVar('SRC_URI', False).split() + del val[1] + val = ' '.join(val) + vals = {'SRC_URI': val} + patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath) + + expected_patch = """ +--- a/recipes-test/recipeutils/recipeutils-test_1.2.bb ++++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb +@@ -8,6 +8,4 @@ + + BBCLASSEXTEND = "native nativesdk" + +-SRC_URI += "file://somefile" +- + SRC_URI_append = " file://anotherfile" +""" + patchlines = [] + for f in patches: + for line in f: + patchlines.append(line) + self.assertEqual(''.join(patchlines).strip(), expected_patch.strip()) + + + def test_patch_recipe_appends(self): + import oe.recipeutils + rd = tinfoil.parse_recipe('recipeutils-test') + val = rd.getVar('SRC_URI', False).split() + vals = {'SRC_URI': val[0]} + patches = oe.recipeutils.patch_recipe(rd, rd.getVar('FILE'), vals, patch=True, relpath=metaselftestpath) + + expected_patch = """ +--- a/recipes-test/recipeutils/recipeutils-test_1.2.bb ++++ b/recipes-test/recipeutils/recipeutils-test_1.2.bb +@@ -8,6 +8,3 @@ + + BBCLASSEXTEND = "native nativesdk" + +-SRC_URI += "file://somefile" +- +-SRC_URI_append = " file://anotherfile" +""" + patchlines = [] + for f in patches: + for line in f: + patchlines.append(line) + self.assertEqual(''.join(patchlines).strip(), expected_patch.strip()) + + + def test_validate_pn(self): + import oe.recipeutils + expected_results = { + 'test': '', + 'glib-2.0': '', + 'gtk+': '', + 'forcevariable': 'reserved', + 'pn-something': 'reserved', + 'test.bb': 'file', + 'test_one': 'character', + 'test!': 'character', + } + + for pn, expected in expected_results.items(): + result = oe.recipeutils.validate_pn(pn) + if expected: + self.assertIn(expected, result) + else: + self.assertEqual(result, '') + + def test_split_var_value(self): + import oe.recipeutils + res = oe.recipeutils.split_var_value('test.1 test.2 ${@call_function("hi there world", false)} test.4') + self.assertEqual(res, ['test.1', 'test.2', '${@call_function("hi there world", false)}', 'test.4']) diff --git a/poky/meta/lib/oeqa/selftest/cases/runcmd.py b/poky/meta/lib/oeqa/selftest/cases/runcmd.py index d76d7063c..a1615cfd2 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runcmd.py +++ b/poky/meta/lib/oeqa/selftest/cases/runcmd.py @@ -24,8 +24,8 @@ class RunCmdTests(OESelftestTestCase): # The delta is intentionally smaller than the timeout, to detect cases where # we incorrectly apply the timeout more than once. - TIMEOUT = 2 - DELTA = 1 + TIMEOUT = 5 + DELTA = 3 @OETestID(1916) def test_result_okay(self): diff --git a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py index 906e460d4..6c25bb901 100644 --- a/poky/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/poky/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -6,6 +6,7 @@ import os import re import tempfile import shutil +import oe.lsb class TestExport(OESelftestTestCase): @@ -168,6 +169,71 @@ class TestImage(OESelftestTestCase): # remove the oeqa-feed-sign temporal directory shutil.rmtree(self.gpg_home, ignore_errors=True) + @OETestID(1883) + def test_testimage_virgl_gtk(self): + """ + Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend + Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled + 2. Check that kmscube demo runs without crashing. + Product: oe-core + Author: Alexander Kanavin + """ + if "DISPLAY" not in os.environ: + self.skipTest("virgl gtk test must be run inside a X session") + distro = oe.lsb.distro_identifier() + if distro and distro == 'debian-8': + self.skipTest('virgl isn\'t working with Debian 8') + + qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') + features = 'INHERIT += "testimage"\n' + if 'gtk+' not in qemu_packageconfig: + features += 'PACKAGECONFIG_append_pn-qemu-system-native = " gtk+"\n' + if 'virglrenderer' not in qemu_packageconfig: + features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' + if 'glx' not in qemu_packageconfig: + features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' + features += 'TEST_SUITES = "ping ssh virgl"\n' + features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' + features += 'IMAGE_INSTALL_append = " kmscube"\n' + features += 'TEST_RUNQEMUPARAMS = "gtk-gl"\n' + self.write_config(features) + bitbake('core-image-minimal') + bitbake('-c testimage core-image-minimal') + + @OETestID(1883) + def test_testimage_virgl_headless(self): + """ + Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend + Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled + 2. Check that kmscube demo runs without crashing. + Product: oe-core + Author: Alexander Kanavin + """ + import subprocess, os + try: + content = os.listdir("/dev/dri") + if len([i for i in content if i.startswith('render')]) == 0: + self.skipTest("No render nodes found in /dev/dri: %s" %(content)) + except FileNotFoundError: + self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.") + try: + dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) + except subprocess.CalledProcessError as e: + self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.") + qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') + features = 'INHERIT += "testimage"\n' + if 'virglrenderer' not in qemu_packageconfig: + features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' + if 'glx' not in qemu_packageconfig: + features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' + features += 'TEST_SUITES = "ping ssh virgl"\n' + features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' + features += 'IMAGE_INSTALL_append = " kmscube"\n' + features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n' + self.write_config(features) + bitbake('core-image-minimal') + bitbake('-c testimage core-image-minimal') + class Postinst(OESelftestTestCase): @OETestID(1540) @OETestID(1545) diff --git a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py index 077d6e537..938e654e9 100644 --- a/poky/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/poky/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -96,14 +96,14 @@ class SStateTests(SStateBase): bitbake(['-ccleansstate'] + targets) bitbake(targets) - tgz_created = self.search_sstate('|'.join(map(str, [s + '.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) + tgz_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) self.assertTrue(tgz_created, msg="Could not find sstate .tgz files for: %s (%s)" % (', '.join(map(str, targets)), str(tgz_created))) - siginfo_created = self.search_sstate('|'.join(map(str, [s + '.*?\.siginfo$' for s in targets])), distro_specific, distro_nonspecific) + siginfo_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.siginfo$' for s in targets])), distro_specific, distro_nonspecific) self.assertTrue(siginfo_created, msg="Could not find sstate .siginfo files for: %s (%s)" % (', '.join(map(str, targets)), str(siginfo_created))) bitbake(['-ccleansstate'] + targets) - tgz_removed = self.search_sstate('|'.join(map(str, [s + '.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) + tgz_removed = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) self.assertTrue(not tgz_removed, msg="do_cleansstate didn't remove .tgz sstate files for: %s (%s)" % (', '.join(map(str, targets)), str(tgz_removed))) @OETestID(977) @@ -130,14 +130,14 @@ class SStateTests(SStateBase): bitbake(['-ccleansstate'] + targets) bitbake(targets) - results = self.search_sstate('|'.join(map(str, [s + '.*?\.tgz$' for s in targets])), distro_specific=False, distro_nonspecific=True) + results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=False, distro_nonspecific=True) filtered_results = [] for r in results: if r.endswith(("_populate_lic.tgz", "_populate_lic.tgz.siginfo")): continue filtered_results.append(r) self.assertTrue(filtered_results == [], msg="Found distro non-specific sstate for: %s (%s)" % (', '.join(map(str, targets)), str(filtered_results))) - file_tracker_1 = self.search_sstate('|'.join(map(str, [s + '.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) + file_tracker_1 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) self.assertTrue(len(file_tracker_1) >= len(targets), msg = "Not all sstate files ware created for: %s" % ', '.join(map(str, targets))) self.track_for_cleanup(self.distro_specific_sstate + "_old") @@ -146,7 +146,7 @@ class SStateTests(SStateBase): bitbake(['-cclean'] + targets) bitbake(targets) - file_tracker_2 = self.search_sstate('|'.join(map(str, [s + '.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) + file_tracker_2 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) self.assertTrue(len(file_tracker_2) >= len(targets), msg = "Not all sstate files ware created for: %s" % ', '.join(map(str, targets))) not_recreated = [x for x in file_tracker_1 if x not in file_tracker_2] @@ -192,18 +192,18 @@ class SStateTests(SStateBase): if not sstate_arch in sstate_archs_list: sstate_archs_list.append(sstate_arch) if target_config[idx] == target_config[-1]: - target_sstate_before_build = self.search_sstate(target + '.*?\.tgz$') + target_sstate_before_build = self.search_sstate(target + r'.*?\.tgz$') bitbake("-cclean %s" % target) result = bitbake(target, ignore_status=True) if target_config[idx] == target_config[-1]: - target_sstate_after_build = self.search_sstate(target + '.*?\.tgz$') + target_sstate_after_build = self.search_sstate(target + r'.*?\.tgz$') expected_remaining_sstate += [x for x in target_sstate_after_build if x not in target_sstate_before_build if not any(pattern in x for pattern in ignore_patterns)] self.remove_config(global_config[idx]) self.remove_recipeinc(target, target_config[idx]) self.assertEqual(result.status, 0, msg = "build of %s failed with %s" % (target, result.output)) runCmd("sstate-cache-management.sh -y --cache-dir=%s --remove-duplicated --extra-archs=%s" % (self.sstate_path, ','.join(map(str, sstate_archs_list)))) - actual_remaining_sstate = [x for x in self.search_sstate(target + '.*?\.tgz$') if not any(pattern in x for pattern in ignore_patterns)] + actual_remaining_sstate = [x for x in self.search_sstate(target + r'.*?\.tgz$') if not any(pattern in x for pattern in ignore_patterns)] actual_not_expected = [x for x in actual_remaining_sstate if x not in expected_remaining_sstate] self.assertFalse(actual_not_expected, msg="Files should have been removed but ware not: %s" % ', '.join(map(str, actual_not_expected))) diff --git a/poky/meta/lib/oeqa/selftest/context.py b/poky/meta/lib/oeqa/selftest/context.py index c52129032..c56e53dcd 100644 --- a/poky/meta/lib/oeqa/selftest/context.py +++ b/poky/meta/lib/oeqa/selftest/context.py @@ -108,6 +108,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): logdir = os.environ.get("BUILDDIR") if 'LOG_DIR' in bbvars: logdir = bbvars['LOG_DIR'] + bb.utils.mkdirhier(logdir) args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time) super(OESelftestTestContextExecutor, self)._process_args(logger, args) -- cgit v1.2.3