diff options
27 files changed, 179 insertions, 153 deletions
diff --git a/meta/lib/oeqa/selftest/case.py b/meta/lib/oeqa/selftest/case.py index 31a11fddda9..fcaf63a16f6 100644 --- a/meta/lib/oeqa/selftest/case.py +++ b/meta/lib/oeqa/selftest/case.py @@ -9,7 +9,7 @@ import errno from unittest.util import safe_repr import oeqa.utils.ftools as ftools -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.core.case import OETestCase class OESelftestTestCase(OETestCase): @@ -264,3 +264,23 @@ to ensure accurate results.") if os.path.exists(expr): msg = self._formatMessage(msg, "%s exists when it should not" % safe_repr(expr)) raise self.failureException(msg) + + @classmethod + def get_bb_vars(cls, variables, target=None, postconfig=None): + """Wrapper that queries local test data instead of calling bitbake on behalf of commands.get_bb_vars""" + values = dict() + # only use local test data when there is no target and unit test has not added any conf value into testinc file + if not target and not os.path.exists(cls.testinc_path): + for var in variables: + try: + values[var] = cls.td[var] + except KeyError: + break + else: + return values + + return get_bb_vars(variables, target, postconfig) + + @classmethod + def get_bb_var(cls, var, target=None, postconfig=None): + return cls.get_bb_vars([var], target, postconfig)[var] diff --git a/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py b/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py index 0e5896234c3..c5f5eef466f 100644 --- a/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py +++ b/meta/lib/oeqa/selftest/cases/_sstatetests_noauto.py @@ -2,7 +2,7 @@ import os import shutil import oeqa.utils.ftools as ftools -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_test_layer from oeqa.selftest.cases.sstate import SStateBase @@ -60,7 +60,7 @@ class RebuildFromSState(SStateBase): rebuild_targets = primary_targets self.configure_builddir(buildA) - runCmd((". %s/oe-init-build-env %s && " % (get_bb_var('COREBASE'), buildA)) + 'bitbake ' + ' '.join(map(str, primary_targets)), shell=True, executable='/bin/bash') + runCmd((". %s/oe-init-build-env %s && " % (self.get_bb_var('COREBASE'), buildA)) + 'bitbake ' + ' '.join(map(str, primary_targets)), shell=True, executable='/bin/bash') self.hardlink_tree(os.path.join(buildA, 'sstate-cache'), os.path.join(self.builddir, 'sstate-cache-buildA')) shutil.rmtree(buildA) @@ -70,13 +70,13 @@ class RebuildFromSState(SStateBase): self.configure_builddir(buildB) self.hardlink_tree(os.path.join(self.builddir, 'sstate-cache-buildA'), os.path.join(buildB, 'sstate-cache')) - result_cleansstate = runCmd((". %s/oe-init-build-env %s && " % (get_bb_var('COREBASE'), buildB)) + 'bitbake -ccleansstate ' + target, ignore_status=True, shell=True, executable='/bin/bash') + result_cleansstate = runCmd((". %s/oe-init-build-env %s && " % (self.get_bb_var('COREBASE'), buildB)) + 'bitbake -ccleansstate ' + target, ignore_status=True, shell=True, executable='/bin/bash') if not result_cleansstate.status == 0: failed_cleansstate.append(target) shutil.rmtree(buildB) continue - result_build = runCmd((". %s/oe-init-build-env %s && " % (get_bb_var('COREBASE'), buildB)) + 'bitbake ' + target, ignore_status=True, shell=True, executable='/bin/bash') + result_build = runCmd((". %s/oe-init-build-env %s && " % (self.get_bb_var('COREBASE'), buildB)) + 'bitbake ' + target, ignore_status=True, shell=True, executable='/bin/bash') if not result_build.status == 0: failed_rebuild.append(target) diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index 72026d573cc..e41a95aba4a 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py @@ -1,6 +1,6 @@ import os import glob -from oeqa.utils.commands import bitbake, get_bb_vars +from oeqa.utils.commands import bitbake from oeqa.selftest.case import OESelftestTestCase from oeqa.core.decorator.oeid import OETestID @@ -29,7 +29,7 @@ class Archiver(OESelftestTestCase): bitbake('-c clean %s %s' % (include_recipe, exclude_recipe)) bitbake("-c deploy_archives %s %s" % (include_recipe, exclude_recipe)) - bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS']) + bb_vars = self.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 @@ -61,7 +61,7 @@ class Archiver(OESelftestTestCase): bitbake('-c clean %s %s' % (target_recipe, native_recipe)) bitbake("%s -c deploy_archives %s" % (target_recipe, native_recipe)) - bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) + bb_vars = self.get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) @@ -98,7 +98,7 @@ class Archiver(OESelftestTestCase): bitbake('-c clean %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) bitbake('-c deploy_archives %s %s' % (' '.join(target_recipes), ' '.join(native_recipes))) - bb_vars = get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) + bb_vars = self.get_bb_vars(['DEPLOY_DIR_SRC', 'TARGET_SYS', 'BUILD_SYS']) src_path_target = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['TARGET_SYS']) src_path_native = os.path.join(bb_vars['DEPLOY_DIR_SRC'], bb_vars['BUILD_SYS']) diff --git a/meta/lib/oeqa/selftest/cases/bblayers.py b/meta/lib/oeqa/selftest/cases/bblayers.py index 90a2249b081..7ffd79cc7c7 100644 --- a/meta/lib/oeqa/selftest/cases/bblayers.py +++ b/meta/lib/oeqa/selftest/cases/bblayers.py @@ -2,7 +2,7 @@ import os import re import oeqa.utils.ftools as ftools -from oeqa.utils.commands import runCmd, get_bb_var +from oeqa.utils.commands import runCmd from oeqa.selftest.case import OESelftestTestCase from oeqa.core.decorator.oeid import OETestID @@ -48,7 +48,7 @@ class BitbakeLayers(OESelftestTestCase): @OETestID(1195) def test_bitbakelayers_add_remove(self): - test_layer = os.path.join(get_bb_var('COREBASE'), 'meta-skeleton') + test_layer = os.path.join(self.get_bb_var('COREBASE'), 'meta-skeleton') result = runCmd('bitbake-layers show-layers') self.assertNotIn('meta-skeleton', result.output, "This test cannot run with meta-skeleton in bblayers.conf. bitbake-layers show-layers output: %s" % result.output) result = runCmd('bitbake-layers add-layer %s' % test_layer) diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 4c82049032b..c8d536db3a5 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py @@ -2,7 +2,7 @@ import os import re import oeqa.utils.ftools as ftools -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, bitbake from oeqa.selftest.case import OESelftestTestCase from oeqa.core.decorator.oeid import OETestID @@ -79,7 +79,7 @@ class BitbakeTests(OESelftestTestCase): # test 1 from bug 5875 test_recipe = 'zlib' test_data = "Microsoft Made No Profit From Anyone's Zunes Yo" - bb_vars = get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe) + bb_vars = self.get_bb_vars(['D', 'PKGDEST', 'mandir'], test_recipe) image_dir = bb_vars['D'] pkgsplit_dir = bb_vars['PKGDEST'] man_dir = bb_vars['mandir'] @@ -123,7 +123,7 @@ class BitbakeTests(OESelftestTestCase): @OETestID(899) def test_image_manifest(self): bitbake('core-image-minimal') - bb_vars = get_bb_vars(["DEPLOY_DIR_IMAGE", "IMAGE_LINK_NAME"], "core-image-minimal") + bb_vars = self.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") @@ -164,7 +164,7 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\" result = bitbake('-f -c fetch aspell', ignore_status=True) self.delete_recipeinc('aspell') self.assertEqual(result.status, 0, msg = "Couldn't fetch aspell. %s" % result.output) - dl_dir = get_bb_var("DL_DIR") + dl_dir = self.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) @@ -235,7 +235,7 @@ INHERIT_remove = \"report-error\" self.write_config('INCOMPATIBLE_LICENSE = "GPLv3"') result = bitbake('selftest-ed', ignore_status=True) self.assertEqual(result.status, 0, "Bitbake failed, exit code %s, output %s" % (result.status, result.output)) - lic_dir = get_bb_var('LICENSE_DIRECTORY') + lic_dir = self.get_bb_var('LICENSE_DIRECTORY') self.assertFalse(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPLv3'))) self.assertTrue(os.path.isfile(os.path.join(lic_dir, 'selftest-ed/generic_GPLv2'))) @@ -258,7 +258,7 @@ INHERIT_remove = \"report-error\" def test_bbappend_order(self): """ Bitbake should bbappend to recipe in a predictable order """ test_recipe = 'ed' - bb_vars = get_bb_vars(['SUMMARY', 'PV'], test_recipe) + bb_vars = self.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' @@ -275,5 +275,5 @@ INHERIT_remove = \"report-error\" self.add_command_to_tearDown('rm -rf %s' % os.path.join(self.testlayer_path, 'recipes-test', test_recipe + '_test_*')) - test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe) + test_recipe_summary_after = self.get_bb_var('SUMMARY', test_recipe) self.assertEqual(expected_recipe_summary, test_recipe_summary_after) diff --git a/meta/lib/oeqa/selftest/cases/buildhistory.py b/meta/lib/oeqa/selftest/cases/buildhistory.py index 06792d9146d..0f2517b9d48 100644 --- a/meta/lib/oeqa/selftest/cases/buildhistory.py +++ b/meta/lib/oeqa/selftest/cases/buildhistory.py @@ -3,13 +3,13 @@ import re import datetime from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import bitbake, get_bb_vars +from oeqa.utils.commands import bitbake class BuildhistoryBase(OESelftestTestCase): def config_buildhistory(self, tmp_bh_location=False): - bb_vars = get_bb_vars(['USER_CLASSES', 'INHERIT']) + bb_vars = self.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) diff --git a/meta/lib/oeqa/selftest/cases/buildoptions.py b/meta/lib/oeqa/selftest/cases/buildoptions.py index 1f1bb7ae631..3153191ab9f 100644 --- a/meta/lib/oeqa/selftest/cases/buildoptions.py +++ b/meta/lib/oeqa/selftest/cases/buildoptions.py @@ -5,7 +5,7 @@ import shutil import tempfile from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.cases.buildhistory import BuildhistoryBase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, bitbake import oeqa.utils.ftools as ftools from oeqa.core.decorator.oeid import OETestID @@ -13,14 +13,14 @@ class ImageOptionsTests(OESelftestTestCase): @OETestID(761) def test_incremental_image_generation(self): - image_pkgtype = get_bb_var("IMAGE_PKGTYPE") + image_pkgtype = self.get_bb_var("IMAGE_PKGTYPE") if image_pkgtype != 'rpm': self.skipTest('Not using RPM as main package format') bitbake("-c clean core-image-minimal") self.write_config('INC_RPM_IMAGE_GEN = "1"') self.append_config('IMAGE_FEATURES += "ssh-server-openssh"') bitbake("core-image-minimal") - log_data_file = os.path.join(get_bb_var("WORKDIR", "core-image-minimal"), "temp/log.do_rootfs") + log_data_file = os.path.join(self.get_bb_var("WORKDIR", "core-image-minimal"), "temp/log.do_rootfs") log_data_created = ftools.read_file(log_data_file) incremental_created = re.search(r"Installing\s*:\s*packagegroup-core-ssh-openssh", log_data_created) self.remove_config('IMAGE_FEATURES += "ssh-server-openssh"') @@ -33,19 +33,19 @@ class ImageOptionsTests(OESelftestTestCase): @OETestID(286) def test_ccache_tool(self): bitbake("ccache-native") - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'ccache-native') + bb_vars = self.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"') self.add_command_to_tearDown('bitbake -c clean m4') bitbake("m4 -f -c compile") - log_compile = os.path.join(get_bb_var("WORKDIR","m4"), "temp/log.do_compile") + log_compile = os.path.join(self.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) @OETestID(1435) def test_read_only_image(self): - distro_features = get_bb_var('DISTRO_FEATURES') + distro_features = self.get_bb_var('DISTRO_FEATURES') if not ('x11' in distro_features and 'opengl' in distro_features): self.skipTest('core-image-sato requires x11 and opengl in distro features') self.write_config('IMAGE_FEATURES += "read-only-rootfs"') @@ -78,7 +78,7 @@ class SanityOptionsTest(OESelftestTestCase): def test_options_warnqa_errorqa_switch(self): self.write_config("INHERIT_remove = \"report-error\"") - if "packages-list" not in get_bb_var("ERROR_QA"): + if "packages-list" not in self.get_bb_var("ERROR_QA"): self.append_config("ERROR_QA_append = \" packages-list\"") self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') @@ -159,7 +159,7 @@ class BuildhistoryTests(BuildhistoryBase): @OETestID(293) def test_buildhistory_basic(self): self.run_buildhistory_operation('xcursor-transparent-theme') - self.assertTrue(os.path.isdir(get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.") + self.assertTrue(os.path.isdir(self.get_bb_var('BUILDHISTORY_DIR')), "buildhistory dir was not created.") @OETestID(294) def test_buildhistory_buildtime_pr_backwards(self): @@ -177,7 +177,7 @@ class ArchiverTest(OESelftestTestCase): self.write_config("INHERIT += \"archiver\"\nARCHIVER_MODE[src] = \"original\"\nARCHIVER_MODE[srpm] = \"1\"") res = bitbake("xcursor-transparent-theme", ignore_status=True) self.assertEqual(res.status, 0, "\nCouldn't build xcursortransparenttheme.\nbitbake output %s" % res.output) - deploy_dir_src = get_bb_var('DEPLOY_DIR_SRC') + deploy_dir_src = self.get_bb_var('DEPLOY_DIR_SRC') pkgs_path = g.glob(str(deploy_dir_src) + "/allarch*/xcurs*") src_file_glob = str(pkgs_path[0]) + "/xcursor*.src.rpm" tar_file_glob = str(pkgs_path[0]) + "/xcursor*.tar.gz" diff --git a/meta/lib/oeqa/selftest/cases/containerimage.py b/meta/lib/oeqa/selftest/cases/containerimage.py index 99a5cc9e575..66ef157a930 100644 --- a/meta/lib/oeqa/selftest/cases/containerimage.py +++ b/meta/lib/oeqa/selftest/cases/containerimage.py @@ -1,9 +1,10 @@ import os from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import bitbake, get_bb_vars, runCmd +from oeqa.utils.commands import bitbake, runCmd from oeqa.core.decorator.oeid import OETestID + # This test builds an image with using the "container" IMAGE_FSTYPE, and # ensures that then files in the image are only the ones expected. # @@ -41,7 +42,7 @@ PACKAGE_CLASSES = "package_ipk" IMAGE_FEATURES = "" """) - bbvars = get_bb_vars(['bindir', 'sysconfdir', 'localstatedir', + bbvars = self.get_bb_vars(['bindir', 'sysconfdir', 'localstatedir', 'DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], target='container-test-image') expected_files = [ diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 88d69724f93..acdb222ff35 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -7,8 +7,8 @@ import fnmatch import oeqa.utils.ftools as ftools from oeqa.selftest.case import OESelftestTestCase -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.commands import runCmd, bitbake, create_temp_layer +from oeqa.utils.commands import runqemu, get_test_layer from oeqa.core.decorator.oeid import OETestID class DevtoolBase(OESelftestTestCase): @@ -119,7 +119,7 @@ class DevtoolTests(DevtoolBase): @classmethod def setUpClass(cls): super(DevtoolTests, cls).setUpClass() - bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR']) + bb_vars = cls.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 @@ -213,7 +213,7 @@ class DevtoolTests(DevtoolBase): bitbake('pv -c cleansstate') # Test devtool build result = runCmd('devtool build pv') - bb_vars = get_bb_vars(['D', 'bindir'], 'pv') + bb_vars = self.get_bb_vars(['D', 'bindir'], 'pv') installdir = bb_vars['D'] self.assertTrue(installdir, 'Could not query installdir variable') bindir = bb_vars['bindir'] @@ -244,7 +244,7 @@ class DevtoolTests(DevtoolBase): result = runCmd('devtool add %s' % srcdir) self.assertExists(os.path.join(self.workspacedir, 'conf', 'layer.conf'), 'Workspace directory not created') # Check the recipe name is correct - recipefile = get_bb_var('FILE', pn) + recipefile = self.get_bb_var('FILE', pn) self.assertIn('%s_git.bb' % pn, recipefile, 'Recipe file incorrectly named') self.assertIn(recipefile, result.output) # Test devtool status @@ -297,7 +297,7 @@ class DevtoolTests(DevtoolBase): f.write('\nTESTLIBOUTPUT = "${COMPONENTS_DIR}/${TUNE_PKGARCH}/${PN}/${libdir}"\n') # Test devtool build result = runCmd('devtool build libftdi') - bb_vars = get_bb_vars(['TESTLIBOUTPUT', 'STAMP'], 'libftdi') + bb_vars = self.get_bb_vars(['TESTLIBOUTPUT', 'STAMP'], 'libftdi') staging_libdir = bb_vars['TESTLIBOUTPUT'] self.assertTrue(staging_libdir, 'Could not query TESTLIBOUTPUT variable') self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of devtool build libftdi %s" % result.output) @@ -333,7 +333,7 @@ class DevtoolTests(DevtoolBase): self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) # Check recipe - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') checkvars = {} checkvars['S'] = '${WORKDIR}/MarkupSafe-${PV}' @@ -350,7 +350,7 @@ class DevtoolTests(DevtoolBase): self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) # Check recipe - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) self.assertIn('%s_%s.bb' % (testrecipe, fakever), recipefile, 'Recipe file incorrectly named') checkvars = {} checkvars['S'] = '${WORKDIR}/MarkupSafe-%s' % testver @@ -377,7 +377,7 @@ class DevtoolTests(DevtoolBase): self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) # Check recipe - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') checkvars = {} checkvars['S'] = '${WORKDIR}/git' @@ -396,7 +396,7 @@ class DevtoolTests(DevtoolBase): self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) # Check recipe - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) self.assertIn('_git.bb', recipefile, 'Recipe file incorrectly named') checkvars = {} checkvars['S'] = '${WORKDIR}/git' @@ -426,7 +426,7 @@ class DevtoolTests(DevtoolBase): self.assertIn(testrecipe, result.output) self.assertIn(srcdir, result.output) # Check recipe - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) self.assertIn('%s_%s.bb' % (testrecipe, testver), recipefile, 'Recipe file incorrectly named') checkvars = {} checkvars['S'] = None @@ -465,7 +465,7 @@ class DevtoolTests(DevtoolBase): self.assertNotIn(expected + '\n', f, message) modfile = os.path.join(tempdir, 'mdadm.8.in') - bb_vars = get_bb_vars(['PKGD', 'mandir'], 'mdadm') + bb_vars = self.get_bb_vars(['PKGD', 'mandir'], 'mdadm') pkgd = bb_vars['PKGD'] self.assertTrue(pkgd, 'Could not query PKGD variable') mandir = bb_vars['mandir'] @@ -581,7 +581,7 @@ class DevtoolTests(DevtoolBase): inheritnative = False testrecipes = 'mtools-native apt-native desktop-file-utils-native'.split() for testrecipe in testrecipes: - checkextend = 'native' in (get_bb_var('BBCLASSEXTEND', testrecipe) or '').split() + checkextend = 'native' in (self.get_bb_var('BBCLASSEXTEND', testrecipe) or '').split() if not bbclassextended: bbclassextended = checkextend if not inheritnative: @@ -601,7 +601,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_modify_git(self): # Check preconditions testrecipe = 'mkelfimage' - src_uri = get_bb_var('SRC_URI', testrecipe) + src_uri = self.get_bb_var('SRC_URI', testrecipe) self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) # Clean up anything in the workdir/sysroot/sstate cache bitbake('%s -c cleansstate' % testrecipe) @@ -629,7 +629,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_modify_localfiles(self): # Check preconditions testrecipe = 'lighttpd' - src_uri = (get_bb_var('SRC_URI', testrecipe) or '').split() + src_uri = (self.get_bb_var('SRC_URI', testrecipe) or '').split() foundlocal = False for item in src_uri: if item.startswith('file://') and '.patch' not in item: @@ -683,7 +683,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe(self): # Check preconditions testrecipe = 'minicom' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe) @@ -716,7 +716,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_git(self): # Check preconditions testrecipe = 'mtd-utils' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) @@ -786,7 +786,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_append(self): # Check preconditions testrecipe = 'mdadm' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] self.assertNotIn('git://', src_uri, 'This test expects the %s recipe to NOT be a git recipe' % testrecipe) @@ -855,7 +855,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_append_git(self): # Check preconditions testrecipe = 'mtd-utils' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] self.assertIn('git://', src_uri, 'This test expects the %s recipe to be a git recipe' % testrecipe) @@ -945,7 +945,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_local_files(self): """Check that local source files are copied over instead of patched""" testrecipe = 'makedevs' - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) # Setup srctree for modifying the recipe tempdir = tempfile.mkdtemp(prefix='devtoolqa') self.track_for_cleanup(tempdir) @@ -977,7 +977,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_local_files_2(self): """Check local source files support when oe-local-files is in Git""" testrecipe = 'lzo' - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) # Setup srctree for modifying the recipe tempdir = tempfile.mkdtemp(prefix='devtoolqa') self.track_for_cleanup(tempdir) @@ -1018,7 +1018,7 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_local_files_3(self): # First, modify the recipe testrecipe = 'devtool-test-localonly' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -1038,9 +1038,9 @@ class DevtoolTests(DevtoolBase): def test_devtool_update_recipe_local_patch_gz(self): # First, modify the recipe testrecipe = 'devtool-test-patch-gz' - if get_bb_var('DISTRO') == 'poky-tiny': + if self.get_bb_var('DISTRO') == 'poky-tiny': self.skipTest("The DISTRO 'poky-tiny' does not provide the dependencies needed by %s" % testrecipe) - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -1069,7 +1069,7 @@ class DevtoolTests(DevtoolBase): # was also in SRC_URI # First, modify the recipe testrecipe = 'devtool-test-subdir' - bb_vars = get_bb_vars(['FILE', 'SRC_URI'], testrecipe) + bb_vars = self.get_bb_vars(['FILE', 'SRC_URI'], testrecipe) recipefile = bb_vars['FILE'] src_uri = bb_vars['SRC_URI'] tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -1123,9 +1123,9 @@ class DevtoolTests(DevtoolBase): result = runCmd('devtool modify -x %s %s' % (testrecipe2, os.path.join(tempdir, testrecipe2))) result = runCmd('devtool build %s' % testrecipe1) result = runCmd('devtool build %s' % testrecipe2) - stampprefix1 = get_bb_var('STAMP', testrecipe1) + stampprefix1 = self.get_bb_var('STAMP', testrecipe1) self.assertTrue(stampprefix1, 'Unable to get STAMP value for recipe %s' % testrecipe1) - stampprefix2 = get_bb_var('STAMP', testrecipe2) + stampprefix2 = self.get_bb_var('STAMP', testrecipe2) self.assertTrue(stampprefix2, 'Unable to get STAMP value for recipe %s' % testrecipe2) result = runCmd('devtool reset -a') self.assertIn(testrecipe1, result.output) @@ -1147,7 +1147,7 @@ class DevtoolTests(DevtoolBase): # really this has to be done as an oe-selftest test. # # Check preconditions - machine = get_bb_var('MACHINE') + machine = self.get_bb_var('MACHINE') if not machine.startswith('qemu'): self.skipTest('This test only works with qemu machines') if not os.path.exists('/etc/runqemu-nosudo'): @@ -1170,7 +1170,7 @@ class DevtoolTests(DevtoolBase): testcommand = '/sbin/mdadm --help' # Build an image to run bitbake("%s qemu-native qemu-helper-native" % testimage) - deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') + deploy_dir_image = self.get_bb_var('DEPLOY_DIR_IMAGE') self.add_command_to_tearDown('bitbake -c clean %s' % testimage) self.add_command_to_tearDown('rm -f %s/%s*' % (deploy_dir_image, testimage)) # Clean recipe so the first deploy will fail @@ -1199,7 +1199,7 @@ class DevtoolTests(DevtoolBase): result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand)) # Check if it deployed all of the files with the right ownership/perms # First look on the host - need to do this under pseudo to get the correct ownership/perms - bb_vars = get_bb_vars(['D', 'FAKEROOTENV', 'FAKEROOTCMD'], testrecipe) + bb_vars = self.get_bb_vars(['D', 'FAKEROOTENV', 'FAKEROOTCMD'], testrecipe) installdir = bb_vars['D'] fakerootenv = bb_vars['FAKEROOTENV'] fakerootcmd = bb_vars['FAKEROOTCMD'] @@ -1245,8 +1245,8 @@ class DevtoolTests(DevtoolBase): result = runCmd('devtool build-image %s' % image) self.assertNotEqual(result, 0, 'devtool build-image failed') # Check if image contains expected packages - deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') - image_link_name = get_bb_var('IMAGE_LINK_NAME', image) + deploy_dir_image = self.get_bb_var('DEPLOY_DIR_IMAGE') + image_link_name = self.get_bb_var('IMAGE_LINK_NAME', image) reqpkgs = [item for item in recipes if not item.endswith('-native')] with open(os.path.join(deploy_dir_image, image_link_name + '.manifest'), 'r') as f: for line in f: @@ -1271,7 +1271,7 @@ class DevtoolTests(DevtoolBase): # For the moment, we are using a real recipe. recipe = 'devtool-upgrade-test1' version = '1.6.0' - oldrecipefile = get_bb_var('FILE', recipe) + oldrecipefile = self.get_bb_var('FILE', recipe) tempdir = tempfile.mkdtemp(prefix='devtoolqa') self.track_for_cleanup(tempdir) # Check that recipe is not already under devtool control @@ -1311,7 +1311,7 @@ class DevtoolTests(DevtoolBase): self.add_command_to_tearDown('bitbake-layers remove-layer */workspace') recipe = 'devtool-upgrade-test2' commit = '6cc6077a36fe2648a5f993fe7c16c9632f946517' - oldrecipefile = get_bb_var('FILE', recipe) + oldrecipefile = self.get_bb_var('FILE', recipe) tempdir = tempfile.mkdtemp(prefix='devtoolqa') self.track_for_cleanup(tempdir) # Check that recipe is not already under devtool control @@ -1376,7 +1376,7 @@ class DevtoolTests(DevtoolBase): devtool = runCmd("which devtool") fromname = runCmd("devtool --quiet pluginfile") srcfile = fromname.output - bbpath = get_bb_var('BBPATH') + bbpath = self.get_bb_var('BBPATH') searchpath = bbpath.split(':') + [os.path.dirname(devtool.output)] plugincontent = [] with open(srcfile) as fh: @@ -1406,7 +1406,7 @@ class DevtoolTests(DevtoolBase): recipe = 'devtool-upgrade-test1' oldversion = '1.5.3' newversion = '1.6.0' - oldrecipefile = get_bb_var('FILE', recipe) + oldrecipefile = self.get_bb_var('FILE', recipe) recipedir = os.path.dirname(oldrecipefile) result = runCmd('git status --porcelain .', cwd=recipedir) if result.output.strip(): @@ -1461,7 +1461,7 @@ class DevtoolTests(DevtoolBase): # Try finish to a different layer - should create a bbappend # This cleanup isn't strictly necessary but do it anyway just in case it goes wrong and writes to here self.add_command_to_tearDown('rm -rf %s ; cd %s ; git checkout %s' % (recipedir, os.path.dirname(recipedir), recipedir)) - oe_core_dir = os.path.join(get_bb_var('COREBASE'), 'meta') + oe_core_dir = os.path.join(self.get_bb_var('COREBASE'), 'meta') newrecipedir = os.path.join(oe_core_dir, 'recipes-test', 'devtool') newrecipefile = os.path.join(newrecipedir, '%s_%s.bb' % (recipe, newversion)) self.track_for_cleanup(newrecipedir) @@ -1482,7 +1482,7 @@ class DevtoolTests(DevtoolBase): # Try modifying a recipe self.track_for_cleanup(self.workspacedir) recipe = 'mdadm' - oldrecipefile = get_bb_var('FILE', recipe) + oldrecipefile = self.get_bb_var('FILE', recipe) recipedir = os.path.dirname(oldrecipefile) result = runCmd('git status --porcelain .', cwd=recipedir) if result.output.strip(): @@ -1529,7 +1529,7 @@ class DevtoolTests(DevtoolBase): recipe, oldrecipefile, recipedir, filesdir = self._setup_test_devtool_finish_modify() # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) self.assertIn('/meta/', recipedir) - relpth = os.path.relpath(recipedir, os.path.join(get_bb_var('COREBASE'), 'meta')) + relpth = os.path.relpath(recipedir, os.path.join(self.get_bb_var('COREBASE'), 'meta')) appenddir = os.path.join(get_test_layer(), relpth) self.track_for_cleanup(appenddir) # Try finish to the original layer @@ -1641,7 +1641,7 @@ class DevtoolTests(DevtoolBase): and modification to the source and configurations are reflected when building the kernel. """ - kernel_provider = get_bb_var('PREFERRED_PROVIDER_virtual/kernel') + kernel_provider = self.get_bb_var('PREFERRED_PROVIDER_virtual/kernel') # Clean up the enviroment bitbake('%s -c clean' % kernel_provider) tempdir = tempfile.mkdtemp(prefix='devtoolqa') @@ -1653,8 +1653,8 @@ class DevtoolTests(DevtoolBase): #Here is just generated the config file instead of all the kernel to optimize the #time of executing this test case. bitbake('%s -c configure' % kernel_provider) - bbconfig = os.path.join(get_bb_var('B', kernel_provider),'.config') - buildir= get_bb_var('TOPDIR') + bbconfig = os.path.join(self.get_bb_var('B', kernel_provider),'.config') + buildir= self.get_bb_var('TOPDIR') #Step 2 runCmd('cp %s %s' % (bbconfig, buildir)) self.assertExists(os.path.join(buildir, '.config'), 'Could not copy .config file from kernel') @@ -1673,7 +1673,8 @@ class DevtoolTests(DevtoolBase): #NOTE: virtual/kernel is mapped to kernel_provider result = runCmd('devtool build %s' % kernel_provider) self.assertEqual(0,result.status,'Cannot build kernel using `devtool build`') - kernelfile = os.path.join(get_bb_var('KBUILD_OUTPUT', kernel_provider), 'vmlinux') + + kernelfile = os.path.join(self.get_bb_var('KBUILD_OUTPUT', kernel_provider), 'vmlinux') self.assertExists(kernelfile, 'Kernel was not build correctly') #Modify the kernel source @@ -1690,8 +1691,8 @@ class DevtoolTests(DevtoolBase): rebuild = runCmd('devtool build %s' % kernel_provider) self.assertEqual(0,rebuild.status,'Fail to build kernel after modification of source and config') #Step 4.4 - bzimagename = 'bzImage-' + get_bb_var('KERNEL_VERSION_NAME', kernel_provider) - bzimagefile = os.path.join(get_bb_var('D', kernel_provider),'boot', bzimagename) + bzimagename = 'bzImage-' + self.get_bb_var('KERNEL_VERSION_NAME', kernel_provider) + bzimagefile = os.path.join(self.get_bb_var('D', kernel_provider),'boot', bzimagename) checkmodcode = runCmd("grep '%s' %s" % (modstring, bzimagefile)) self.assertEqual(0,checkmodcode.status,'Modification on kernel source failed') #Step 4.5 diff --git a/meta/lib/oeqa/selftest/cases/eSDK.py b/meta/lib/oeqa/selftest/cases/eSDK.py index f36c3ccd3b4..5ce50a40124 100644 --- a/meta/lib/oeqa/selftest/cases/eSDK.py +++ b/meta/lib/oeqa/selftest/cases/eSDK.py @@ -4,7 +4,7 @@ import os import glob from oeqa.core.decorator.oeid import OETestID from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, bitbake, get_bb_vars class oeSDKExtSelfTest(OESelftestTestCase): """ @@ -72,7 +72,7 @@ CORE_IMAGE_EXTRA_INSTALL = "perl" super(oeSDKExtSelfTest, cls).setUpClass() cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') - sstate_dir = get_bb_var('SSTATE_DIR') + sstate_dir = cls.get_bb_var('SSTATE_DIR') cls.image = 'core-image-minimal' oeSDKExtSelfTest.generate_eSDK(cls.image) diff --git a/meta/lib/oeqa/selftest/cases/imagefeatures.py b/meta/lib/oeqa/selftest/cases/imagefeatures.py index e6652ec7aba..132b859472b 100644 --- a/meta/lib/oeqa/selftest/cases/imagefeatures.py +++ b/meta/lib/oeqa/selftest/cases/imagefeatures.py @@ -1,5 +1,5 @@ from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu +from oeqa.utils.commands import runCmd, bitbake, runqemu from oeqa.core.decorator.oeid import OETestID from oeqa.utils.sshcontrol import SSHControl import os @@ -89,7 +89,7 @@ class ImageFeatures(OESelftestTestCase): AutomatedBy: Daniel Istrate <daniel.alexandrux.istrate@intel.com> """ - distro_features = get_bb_var('DISTRO_FEATURES') + distro_features = self.get_bb_var('DISTRO_FEATURES') if not ('opengl' in distro_features and 'wayland' in distro_features): self.skipTest('neither opengl nor wayland present on DISTRO_FEATURES so core-image-weston cannot be built') @@ -112,8 +112,8 @@ class ImageFeatures(OESelftestTestCase): image_name = 'core-image-minimal' bitbake(image_name) - deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') - link_name = get_bb_var('IMAGE_LINK_NAME', image_name) + deploy_dir_image = self.get_bb_var('DEPLOY_DIR_IMAGE') + link_name = self.get_bb_var('IMAGE_LINK_NAME', image_name) image_path = os.path.join(deploy_dir_image, "%s.ext4" % link_name) bmap_path = "%s.bmap" % image_path diff --git a/meta/lib/oeqa/selftest/cases/layerappend.py b/meta/lib/oeqa/selftest/cases/layerappend.py index 95621163090..d09b08e8970 100644 --- a/meta/lib/oeqa/selftest/cases/layerappend.py +++ b/meta/lib/oeqa/selftest/cases/layerappend.py @@ -1,7 +1,7 @@ import os from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake import oeqa.utils.ftools as ftools from oeqa.core.decorator.oeid import OETestID @@ -51,7 +51,7 @@ SRC_URI_append += "file://appendtest.txt" @OETestID(1196) def test_layer_appends(self): - corebase = get_bb_var("COREBASE") + corebase = self.get_bb_var("COREBASE") for l in ["0", "1", "2"]: layer = os.path.join(corebase, "meta-layertest" + l) @@ -80,7 +80,7 @@ SRC_URI_append += "file://appendtest.txt" self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase) ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend) - stagingdir = get_bb_var("SYSROOT_DESTDIR", "layerappendtest") + stagingdir = self.get_bb_var("SYSROOT_DESTDIR", "layerappendtest") bitbake("layerappendtest") data = ftools.read_file(stagingdir + "/appendtest.txt") self.assertEqual(data, "Layer 2 test") diff --git a/meta/lib/oeqa/selftest/cases/liboe.py b/meta/lib/oeqa/selftest/cases/liboe.py index e84609246a7..86dc875c82b 100644 --- a/meta/lib/oeqa/selftest/cases/liboe.py +++ b/meta/lib/oeqa/selftest/cases/liboe.py @@ -1,6 +1,7 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.core.decorator.oeid import OETestID -from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake, runCmd +from oeqa.utils.commands import bitbake, runCmd + import oe.path import os @@ -9,7 +10,7 @@ class LibOE(OESelftestTestCase): @classmethod def setUpClass(cls): super(LibOE, cls).setUpClass() - cls.tmp_dir = get_bb_var('TMPDIR') + cls.tmp_dir = cls.get_bb_var('TMPDIR') @OETestID(1635) def test_copy_tree_special(self): @@ -56,7 +57,7 @@ class LibOE(OESelftestTestCase): # ensure we have setfattr available bitbake("attr-native") - bb_vars = get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'attr-native') + bb_vars = self.get_bb_vars(['SYSROOT_DESTDIR', 'bindir'], 'attr-native') destdir = bb_vars['SYSROOT_DESTDIR'] bindir = bb_vars['bindir'] bindir = destdir + bindir diff --git a/meta/lib/oeqa/selftest/cases/manifest.py b/meta/lib/oeqa/selftest/cases/manifest.py index 146071934dd..e5bf72bb5d7 100644 --- a/meta/lib/oeqa/selftest/cases/manifest.py +++ b/meta/lib/oeqa/selftest/cases/manifest.py @@ -1,7 +1,7 @@ import os from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import get_bb_var, get_bb_vars, bitbake +from oeqa.utils.commands import bitbake from oeqa.core.decorator.oeid import OETestID class ManifestEntry: @@ -37,7 +37,7 @@ class VerifyManifest(OESelftestTestCase): @classmethod def get_dir_from_bb_var(self, bb_var, target = None): target == self.buildtarget if target == None else target - directory = get_bb_var(bb_var, target); + directory = self.get_bb_var(bb_var, target); if not directory or not os.path.isdir(directory): self.logger.debug("{}: {} points to {} when target = {}"\ .format(self.classname, bb_var, directory, target)) @@ -84,7 +84,7 @@ class VerifyManifest(OESelftestTestCase): 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) + bb_vars = self.get_bb_vars(['SDK_NAME', 'SDK_VERSION'], self.buildtarget) mfilename[k] = "{}-toolchain-{}.{}.manifest".format( bb_vars['SDK_NAME'], bb_vars['SDK_VERSION'], @@ -134,7 +134,7 @@ class VerifyManifest(OESelftestTestCase): try: mdir = self.get_dir_from_bb_var('DEPLOY_DIR_IMAGE', self.buildtarget) - mfilename = get_bb_var("IMAGE_LINK_NAME", self.buildtarget)\ + mfilename = self.get_bb_var("IMAGE_LINK_NAME", self.buildtarget)\ + ".manifest" mpath = os.path.join(mdir, mfilename) if not os.path.isfile(mpath): raise IOError diff --git a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py index 08675fd8208..ea87aae5236 100644 --- a/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py +++ b/meta/lib/oeqa/selftest/cases/oelib/buildhistory.py @@ -1,7 +1,7 @@ import os from oeqa.selftest.case import OESelftestTestCase import tempfile -from oeqa.utils.commands import get_bb_var + from oeqa.core.decorator.oeid import OETestID class TestBlobParsing(OESelftestTestCase): @@ -9,7 +9,7 @@ class TestBlobParsing(OESelftestTestCase): def setUp(self): import time self.repo_path = tempfile.mkdtemp(prefix='selftest-buildhistory', - dir=get_bb_var('TOPDIR')) + dir=self.get_bb_var('TOPDIR')) try: from git import Repo diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index 1ee753763ec..9e8d1fabe1c 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py @@ -1,6 +1,6 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.selftest.cases.buildhistory import BuildhistoryBase -from oeqa.utils.commands import Command, runCmd, bitbake, get_bb_var, get_test_layer +from oeqa.utils.commands import Command, runCmd, bitbake, get_test_layer from oeqa.core.decorator.oeid import OETestID class BuildhistoryDiffTests(BuildhistoryBase): @@ -10,6 +10,6 @@ class BuildhistoryDiffTests(BuildhistoryBase): target = 'xcursor-transparent-theme' self.run_buildhistory_operation(target, target_config="PR = \"r1\"", change_bh_location=True) self.run_buildhistory_operation(target, target_config="PR = \"r0\"", change_bh_location=False, expect_error=True) - result = runCmd("buildhistory-diff -p %s" % get_bb_var('BUILDHISTORY_DIR')) + result = runCmd("buildhistory-diff -p %s" % self.get_bb_var('BUILDHISTORY_DIR')) expected_output = 'PR changed from "r1" to "r0"' self.assertTrue(expected_output in result.output, msg="Did not find expected output: %s" % result.output) diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py index 5b9a6d15851..190acc2c1c0 100644 --- a/meta/lib/oeqa/selftest/cases/package.py +++ b/meta/lib/oeqa/selftest/cases/package.py @@ -1,6 +1,7 @@ from oeqa.selftest.case import OESelftestTestCase from oeqa.core.decorator.oeid import OETestID -from oeqa.utils.commands import bitbake, get_bb_vars +from oeqa.utils.commands import bitbake + import subprocess, os import oe.path @@ -22,7 +23,7 @@ class VersionOrdering(OESelftestTestCase): bitbake("build-sysroots -c build_native_sysroot") # Get the paths so we can point into the sysroot correctly - vars = get_bb_vars(["STAGING_DIR", "BUILD_ARCH", "bindir_native", "libdir_native"]) + vars = cls.get_bb_vars(["STAGING_DIR", "BUILD_ARCH", "bindir_native", "libdir_native"]) cls.staging = oe.path.join(vars["STAGING_DIR"], vars["BUILD_ARCH"]) cls.bindir = oe.path.join(cls.staging, vars["bindir_native"]) cls.libdir = oe.path.join(cls.staging, vars["libdir_native"]) diff --git a/meta/lib/oeqa/selftest/cases/pkgdata.py b/meta/lib/oeqa/selftest/cases/pkgdata.py index 0b4caf1b2c2..4f87ffed1aa 100644 --- a/meta/lib/oeqa/selftest/cases/pkgdata.py +++ b/meta/lib/oeqa/selftest/cases/pkgdata.py @@ -3,7 +3,7 @@ import tempfile import fnmatch from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, bitbake from oeqa.core.decorator.oeid import OETestID class OePkgdataUtilTests(OESelftestTestCase): @@ -122,7 +122,7 @@ class OePkgdataUtilTests(OESelftestTestCase): curpkg = line.split(':')[0] files[curpkg] = [] return files - bb_vars = get_bb_vars(['base_libdir', 'libdir', 'includedir', 'mandir']) + bb_vars = self.get_bb_vars(['base_libdir', 'libdir', 'includedir', 'mandir']) base_libdir = bb_vars['base_libdir'] libdir = bb_vars['libdir'] includedir = bb_vars['includedir'] @@ -220,5 +220,5 @@ class OePkgdataUtilTests(OESelftestTestCase): @OETestID(1206) def test_specify_pkgdatadir(self): - result = runCmd('oe-pkgdata-util -p %s lookup-pkg zlib' % get_bb_var('PKGDATA_DIR')) + result = runCmd('oe-pkgdata-util -p %s lookup-pkg zlib' % self.get_bb_var('PKGDATA_DIR')) self.assertEqual(result.output, 'libz1') diff --git a/meta/lib/oeqa/selftest/cases/prservice.py b/meta/lib/oeqa/selftest/cases/prservice.py index ed36f0fed76..876e604d46b 100644 --- a/meta/lib/oeqa/selftest/cases/prservice.py +++ b/meta/lib/oeqa/selftest/cases/prservice.py @@ -5,7 +5,7 @@ import datetime import oeqa.utils.ftools as ftools from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var +from oeqa.utils.commands import runCmd, bitbake from oeqa.core.decorator.oeid import OETestID from oeqa.utils.network import get_free_port @@ -14,7 +14,7 @@ class BitbakePrTests(OESelftestTestCase): @classmethod def setUpClass(cls): super(BitbakePrTests, cls).setUpClass() - cls.pkgdata_dir = get_bb_var('PKGDATA_DIR') + cls.pkgdata_dir = cls.get_bb_var('PKGDATA_DIR') def get_pr_version(self, package_name): package_data_file = os.path.join(self.pkgdata_dir, 'runtime', package_name) @@ -24,7 +24,7 @@ class BitbakePrTests(OESelftestTestCase): return int(find_pr.group(1)) def get_task_stamp(self, package_name, recipe_task): - stampdata = get_bb_var('STAMP', target=package_name).split('/') + stampdata = self.get_bb_var('STAMP', target=package_name).split('/') prefix = stampdata[-1] package_stamps_path = "/".join(stampdata[:-1]) stamps = [] @@ -75,7 +75,7 @@ class BitbakePrTests(OESelftestTestCase): self.assertEqual(export_result.status, 0, msg="PR Service database export failed: %s" % export_result.output) if replace_current_db: - current_db_path = os.path.join(get_bb_var('PERSISTENT_DIR'), 'prserv.sqlite3') + current_db_path = os.path.join(self.get_bb_var('PERSISTENT_DIR'), 'prserv.sqlite3') self.assertTrue(os.path.exists(current_db_path), msg="Path to current PR Service database is invalid: %s" % current_db_path) os.remove(current_db_path) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index bdd405f1cc0..7dda382cf98 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -3,8 +3,8 @@ import shutil import tempfile import urllib.parse -from oeqa.utils.commands import runCmd, bitbake, get_bb_var -from oeqa.utils.commands import get_bb_vars, create_temp_layer +from oeqa.utils.commands import runCmd, bitbake +from oeqa.utils.commands import create_temp_layer from oeqa.core.decorator.oeid import OETestID from oeqa.selftest.cases import devtool @@ -42,7 +42,7 @@ class RecipetoolBase(devtool.DevtoolBase): self.assertNotIn('Traceback', result.output) # Check the bbappend was created and applies properly - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir) # Check the bbappend contents @@ -73,7 +73,7 @@ class RecipetoolTests(RecipetoolBase): # Ensure we have the right data in shlibs/pkgdata cls.logger.info('Running bitbake to generate pkgdata') bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') - bb_vars = get_bb_vars(['COREBASE', 'BBPATH']) + bb_vars = cls.get_bb_vars(['COREBASE', 'BBPATH']) cls.corebase = bb_vars['COREBASE'] cls.bbpath = bb_vars['BBPATH'] @@ -355,7 +355,7 @@ class RecipetoolTests(RecipetoolBase): return bbappendfile # Check without wildcard option - recipefn = os.path.basename(get_bb_var('FILE', 'base-files')) + recipefn = os.path.basename(self.get_bb_var('FILE', 'base-files')) filename = try_appendfile_wc('') self.assertEqual(filename, recipefn.replace('.bb', '.bbappend')) # Now check with wildcard option @@ -381,7 +381,7 @@ class RecipetoolTests(RecipetoolBase): @OETestID(1194) def test_recipetool_create_git(self): - if 'x11' not in get_bb_var('DISTRO_FEATURES'): + if 'x11' not in self.get_bb_var('DISTRO_FEATURES'): self.skipTest('Test requires x11 as distro feature') # Ensure we have the right data in shlibs/pkgdata bitbake('libpng pango libx11 libxext jpeg libcheck') @@ -557,7 +557,7 @@ class RecipetoolAppendsrcBase(RecipetoolBase): @staticmethod def _get_first_file_uri(recipe): '''Return the first file:// in SRC_URI for the specified recipe.''' - src_uri = get_bb_var('SRC_URI', recipe).split() + src_uri = RecipetoolAppendsrcBase.get_bb_var('SRC_URI', recipe).split() for uri in src_uri: p = urllib.parse.urlparse(uri) if p.scheme == 'file': @@ -605,7 +605,7 @@ class RecipetoolAppendsrcBase(RecipetoolBase): self._try_recipetool_appendsrcfiles(testrecipe, newfiles, expectedfiles=expectedfiles, destdir=destdir, options=options) - bb_vars = get_bb_vars(['SRC_URI', 'FILE', 'FILESEXTRAPATHS'], testrecipe) + bb_vars = self.get_bb_vars(['SRC_URI', 'FILE', 'FILESEXTRAPATHS'], testrecipe) src_uri = bb_vars['SRC_URI'].split() for f in expectedfiles: if destdir: @@ -632,7 +632,7 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): def test_recipetool_appendsrcfile_basic_wildcard(self): testrecipe = 'base-files' self._test_appendsrcfile(testrecipe, 'a-file', options='-w') - recipefile = get_bb_var('FILE', testrecipe) + recipefile = self.get_bb_var('FILE', testrecipe) bbappendfile = self._check_bbappend(testrecipe, recipefile, self.templayerdir) self.assertEqual(os.path.basename(bbappendfile), '%s_%%.bbappend' % testrecipe) @@ -647,7 +647,7 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): @OETestID(1280) def test_recipetool_appendsrcfile_srcdir_basic(self): testrecipe = 'bash' - bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) + bb_vars = self.get_bb_vars(['S', 'WORKDIR'], testrecipe) srcdir = bb_vars['S'] workdir = bb_vars['WORKDIR'] subdir = os.path.relpath(srcdir, workdir) @@ -674,7 +674,7 @@ class RecipetoolAppendsrcTests(RecipetoolAppendsrcBase): def test_recipetool_appendsrcfile_replace_file_srcdir(self): testrecipe = 'bash' filepath = 'Makefile.in' - bb_vars = get_bb_vars(['S', 'WORKDIR'], testrecipe) + bb_vars = self.get_bb_vars(['S', 'WORKDIR'], testrecipe) srcdir = bb_vars['S'] workdir = bb_vars['WORKDIR'] subdir = os.path.relpath(srcdir, workdir) diff --git a/meta/lib/oeqa/selftest/cases/runqemu.py b/meta/lib/oeqa/selftest/cases/runqemu.py index 4050a4123ba..e43a3ab666b 100644 --- a/meta/lib/oeqa/selftest/cases/runqemu.py +++ b/meta/lib/oeqa/selftest/cases/runqemu.py @@ -6,7 +6,7 @@ import re import logging from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import bitbake, runqemu, get_bb_var +from oeqa.utils.commands import bitbake, runqemu from oeqa.core.decorator.oeid import OETestID class RunqemuTests(OESelftestTestCase): @@ -37,7 +37,7 @@ SYSLINUX_TIMEOUT = "10" ) if not RunqemuTests.image_is_ready: - RunqemuTests.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE') + RunqemuTests.deploy_dir_image = self.get_bb_var('DEPLOY_DIR_IMAGE') bitbake(self.recipe) RunqemuTests.image_is_ready = True diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 2a70ae15b81..c6f5235fc90 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -1,5 +1,5 @@ from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu +from oeqa.utils.commands import runCmd, bitbake, runqemu from oeqa.core.decorator.oeid import OETestID import os import re @@ -33,7 +33,7 @@ class TestExport(OESelftestTestCase): bitbake('core-image-minimal') bitbake('-c testexport core-image-minimal') - testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') + testexport_dir = self.get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') # Verify if TEST_EXPORT_DIR was created isdir = os.path.isdir(testexport_dir) @@ -78,7 +78,7 @@ class TestExport(OESelftestTestCase): 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') + bb_vars = self.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'] @@ -115,7 +115,7 @@ class TestImage(OESelftestTestCase): Product: oe-core Author: Mariano Lopez <mariano.lopez@intel.com> """ - if get_bb_var('DISTRO') == 'poky-tiny': + if self.get_bb_var('DISTRO') == 'poky-tiny': self.skipTest('core-image-full-cmdline not buildable for poky-tiny') features = 'INHERIT += "testimage"\n' @@ -134,7 +134,7 @@ class TestImage(OESelftestTestCase): Product: oe-core Author: Alexander Kanavin <alexander.kanavin@intel.com> """ - if get_bb_var('DISTRO') == 'poky-tiny': + if self.get_bb_var('DISTRO') == 'poky-tiny': self.skipTest('core-image-full-cmdline not buildable for poky-tiny') features = 'INHERIT += "testimage"\n' @@ -180,7 +180,7 @@ postinst-delayed-t \ '103-postinst-delayed-d', '104-postinst-delayed-p', '105-postinst-delayed-t'] - path_workdir = get_bb_var('WORKDIR','core-image-minimal') + path_workdir = self.get_bb_var('WORKDIR','core-image-minimal') workspacedir = 'testimage/qemu_boot_log' workspacedir = os.path.join(path_workdir, workspacedir) rexp = re.compile("^Running postinst .*/(?P<postinst>.*)\.\.\.$") @@ -245,7 +245,7 @@ postinst-delayed-t \ bitbake('core-image-minimal') #Step 3 - file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS',"core-image-minimal"), + file_rootfs_created = os.path.join(self.get_bb_var('IMAGE_ROOTFS',"core-image-minimal"), file_rootfs_name) found = os.path.isfile(file_rootfs_created) self.assertTrue(found, "File %s was not created at rootfs time by %s" % \ diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py index edb5f653f20..df4497d3934 100644 --- a/meta/lib/oeqa/selftest/cases/signing.py +++ b/meta/lib/oeqa/selftest/cases/signing.py @@ -1,5 +1,5 @@ from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars +from oeqa.utils.commands import runCmd, bitbake import os import glob import re @@ -43,7 +43,7 @@ class Signing(OESelftestTestCase): """ import oe.packagedata - package_classes = get_bb_var('PACKAGE_CLASSES') + package_classes = self.get_bb_var('PACKAGE_CLASSES') if 'package_rpm' not in package_classes: self.skipTest('This test requires RPM Packaging.') @@ -62,7 +62,7 @@ class Signing(OESelftestTestCase): self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) needed_vars = ['PKGDATA_DIR', 'DEPLOY_DIR_RPM', 'PACKAGE_ARCH', 'STAGING_BINDIR_NATIVE'] - bb_vars = get_bb_vars(needed_vars, test_recipe) + bb_vars = self.get_bb_vars(needed_vars, test_recipe) pkgdatadir = bb_vars['PKGDATA_DIR'] pkgdata = oe.packagedata.read_pkgdatafile(pkgdatadir + "/runtime/ed") if 'PKGE' in pkgdata: @@ -165,7 +165,7 @@ class LockedSignatures(OESelftestTestCase): bitbake(test_recipe) # Make a change that should cause the locked task signature to change - recipe_append_file = test_recipe + '_' + get_bb_var('PV', test_recipe) + '.bbappend' + recipe_append_file = test_recipe + '_' + self.get_bb_var('PV', test_recipe) + '.bbappend' recipe_append_path = os.path.join(self.testlayer_path, 'recipes-test', test_recipe, recipe_append_file) feature = 'SUMMARY += "test locked signature"\n' diff --git a/meta/lib/oeqa/selftest/cases/sstate.py b/meta/lib/oeqa/selftest/cases/sstate.py index bc2fdbd8ccb..cf5002801b1 100644 --- a/meta/lib/oeqa/selftest/cases/sstate.py +++ b/meta/lib/oeqa/selftest/cases/sstate.py @@ -6,7 +6,7 @@ import shutil import oeqa.utils.ftools as ftools from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_test_layer class SStateBase(OESelftestTestCase): @@ -16,7 +16,7 @@ class SStateBase(OESelftestTestCase): self.temp_sstate_location = None needed_vars = ['SSTATE_DIR', 'NATIVELSBSTRING', 'TCLIBC', 'TUNE_ARCH', 'TOPDIR', 'TARGET_VENDOR', 'TARGET_OS'] - bb_vars = get_bb_vars(needed_vars) + bb_vars = self.get_bb_vars(needed_vars) self.sstate_path = bb_vars['SSTATE_DIR'] self.hostdistro = bb_vars['NATIVELSBSTRING'] self.tclibc = bb_vars['TCLIBC'] @@ -35,7 +35,7 @@ class SStateBase(OESelftestTestCase): config_temp_sstate = "SSTATE_DIR = \"%s\"" % temp_sstate_path self.append_config(config_temp_sstate) self.track_for_cleanup(temp_sstate_path) - bb_vars = get_bb_vars(['SSTATE_DIR', 'NATIVELSBSTRING']) + bb_vars = self.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) diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index 07a206824aa..a84551ca266 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -4,7 +4,7 @@ import glob import subprocess from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_test_layer from oeqa.selftest.cases.sstate import SStateBase from oeqa.core.decorator.oeid import OETestID @@ -150,7 +150,7 @@ class SStateTests(SStateBase): for idx in range(len(target_config)): self.append_config(global_config[idx]) self.append_recipeinc(target, target_config[idx]) - sstate_arch = get_bb_var('SSTATE_PKGARCH', target) + sstate_arch = self.get_bb_var('SSTATE_PKGARCH', target) if not sstate_arch in sstate_archs_list: sstate_archs_list.append(sstate_arch) if target_config[idx] == target_config[-1]: diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 02c7d0f66e1..2ea540f7692 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -33,7 +33,7 @@ from functools import wraps, lru_cache from tempfile import NamedTemporaryFile from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.core.decorator.oeid import OETestID @@ -73,13 +73,13 @@ class Wic(OESelftestTestCase): """This code is executed before each test method.""" super(Wic, self).setUpLocal() if not self.native_sysroot: - Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'wic-tools') + Wic.native_sysroot = self.get_bb_var('STAGING_DIR_NATIVE', 'wic-tools') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: - if get_bb_var('USE_NLS') == 'yes': + if self.get_bb_var('USE_NLS') == 'yes': bitbake('wic-tools') else: self.skipTest('wic-tools cannot be built due its (intltool|gettext)-native dependency and NLS disable') @@ -237,7 +237,7 @@ class Wic(OESelftestTestCase): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir - kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') + kimgtype = self.get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) @@ -256,9 +256,9 @@ class Wic(OESelftestTestCase): @only_for_arch(['i586', 'i686', 'x86_64']) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" - bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], + bb_vars = self.get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], 'wic-tools') - bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], + bb_vars.update(self.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 @@ -369,9 +369,9 @@ class Wic(OESelftestTestCase): @only_for_arch(['i586', 'i686', 'x86_64']) def test_rootfs_artifacts(self): """Test usage of rootfs plugin with rootfs paths""" - bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], + bb_vars = self.get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], 'wic-tools') - bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], + bb_vars.update(self.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" @@ -391,12 +391,12 @@ class Wic(OESelftestTestCase): """Test --exclude-path wks option.""" oldpath = os.environ['PATH'] - os.environ['PATH'] = get_bb_var("PATH", "wic-tools") + os.environ['PATH'] = self.get_bb_var("PATH", "wic-tools") try: wks_file = 'temp.wks' with open(wks_file, 'w') as wks: - rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal') + rootfs_dir = self.get_bb_var('IMAGE_ROOTFS', 'core-image-minimal') wks.write(""" part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr @@ -535,7 +535,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r """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) - bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image) + bb_vars = self.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') @@ -547,7 +547,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r image = 'core-image-minimal' imgdatadir = self._get_image_env_path(image) - bb_vars = get_bb_vars(['IMAGE_BASENAME', 'WICVARS'], image) + bb_vars = self.get_bb_vars(['IMAGE_BASENAME', 'WICVARS'], image) basename = bb_vars['IMAGE_BASENAME'] self.assertEqual(basename, image) path = os.path.join(imgdatadir, basename) + '.env' @@ -597,7 +597,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r self.assertEqual(0, bitbake('wic-image-minimal').status) self.remove_config(config) - bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE']) + bb_vars = self.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) @@ -722,7 +722,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r def test_rawcopy_plugin(self): """Test rawcopy plugin""" img = 'core-image-minimal' - machine = get_bb_var('MACHINE', img) + machine = self.get_bb_var('MACHINE', img) with NamedTemporaryFile("w", suffix=".wks") as wks: wks.writelines(['part /boot --active --source bootimg-pcbios\n', 'part / --source rawcopy --sourceparams="file=%s-%s.ext4" --use-uuid\n'\ @@ -773,7 +773,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r """Test globbed sources with image-bootpart plugin""" img = "core-image-minimal" cmd = "wic create sdimage-bootpart -e %s -o %s" % (img, self.resultdir) - config = 'IMAGE_BOOT_FILES = "%s*"' % get_bb_var('KERNEL_IMAGETYPE', img) + config = 'IMAGE_BOOT_FILES = "%s*"' % self.get_bb_var('KERNEL_IMAGETYPE', img) self.append_config(config) self.assertEqual(0, runCmd(cmd).status) self.remove_config(config) @@ -782,7 +782,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r @OETestID(1855) def test_sparse_copy(self): """Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs""" - libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'wic') + libpath = os.path.join(self.get_bb_var('COREBASE'), 'scripts', 'lib', 'wic') sys.path.insert(0, libpath) from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse: @@ -817,7 +817,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r images = glob(self.resultdir + "wictestdisk-*.direct") self.assertEqual(1, len(images)) - sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') + sysroot = self.get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') # list partitions result = runCmd("wic ls %s -n %s" % (images[0], sysroot)) @@ -838,7 +838,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r images = glob(self.resultdir + "wictestdisk-*.direct") self.assertEqual(1, len(images)) - sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') + sysroot = self.get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') # list directory content of the first partition result = runCmd("wic ls %s:1/ -n %s" % (images[0], sysroot)) @@ -883,7 +883,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r images = glob(self.resultdir + "mkefidisk-*.direct") self.assertEqual(1, len(images)) - sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') + sysroot = self.get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') # list directory content of the first partition result = runCmd("wic ls %s:1 -n %s" % (images[0], sysroot)) diff --git a/meta/lib/oeqa/utils/ftools.py b/meta/lib/oeqa/utils/ftools.py index a7233d4ca6e..be22a92768b 100644 --- a/meta/lib/oeqa/utils/ftools.py +++ b/meta/lib/oeqa/utils/ftools.py @@ -9,6 +9,7 @@ def write_file(path, data): wdata = data.rstrip() + "\n" with open(path, "w") as f: f.write(wdata) + f.flush() def append_file(path, data): # In case data is None, return immediately @@ -17,6 +18,7 @@ def append_file(path, data): wdata = data.rstrip() + "\n" with open(path, "a") as f: f.write(wdata) + f.flush() def read_file(path): data = None |