Improvements to oe-selftest
cover Improvements to oe-selftest
From: Mariano Lopez <[email protected]>
This series includes to main improvements;
- Remove use of cleansstate tasks from tests in order to use shared states in the autobuilders
- Optimize use of get_bb_var to avoid calling bitbake -e over and over again
This has been tested in local autobuilders.
This series requires:
- https://patchwork.openembedded.org/series/5191/
This series supersedes:
- https://patchwork.openembedded.org/series/5101/
- https://patchwork.openembedded.org/series/5122/
The following changes since commit 634e6f703ea1d7fa3c1ae668b0c9ae90a7ffc0b7:
insane.bbclass: Add prepare_recipe_sysroot dependency for package_qa (2017-02-09 08:00:53 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib mariano/bug10929
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/bug10929
Mariano Lopez (2):
selftest: Avoid sstate corruption by calling cleansstate
selftest: Optimize get_bb_var use
meta/lib/oeqa/selftest/archiver.py | 7 +-- meta/lib/oeqa/selftest/bbtests.py | 30 ++++++----- meta/lib/oeqa/selftest/buildhistory.py | 5 +- meta/lib/oeqa/selftest/buildoptions.py | 28 +++++----- meta/lib/oeqa/selftest/devtool.py | 75 +++++++++++++++++--------- meta/lib/oeqa/selftest/eSDK.py | 21 ++++---- meta/lib/oeqa/selftest/liboe.py | 21 ++++---- meta/lib/oeqa/selftest/manifest.py | 7 +-- meta/lib/oeqa/selftest/oescripts.py | 8 +-- meta/lib/oeqa/selftest/pkgdata.py | 11 ++-- meta/lib/oeqa/selftest/prservice.py | 12 ++--- meta/lib/oeqa/selftest/recipetool.py | 39 +++++++------- meta/lib/oeqa/selftest/runtime-test.py | 15 ++++-- meta/lib/oeqa/selftest/signing.py | 20 +++---- meta/lib/oeqa/selftest/sstate.py | 20 ++++--- meta/lib/oeqa/selftest/sstatetests.py | 98 ++++++++++++++-------------------- meta/lib/oeqa/selftest/tinfoil.py | 2 +- meta/lib/oeqa/selftest/wic.py | 39 +++++++------- 18 files changed, 242 insertions(+), 216 deletions(-)
Signature · 1 line
2.6.6
PATCH 1/2 selftest: Avoid sstate corruption by calling cleansstate
From: Mariano Lopez <[email protected]>
Currently selftest doesn't use sstates because some tests clean sstate cache; using sstates would give a performance boost instead of building everything from scratch.
With this sstates are not corrupted using different methods depending on tests:
devtool: These tests needed to delete the cache so SSTATE_DIR as SSTATE_MIRRORS and set a temporal SSTATE_DIR.
sstatetests: This module already used a temporal SSTATE_DIR, so just set up the SSTATE_MIRRORS.
Rest: Removed cleansstate, some of them required to force a certain task, others were just removed or changed for another task.
[YOCTO #10929]
--- meta/lib/oeqa/selftest/bbtests.py | 6 ++---- meta/lib/oeqa/selftest/buildoptions.py | 18 ++++++------------ meta/lib/oeqa/selftest/devtool.py | 18 +++++++++++++++++- meta/lib/oeqa/selftest/oescripts.py | 8 ++------ meta/lib/oeqa/selftest/prservice.py | 3 --- meta/lib/oeqa/selftest/recipetool.py | 5 ----- meta/lib/oeqa/selftest/signing.py | 8 ++++---- meta/lib/oeqa/selftest/sstatetests.py | 6 +++--- 8 files changed, 34 insertions(+), 38 deletions(-)
meta/lib/oeqa/selftest/bbtests.py +2 -4
@@ -37,7 +37,6 @@ class BitbakeTests(oeSelfTest): @testcase(103) def test_local_sstate(self): - bitbake('m4-native -ccleansstate') bitbake('m4-native') bitbake('m4-native -cclean') result = bitbake('m4-native')
@@ -83,8 +82,8 @@ class BitbakeTests(oeSelfTest): pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) man_dir = get_bb_var('mandir', test_recipe) - bitbake('-c cleansstate %s' % test_recipe) - bitbake(test_recipe) + bitbake('-c clean %s' % test_recipe) + bitbake('-c package -f %s' % test_recipe) self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3')
@@ -103,7 +102,6 @@ class BitbakeTests(oeSelfTest): # test 2 from bug 5875 test_recipe = 'zlib' - bitbake('-c cleansstate %s' % test_recipe) bitbake(test_recipe) self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe)
meta/lib/oeqa/selftest/buildoptions.py +6 -12
@@ -36,9 +36,7 @@ class ImageOptionsTests(oeSelfTest): p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache" self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p) self.write_config('INHERIT += "ccache"') - bitbake("m4 -c cleansstate") - bitbake("m4 -c compile") - self.addCleanup(bitbake, 'ccache-native -ccleansstate') + bitbake("m4 -f -c compile") res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile"))
@@ -75,14 +73,13 @@ class SanityOptionsTest(oeSelfTest): @testcase(927) def test_options_warnqa_errorqa_switch(self): - bitbake("xcursor-transparent-theme -ccleansstate") self.write_config("INHERIT_remove = \"report-error\"") if "packages-list" not in get_bb_var("ERROR_QA"): self.append_config("ERROR_QA_append = \" packages-list\"") self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') - res = bitbake("xcursor-transparent-theme", ignore_status=True) + res = bitbake("xcursor-transparent-theme -f -c package", ignore_status=True) self.delete_recipeinc('xcursor-transparent-theme') line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
@@ -90,8 +87,7 @@ class SanityOptionsTest(oeSelfTest): self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') self.append_config('ERROR_QA_remove = "packages-list"') self.append_config('WARN_QA_append = " packages-list"') - bitbake("xcursor-transparent-theme -ccleansstate") - res = bitbake("xcursor-transparent-theme") + res = bitbake("xcursor-transparent-theme -f -c package") self.delete_recipeinc('xcursor-transparent-theme') line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
@@ -100,8 +96,7 @@ class SanityOptionsTest(oeSelfTest): def test_sanity_unsafe_script_references(self): self.write_config('WARN_QA_append = " unsafe-references-in-scripts"') - bitbake("-ccleansstate gzip") - res = bitbake("gzip") + res = bitbake("gzip -f -c package_qa") line = self.getline(res, "QA Issue: gzip") self.assertFalse(line, "WARNING: QA Issue: gzip message is present in bitbake's output and shouldn't be: %s" % res.output)
@@ -110,7 +105,7 @@ do_install_append_pn-gzip () { echo "\n${bindir}/test" >> ${D}${bindir}/zcat } """) - res = bitbake("gzip") + res = bitbake("gzip -f -c package_qa") line = self.getline(res, "QA Issue: gzip") self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output)
@@ -118,7 +113,6 @@ do_install_append_pn-gzip () { def test_sanity_unsafe_binary_references(self): self.write_config('WARN_QA_append = " unsafe-references-in-binaries"') - bitbake("-ccleansstate nfs-utils") #res = bitbake("nfs-utils") # FIXME when nfs-utils passes this test #line = self.getline(res, "QA Issue: nfs-utils")
@@ -129,7 +123,7 @@ do_install_append_pn-gzip () { # echo "\n${bindir}/test" >> ${D}${base_sbindir}/osd_login #} #""") - res = bitbake("nfs-utils") + res = bitbake("nfs-utils -f -c package_qa") line = self.getline(res, "QA Issue: nfs-utils") self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output)
meta/lib/oeqa/selftest/devtool.py +17 -1
@@ -9,7 +9,8 @@ import fnmatch import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer, runqemu, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer +from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer from oeqa.utils.decorators import testcase class DevtoolBase(oeSelfTest):
@@ -117,6 +118,20 @@ class DevtoolBase(oeSelfTest): class DevtoolTests(DevtoolBase): + @classmethod + def setUpClass(cls): + bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR']) + cls.original_sstate = bb_vars['SSTATE_DIR'] + cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool') + cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate + cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' + % cls.original_sstate) + + @classmethod + def tearDownClass(cls): + cls.log.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate) + runCmd('rm -rf %s' % cls.devtool_sstate) + def setUp(self): """Test case setup function""" super(DevtoolTests, self).setUp()
@@ -124,6 +139,7 @@ class DevtoolTests(DevtoolBase): self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory ' 'under the build directory') + self.append_config(self.sstate_conf) def _check_src_repo(self, repo_dir): """Check srctree git repository"""
meta/lib/oeqa/selftest/oescripts.py +2 -6
@@ -17,12 +17,8 @@ class TestScripts(oeSelfTest): path = os.path.dirname(get_bb_var('WORKDIR', 'gzip')) old_version_recipe = os.path.join(get_bb_var('COREBASE'), 'meta/recipes-extended/gzip/gzip_1.3.12.bb') old_version = '1.3.12' - bitbake("-ccleansstate gzip") - bitbake("-ccleansstate -b %s" % old_version_recipe) - if os.path.exists(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)): - shutil.rmtree(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)) - if os.path.exists(get_bb_var('WORKDIR', 'gzip')): - shutil.rmtree(get_bb_var('WORKDIR', 'gzip')) + bitbake("-c clean gzip") + bitbake("-c clean -b %s" % old_version_recipe) if os.path.exists(path): initial_contents = os.listdir(path)
meta/lib/oeqa/selftest/prservice.py +0 -3
@@ -37,7 +37,6 @@ class BitbakePrTests(oeSelfTest): def increment_package_pr(self, package_name): inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\"\n}" % datetime.datetime.now() self.write_recipeinc(package_name, inc_data) - bitbake("-ccleansstate %s" % package_name) res = bitbake(package_name, ignore_status=True) self.delete_recipeinc(package_name) self.assertEqual(res.status, 0, msg=res.output)
@@ -60,7 +59,6 @@ class BitbakePrTests(oeSelfTest): pr_2 = self.get_pr_version(package_name) stamp_2 = self.get_task_stamp(package_name, track_task) - bitbake("-ccleansstate %s" % package_name) self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") self.assertTrue(stamp_1 != stamp_2, "Different pkg rev. but same stamp: %s" % stamp_1)
@@ -86,7 +84,6 @@ class BitbakePrTests(oeSelfTest): self.increment_package_pr(package_name) pr_2 = self.get_pr_version(package_name) - bitbake("-ccleansstate %s" % package_name) self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") @testcase(930)
meta/lib/oeqa/selftest/recipetool.py +0 -5
@@ -72,11 +72,6 @@ class RecipetoolTests(RecipetoolBase): logger.info('Running bitbake to generate pkgdata') bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') - @classmethod - def tearDownClass(cls): - # Shouldn't leave any traces of this artificial recipe behind - bitbake('-c cleansstate selftest-recipetool-appendfile') - def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles): cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options) return self._try_recipetool_appendcmd(cmd, testrecipe, expectedfiles, expectedlines)
meta/lib/oeqa/selftest/signing.py +4 -4
@@ -54,8 +54,9 @@ class Signing(oeSelfTest): self.write_config(feature) - bitbake('-c cleansstate %s' % test_recipe) - bitbake(test_recipe) + bitbake('-c clean %s' % test_recipe) + bitbake('-f -c package_write_rpm %s' % test_recipe) + self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe)
@@ -98,7 +99,6 @@ class Signing(oeSelfTest): sstatedir = os.path.join(builddir, 'test-sstate') self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) - self.add_command_to_tearDown('bitbake -c cleansstate %s' % test_recipe) self.add_command_to_tearDown('rm -rf %s' % sstatedir) # Determine the pub key signature
@@ -115,7 +115,7 @@ class Signing(oeSelfTest): self.write_config(feature) - bitbake('-c cleansstate %s' % test_recipe) + bitbake('-c clean %s' % test_recipe) bitbake(test_recipe) recipe_sig = glob.glob(sstatedir + '/*/*:ed:*_package.tgz.sig')
meta/lib/oeqa/selftest/sstatetests.py +3 -3
@@ -16,7 +16,7 @@ class SStateTests(SStateBase): # Test sstate files creation and their location def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) if self.temp_sstate_location: bitbake(['-cclean'] + targets)
@@ -63,7 +63,7 @@ class SStateTests(SStateBase): # Test the sstate files deletion part of the do_cleansstate task def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) bitbake(['-ccleansstate'] + targets)
@@ -105,7 +105,7 @@ class SStateTests(SStateBase): # Test rebuilding of distro-specific sstate files def run_test_rebuild_distro_specific_sstate(self, targets, temp_sstate_location=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) bitbake(['-ccleansstate'] + targets)
Signature · 1 line
2.6.6
PATCH 2/2 selftest: Optimize get_bb_var use
In reply to [email protected]From: Mariano Lopez <[email protected]>
get_bb_var calls bitbake every time it is used and every call would take about 7 seconds. There are tests that calls get_bb_var several times when they can use get_bb_vars. Also there are tests that calls it to fetch the same variable over and over again.
This will optimize the use of get_bb_var and get_bb_vars for a little speed up in the tests.
[YOCTO #11037]
--- meta/lib/oeqa/selftest/archiver.py | 7 +-- meta/lib/oeqa/selftest/bbtests.py | 24 +++++---- meta/lib/oeqa/selftest/buildhistory.py | 5 +- meta/lib/oeqa/selftest/buildoptions.py | 10 ++-- meta/lib/oeqa/selftest/devtool.py | 57 ++++++++++++--------- meta/lib/oeqa/selftest/eSDK.py | 21 ++++---- meta/lib/oeqa/selftest/liboe.py | 21 ++++---- meta/lib/oeqa/selftest/manifest.py | 7 +-- meta/lib/oeqa/selftest/pkgdata.py | 11 ++-- meta/lib/oeqa/selftest/prservice.py | 9 ++-- meta/lib/oeqa/selftest/recipetool.py | 34 +++++++------ meta/lib/oeqa/selftest/runtime-test.py | 15 ++++-- meta/lib/oeqa/selftest/signing.py | 12 +++-- meta/lib/oeqa/selftest/sstate.py | 20 +++++--- meta/lib/oeqa/selftest/sstatetests.py | 92 ++++++++++++++-------------------- meta/lib/oeqa/selftest/tinfoil.py | 2 +- meta/lib/oeqa/selftest/wic.py | 39 +++++++------- 17 files changed, 208 insertions(+), 178 deletions(-)
meta/lib/oeqa/selftest/archiver.py +4 -3
@@ -1,5 +1,5 @@ from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import bitbake, get_bb_var +from oeqa.utils.commands import bitbake, get_bb_vars from oeqa.utils.decorators import testcase import glob import os
@@ -28,10 +28,11 @@ class Archiver(oeSelfTest): features += 'COPYLEFT_PN_EXCLUDE = "%s"\n' % exclude_recipe self.write_config(features) - shutil.rmtree(get_bb_var('TMPDIR')) + bitbake('-c clean %s %s' % (include_recipe, exclude_recipe)) bitbake("%s %s" % (include_recipe, exclude_recipe)) - src_path = os.path.join(get_bb_var('DEPLOY_DIR_SRC'), get_bb_var('TARGET_SYS')) + bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS']) + src_path = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) # Check that include_recipe was included included_present = len(glob.glob(src_path + '/%s-*' % include_recipe))
meta/lib/oeqa/selftest/bbtests.py +14 -10
@@ -3,7 +3,7 @@ import re import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.utils.decorators import testcase class BitbakeTests(oeSelfTest):
@@ -78,9 +78,10 @@ class BitbakeTests(oeSelfTest): # test 1 from bug 5875 test_recipe = 'zlib' test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" - image_dir = get_bb_var('D', test_recipe) - pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) - man_dir = get_bb_var('mandir', test_recipe) + bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe) + image_dir = bb_vars['D'] + pkgsplit_dir = bb_vars['PKGDEST'] + man_dir = bb_vars['mandir'] bitbake('-c clean %s' % test_recipe) bitbake('-c package -f %s' % test_recipe)
@@ -121,8 +122,9 @@ class BitbakeTests(oeSelfTest): @testcase(899) def test_image_manifest(self): bitbake('core-image-minimal') - deploydir = get_bb_var("DEPLOY_DIR_IMAGE", target="core-image-minimal") - imagename = get_bb_var("IMAGE_LINK_NAME", target="core-image-minimal") + bb_vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "IMAGE_LINK_NAME"], "core-image-minimal") + deploydir = bb_vars["DEPLOY_DIR_IMAGE"] + imagename = bb_vars["IMAGE_LINK_NAME"] manifest = os.path.join(deploydir, imagename + ".manifest") self.assertTrue(os.path.islink(manifest), msg="No manifest file created for image. It should have been created in %s" % manifest)
@@ -160,8 +162,9 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" result = bitbake('-c fetch aspell', ignore_status=True) self.delete_recipeinc('aspell') self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) - self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % str(get_bb_var("DL_DIR"))) - self.assertTrue(os.path.isfile(os.path.join(get_bb_var("DL_DIR"), 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % str(get_bb_var("DL_DIR"))) + dl_dir = get_bb_var("DL_DIR") + self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz')), msg = "File rename failed. No corresponding test-aspell.tar.gz file found under %s" % dl_dir) + self.assertTrue(os.path.isfile(os.path.join(dl_dir, 'test-aspell.tar.gz.done')), "File rename failed. No corresponding test-aspell.tar.gz.done file found under %s" % dl_dir) @testcase(1028) def test_environment(self):
@@ -253,8 +256,9 @@ INHERIT_remove = \"report-error\" def test_bbappend_order(self): """ Bitbake should bbappend to recipe in a predictable order """ test_recipe = 'ed' - test_recipe_summary_before = get_bb_var('SUMMARY', test_recipe) - test_recipe_pv = get_bb_var('PV', test_recipe) + bb_vars = get_bb_vars(['SUMMARY', 'PV'], test_recipe) + test_recipe_summary_before = bb_vars['SUMMARY'] + test_recipe_pv = bb_vars['PV'] recipe_append_file = test_recipe + '_' + test_recipe_pv + '.bbappend' expected_recipe_summary = test_recipe_summary_before
meta/lib/oeqa/selftest/buildhistory.py +3 -2
@@ -3,14 +3,15 @@ import re import datetime from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import bitbake, get_bb_var +from oeqa.utils.commands import bitbake, get_bb_vars from oeqa.utils.decorators import testcase class BuildhistoryBase(oeSelfTest): def config_buildhistory(self, tmp_bh_location=False): - if (not 'buildhistory' in get_bb_var('USER_CLASSES')) and (not 'buildhistory' in get_bb_var('INHERIT')): + bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT']) + if (not 'buildhistory' in bb_vars['USER_CLASSES']) and (not 'buildhistory' in bb_vars['INHERIT']): add_buildhistory_config = 'INHERIT += "buildhistory"\nBUILDHISTORY_COMMIT = "1"' self.append_config(add_buildhistory_config)
meta/lib/oeqa/selftest/buildoptions.py +6 -4
@@ -5,7 +5,7 @@ import shutil import tempfile from oeqa.selftest.base import oeSelfTest from oeqa.selftest.buildhistory import BuildhistoryBase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars import oeqa.utils.ftools as ftools from oeqa.utils.decorators import testcase
@@ -33,12 +33,14 @@ class ImageOptionsTests(oeSelfTest): @testcase(286) def test_ccache_tool(self): bitbake("ccache-native") - p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache" + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native') + 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"') bitbake("m4 -f -c compile") - res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) - self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")) + log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile") + res = runCmd("grep ccache %s" % log_compile, ignore_status=True) + self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % log_compile) @testcase(1435) def test_read_only_image(self):
meta/lib/oeqa/selftest/devtool.py +34 -23
128 lines not on this page · raw message
meta/lib/oeqa/selftest/eSDK.py +10 -11
@@ -6,9 +6,9 @@ import glob import logging import subprocess import oeqa.utils.ftools as ftools -from oeqa.utils.decorators import testcase +from oeqa.utils.decorators import testcase from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.utils.httpserver import HTTPService class oeSDKExtSelfTest(oeSelfTest):
@@ -24,7 +24,7 @@ class oeSDKExtSelfTest(oeSelfTest): # 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:
@@ -47,10 +47,11 @@ class oeSDKExtSelfTest(oeSelfTest): def get_eSDK_toolchain(image): pn_task = '%s -c populate_sdk_ext' % image - sdk_deploy = get_bb_var('SDK_DEPLOY', pn_task) - toolchain_name = get_bb_var('TOOLCHAINEXT_OUTPUTNAME', pn_task) + 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')
@@ -64,7 +65,7 @@ class oeSDKExtSelfTest(oeSelfTest): runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) - + sstate_config=""" SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" SSTATE_MIRRORS = "file://.* http://%s/PATH"
@@ -73,7 +74,6 @@ CORE_IMAGE_EXTRA_INSTALL = "perl" with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: f.write(sstate_config) - @classmethod def setUpClass(cls):
@@ -83,7 +83,7 @@ CORE_IMAGE_EXTRA_INSTALL = "perl" cls.http_service.start() cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port - + cls.image = 'core-image-minimal' cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')
@@ -103,7 +103,6 @@ SSTATE_MIRRORS = "file://.* http://%s/PATH" with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: f.write(sstate_config) - @classmethod def tearDownClass(cls): shutil.rmtree(cls.tmpdir_eSDKQA)
@@ -115,7 +114,7 @@ SSTATE_MIRRORS = "file://.* http://%s/PATH" bitbake(pn_sstate) cmd = "devtool sdk-install %s " % pn_sstate oeSDKExtSelfTest.run_esdk_cmd(self.env_eSDK, self.tmpdir_eSDKQA, cmd) - + @testcase(1603) def test_image_generation_binary_feeds(self): image = 'core-image-minimal'
meta/lib/oeqa/selftest/liboe.py +12 -9
@@ -1,11 +1,16 @@ from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import get_bb_var, bitbake, runCmd +from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake, runCmd import oe.path import glob import os import os.path class LibOE(oeSelfTest): + + @classmethod + def setUpClass(cls): + cls.tmp_dir = get_bb_var('TMPDIR') + def test_copy_tree_special(self): """ Summary: oe.path.copytree() should copy files with special character
@@ -14,8 +19,7 @@ class LibOE(oeSelfTest): Product: OE-Core Author: Joshua Lock <[email protected]> """ - tmp_dir = get_bb_var('TMPDIR') - testloc = oe.path.join(tmp_dir, 'liboetests') + testloc = oe.path.join(self.tmp_dir, 'liboetests') src = oe.path.join(testloc, 'src') dst = oe.path.join(testloc, 'dst') bb.utils.mkdirhier(testloc)
@@ -40,8 +44,7 @@ class LibOE(oeSelfTest): Product: OE-Core Author: Joshua Lock <[email protected]> """ - tmp_dir = get_bb_var('TMPDIR') - testloc = oe.path.join(tmp_dir, 'liboetests') + testloc = oe.path.join(self.tmp_dir, 'liboetests') src = oe.path.join(testloc, 'src') dst = oe.path.join(testloc, 'dst') bb.utils.mkdirhier(testloc)
@@ -51,8 +54,9 @@ class LibOE(oeSelfTest): # ensure we have setfattr available bitbake("attr-native") - destdir = get_bb_var('SYSROOT_DESTDIR', 'attr-native') - bindir = get_bb_var('bindir', 'attr-native') + bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'attr-native') + destdir = bb_vars['SYSROOT_DESTDIR'] + bindir = bb_vars['bindir'] bindir = destdir + bindir # create a file with xattr and copy it
@@ -73,8 +77,7 @@ class LibOE(oeSelfTest): Product: OE-Core Author: Joshua Lock <[email protected]> """ - tmp_dir = get_bb_var('TMPDIR') - testloc = oe.path.join(tmp_dir, 'liboetests') + testloc = oe.path.join(self.tmp_dir, 'liboetests') src = oe.path.join(testloc, 'src') dst = oe.path.join(testloc, 'dst') bb.utils.mkdirhier(testloc)
meta/lib/oeqa/selftest/manifest.py +4 -3
@@ -2,7 +2,7 @@ import unittest import os from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import get_bb_var, bitbake +from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake from oeqa.utils.decorators import testcase class ManifestEntry:
@@ -84,9 +84,10 @@ class VerifyManifest(oeSelfTest): try: mdir = self.get_dir_from_bb_var('SDK_DEPLOY', self.buildtarget) for k in d_target.keys(): + bb_vars = get_bb_vars(['SDK_NAME', 'SDK_VERSION'], self.buildtarget) mfilename[k] = "{}-toolchain-{}.{}.manifest".format( - get_bb_var("SDK_NAME", self.buildtarget), - get_bb_var("SDK_VERSION", self.buildtarget), + bb_vars['SDK_NAME'], + bb_vars['SDK_VERSION'], k) mpath[k] = os.path.join(mdir, mfilename[k]) if not os.path.isfile(mpath[k]):
meta/lib/oeqa/selftest/pkgdata.py +6 -5
@@ -6,7 +6,7 @@ import fnmatch import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars from oeqa.utils.decorators import testcase class OePkgdataUtilTests(oeSelfTest):
@@ -126,10 +126,11 @@ class OePkgdataUtilTests(oeSelfTest): curpkg = line.split(':')[0] files[curpkg] = [] return files - base_libdir = get_bb_var('base_libdir') - libdir = get_bb_var('libdir') - includedir = get_bb_var('includedir') - mandir = get_bb_var('mandir') + bb_vars = get_bb_vars(['base_libdir', 'libdir', 'includedir', 'mandir']) + base_libdir = bb_vars['base_libdir'] + libdir = bb_vars['libdir'] + includedir = bb_vars['includedir'] + mandir = bb_vars['mandir'] # Test recipe-space package name result = runCmd('oe-pkgdata-util list-pkg-files zlib-dev zlib-doc') files = splitoutput(result.output)
meta/lib/oeqa/selftest/prservice.py +6 -3
@@ -12,10 +12,13 @@ from oeqa.utils.decorators import testcase from oeqa.utils.network import get_free_port class BitbakePrTests(oeSelfTest): - + + @classmethod + def setUpClass(cls): + cls.pkgdata_dir = get_bb_var('PKGDATA_DIR') + def get_pr_version(self, package_name): - pkgdata_dir = get_bb_var('PKGDATA_DIR') - package_data_file = os.path.join(pkgdata_dir, 'runtime', 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) self.assertTrue(find_pr, "No PKG revision found in %s" % package_data_file)
meta/lib/oeqa/selftest/recipetool.py +20 -14
@@ -4,7 +4,8 @@ import shutil import tempfile import urllib.parse -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer +from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import get_bb_vars, create_temp_layer from oeqa.utils.decorators import testcase from oeqa.selftest import devtool
@@ -25,6 +26,7 @@ def tearDownModule(): class RecipetoolBase(devtool.DevtoolBase): + def setUpLocal(self): self.templayerdir = templayerdir self.tempdir = tempfile.mkdtemp(prefix='recipetoolqa')
@@ -65,12 +67,16 @@ class RecipetoolBase(devtool.DevtoolBase): class RecipetoolTests(RecipetoolBase): + @classmethod def setUpClass(cls): # Ensure we have the right data in shlibs/pkgdata logger = logging.getLogger("selftest") logger.info('Running bitbake to generate pkgdata') bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') + bb_vars = get_bb_vars(['COREBASE', 'BBPATH']) + cls.corebase = bb_vars['COREBASE'] + cls.bbpath = bb_vars['BBPATH'] def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles): cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options)
@@ -104,9 +110,8 @@ class RecipetoolTests(RecipetoolBase): # Now try with a file we know should be an alternative # (this is very much a fake example, but one we know is reliably an alternative) self._try_recipetool_appendfile_fail('/bin/ls', self.testfile, ['ERROR: File /bin/ls is an alternative possibly provided by the following recipes:', 'coreutils', 'busybox']) - corebase = get_bb_var('COREBASE') # Need a test file - should be executable - testfile2 = os.path.join(corebase, 'oe-init-build-env') + testfile2 = os.path.join(self.corebase, 'oe-init-build-env') testfile2name = os.path.basename(testfile2) expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', '\n',
@@ -135,7 +140,6 @@ class RecipetoolTests(RecipetoolBase): @testcase(1173) def test_recipetool_appendfile_add(self): - corebase = get_bb_var('COREBASE') # Try arbitrary file add to a recipe expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', '\n',
@@ -148,7 +152,7 @@ class RecipetoolTests(RecipetoolBase): self._try_recipetool_appendfile('netbase', '/usr/share/something', self.testfile, '-r netbase', expectedlines, ['testfile']) # Try adding another file, this time where the source file is executable # (so we're testing that, plus modifying an existing bbappend) - testfile2 = os.path.join(corebase, 'oe-init-build-env') + testfile2 = os.path.join(self.corebase, 'oe-init-build-env') testfile2name = os.path.basename(testfile2) expectedlines = ['FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n', '\n',
@@ -500,8 +504,7 @@ class RecipetoolTests(RecipetoolBase): recipetool = runCmd("which recipetool") fromname = runCmd("recipetool --quiet pluginfile") srcfile = fromname.output - bbpath = get_bb_var('BBPATH') - searchpath = bbpath.split(':') + [os.path.dirname(recipetool.output)] + searchpath = self.bbpath.split(':') + [os.path.dirname(recipetool.output)] plugincontent = [] with open(srcfile) as fh: plugincontent = fh.readlines()
@@ -597,17 +600,18 @@ class RecipetoolAppendsrcBase(RecipetoolBase): self._try_recipetool_appendsrcfiles(testrecipe, newfiles, expectedfiles=expectedfiles, destdir=destdir, options=options) - src_uri = get_bb_var('SRC_URI', testrecipe).split() + bb_vars = get_bb_vars(['SRC_URI', 'FILE', 'FILESEXTRAPATHS'], testrecipe) + src_uri = bb_vars['SRC_URI'].split() for f in expectedfiles: if destdir: self.assertIn('file://%s;subdir=%s' % (f, destdir), src_uri) else: self.assertIn('file://%s' % f, src_uri) - recipefile = get_bb_var('FILE', testrecipe) + recipefile = bb_vars['FILE'] bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir) filesdir = os.path.join(os.path.dirname(bbappendfile), testrecipe) - filesextrapaths = get_bb_var('FILESEXTRAPATHS', testrecipe).split(':') + filesextrapaths = bb_vars['FILESEXTRAPATHS'].split(':') self.assertIn(filesdir, filesextrapaths)
@@ -638,8 +642,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): @testcase(1280) def test_recipetool_appendsrcfile_srcdir_basic(self): testrecipe = 'bash' - srcdir = get_bb_var('S', testrecipe) - workdir = get_bb_var('WORKDIR', testrecipe) + bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) + srcdir = bb_vars['S'] + workdir = bb_vars['WORKDIR'] subdir = os.path.relpath(srcdir, workdir) self._test_appendsrcfile(testrecipe, 'a-file', srcdir=subdir)
@@ -664,8 +669,9 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): def test_recipetool_appendsrcfile_replace_file_srcdir(self): testrecipe = 'bash' filepath = 'Makefile.in' - srcdir = get_bb_var('S', testrecipe) - workdir = get_bb_var('WORKDIR', testrecipe) + bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) + srcdir = bb_vars['S'] + workdir = bb_vars['WORKDIR'] subdir = os.path.relpath(srcdir, workdir) self._test_appendsrcfile(testrecipe, filepath, srcdir=subdir)
meta/lib/oeqa/selftest/runtime-test.py +10 -5
@@ -1,5 +1,5 @@ from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu from oeqa.utils.decorators import testcase import os import re
@@ -31,8 +31,9 @@ class TestExport(oeSelfTest): bitbake('core-image-minimal') bitbake('-c testexport core-image-minimal') - # Verify if TEST_EXPORT_DIR was created testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') + + # Verify if TEST_EXPORT_DIR was created isdir = os.path.isdir(testexport_dir) self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir)
@@ -73,10 +74,14 @@ class TestExport(oeSelfTest): bitbake('core-image-minimal') bitbake('-c testexport core-image-minimal') + needed_vars = ['TEST_EXPORT_DIR', 'TEST_EXPORT_SDK_DIR', 'TEST_EXPORT_SDK_NAME'] + bb_vars = get_bb_vars(needed_vars, 'core-image-minimal') + testexport_dir = bb_vars['TEST_EXPORT_DIR'] + sdk_dir = bb_vars['TEST_EXPORT_SDK_DIR'] + sdk_name = bb_vars['TEST_EXPORT_SDK_NAME'] + # Check for SDK - testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') - sdk_dir = get_bb_var('TEST_EXPORT_SDK_DIR', 'core-image-minimal') - tarball_name = "%s.sh" % get_bb_var('TEST_EXPORT_SDK_NAME', 'core-image-minimal') + tarball_name = "%s.sh" % sdk_name tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name) msg = "Couldn't find SDK tarball: %s" % tarball_path self.assertEqual(os.path.isfile(tarball_path), True, msg)
meta/lib/oeqa/selftest/signing.py +7 -5
@@ -1,5 +1,5 @@ from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars import os import glob import re
@@ -59,15 +59,17 @@ class Signing(oeSelfTest): self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) - pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe) + needed_vars = ['PKGDATA_DIR', 'DEPLOY_DIR_RPM', 'PACKAGE_ARCH', 'STAGING_BINDIR_NATIVE'] + bb_vars = get_bb_vars(needed_vars, test_recipe) + pkgdatadir = bb_vars['PKGDATA_DIR'] pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed") if 'PKGE' in pkgdata: pf = pkgdata['PN'] + "-" + pkgdata['PKGE'] + pkgdata['PKGV'] + '-' + pkgdata['PKGR'] else: pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR'] - deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe) - package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_') - staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE', test_recipe) + deploy_dir_rpm = bb_vars['DEPLOY_DIR_RPM'] + package_arch = bb_vars['PACKAGE_ARCH'].replace('-', '_') + staging_bindir_native = bb_vars['STAGING_BINDIR_NATIVE'] pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
meta/lib/oeqa/selftest/sstate.py +14 -6
@@ -6,17 +6,24 @@ import shutil import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_test_layer class SStateBase(oeSelfTest): def setUpLocal(self): self.temp_sstate_location = None - self.sstate_path = get_bb_var('SSTATE_DIR') - self.hostdistro = get_bb_var('NATIVELSBSTRING') + needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH', + 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] + bb_vars = get_bb_vars(needed_vars) + self.sstate_path = bb_vars['SSTATE_DIR'] + self.hostdistro = bb_vars['NATIVELSBSTRING'] + self.tclibc = bb_vars['TCLIBC'] + self.tune_arch = bb_vars['TUNE_ARCH'] + self.topdir = bb_vars['TOPDIR'] + self.target_vendor = bb_vars['TARGET_VENDOR'] + self.target_os = bb_vars['TARGET_OS'] self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) - self.tclibc = get_bb_var('TCLIBC') # Creates a special sstate configuration with the option to add sstate mirrors def config_sstate(self, temp_sstate_location=False, add_local_mirrors=[]):
@@ -27,8 +34,9 @@ class SStateBase(oeSelfTest): config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path self.append_config(config_temp_sstate) self.track_for_cleanup(temp_sstate_path) - self.sstate_path = get_bb_var('SSTATE_DIR') - self.hostdistro = get_bb_var('NATIVELSBSTRING') + bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING']) + self.sstate_path = bb_vars['SSTATE_DIR'] + self.hostdistro = bb_vars['NATIVELSBSTRING'] self.distro_specific_sstate = os.path.join(self.sstate_path, self.hostdistro) if add_local_mirrors:
meta/lib/oeqa/selftest/sstatetests.py +37 -55
246 lines not on this page · raw message
meta/lib/oeqa/selftest/tinfoil.py +1 -1
@@ -4,7 +4,7 @@ import re import bb.tinfoil from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, get_bb_var +from oeqa.utils.commands import runCmd from oeqa.utils.decorators import testcase class TinfoilTests(oeSelfTest):
meta/lib/oeqa/selftest/wic.py +20 -19
@@ -29,7 +29,7 @@ from glob import glob from shutil import rmtree from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu from oeqa.utils.decorators import testcase
@@ -212,12 +212,11 @@ class Wic(oeSelfTest): @testcase(1212) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" - variables = (('STAGING_DATADIR', 'wic-tools'), - ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), - ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), - ('IMAGE_ROOTFS', 'core-image-minimal')) - bbvars = {var.lower(): get_bb_var(var, recipe) \ - for var, recipe in variables} + bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], + 'wic-tools') + bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], + 'core-image-minimal')) + bbvars = {key.lower(): value for key, value in bb_vars.items()} bbvars['resultdir'] = self.resultdir status = runCmd("wic create directdisk " "-b %(staging_datadir)s "
@@ -321,12 +320,11 @@ class Wic(oeSelfTest): @testcase(1269) def test_rootfs_artifacts(self): """Test usage of rootfs plugin with rootfs paths""" - variables = (('STAGING_DATADIR', 'wic-tools'), - ('RECIPE_SYSROOT_NATIVE', 'wic-tools'), - ('DEPLOY_DIR_IMAGE', 'core-image-minimal'), - ('IMAGE_ROOTFS', 'core-image-minimal')) - bbvars = {var.lower(): get_bb_var(var, recipe) \ - for var, recipe in variables} + bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], + 'wic-tools') + bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], + 'core-image-minimal')) + bbvars = {key.lower(): value for key, value in bb_vars.items()} bbvars['wks'] = "directdisk-multi-rootfs" bbvars['resultdir'] = self.resultdir status = runCmd("wic create %(wks)s "
@@ -360,8 +358,9 @@ class Wic(oeSelfTest): """Generate and obtain the path to <image>.env""" if image not in self.wicenv_cache: self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % image).status) - stdir = get_bb_var('STAGING_DIR', image) - machine = get_bb_var('MACHINE', image) + bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image) + stdir = bb_vars['STAGING_DIR'] + machine = bb_vars['MACHINE'] self.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return self.wicenv_cache[image]
@@ -371,12 +370,13 @@ class Wic(oeSelfTest): image = 'core-image-minimal' imgdatadir = self._get_image_env_path(image) - basename = get_bb_var('IMAGE_BASENAME', image) + bb_vars = get_bb_vars(['IMAGE_BASENAME', 'WICVARS'], image) + basename = bb_vars['IMAGE_BASENAME'] self.assertEqual(basename, image) path = os.path.join(imgdatadir, basename) + '.env' self.assertTrue(os.path.isfile(path)) - wicvars = set(get_bb_var('WICVARS', image).split()) + wicvars = set(bb_vars['WICVARS'].split()) # filter out optional variables wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 'INITRD', 'INITRD_LIVE', 'ISODIR'))
@@ -418,8 +418,9 @@ class Wic(oeSelfTest): self.assertEqual(0, bitbake('wic-image-minimal').status) self.remove_config(config) - deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') - machine = get_bb_var('MACHINE') + bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE']) + deploy_dir = bb_vars['DEPLOY_DIR_IMAGE'] + machine = bb_vars['MACHINE'] prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) # check if we have result image and manifests symlinks # pointing to existing files
Signature · 1 line
2.6.6