mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
oeqa/selftest/wic: use self.td instead of get_bb_var to save on bitbake calls
When a test case starts, self.td is populated with all the variables in the data store. Typically this can be used instead of get_bb_var(), which saves a bitbake call per variable lookup. The only catch is that in parallel runs the build directory is moved after td is populated, so paths in the build directory are wrong: these still need to be fetched in the test. (From OE-Core rev: 884201c6c1bbf7c1b958bab7d7c91e27577eeaac) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
12a1456b06
commit
c4436040eb
|
@ -82,7 +82,7 @@ class WicTestCase(OESelftestTestCase):
|
||||||
# clean up which can result in the native tools built earlier in
|
# clean up which can result in the native tools built earlier in
|
||||||
# setUpClass being unavailable.
|
# setUpClass being unavailable.
|
||||||
if not WicTestCase.image_is_ready:
|
if not WicTestCase.image_is_ready:
|
||||||
if get_bb_var('USE_NLS') != 'yes':
|
if self.td['USE_NLS'] != 'yes':
|
||||||
self.skipTest('wic-tools needs USE_NLS=yes')
|
self.skipTest('wic-tools needs USE_NLS=yes')
|
||||||
|
|
||||||
bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils')
|
bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils')
|
||||||
|
@ -98,9 +98,8 @@ class WicTestCase(OESelftestTestCase):
|
||||||
"""Generate and obtain the path to <image>.env"""
|
"""Generate and obtain the path to <image>.env"""
|
||||||
if image not in WicTestCase.wicenv_cache:
|
if image not in WicTestCase.wicenv_cache:
|
||||||
bitbake('%s -c do_rootfs_wicenv' % image)
|
bitbake('%s -c do_rootfs_wicenv' % image)
|
||||||
bb_vars = get_bb_vars(['STAGING_DIR', 'MACHINE'], image)
|
stdir = get_bb_var('STAGING_DIR', image)
|
||||||
stdir = bb_vars['STAGING_DIR']
|
machine = self.td["MACHINE"]
|
||||||
machine = bb_vars['MACHINE']
|
|
||||||
WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
|
WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata')
|
||||||
return WicTestCase.wicenv_cache[image]
|
return WicTestCase.wicenv_cache[image]
|
||||||
|
|
||||||
|
@ -827,9 +826,8 @@ class Wic2(WicTestCase):
|
||||||
bitbake('wic-image-minimal')
|
bitbake('wic-image-minimal')
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
|
|
||||||
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'])
|
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
||||||
deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
|
machine = self.td['MACHINE']
|
||||||
machine = bb_vars['MACHINE']
|
|
||||||
prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine)
|
prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine)
|
||||||
# check if we have result image and manifests symlinks
|
# check if we have result image and manifests symlinks
|
||||||
# pointing to existing files
|
# pointing to existing files
|
||||||
|
@ -1069,7 +1067,7 @@ class Wic2(WicTestCase):
|
||||||
def _rawcopy_plugin(self, fstype):
|
def _rawcopy_plugin(self, fstype):
|
||||||
"""Test rawcopy plugin"""
|
"""Test rawcopy plugin"""
|
||||||
img = 'core-image-minimal'
|
img = 'core-image-minimal'
|
||||||
machine = get_bb_var('MACHINE', img)
|
machine = self.td["MACHINE"]
|
||||||
params = ',unpack' if fstype.endswith('.gz') else ''
|
params = ',unpack' if fstype.endswith('.gz') else ''
|
||||||
with NamedTemporaryFile("w", suffix=".wks") as wks:
|
with NamedTemporaryFile("w", suffix=".wks") as wks:
|
||||||
wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\
|
wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\
|
||||||
|
@ -1098,12 +1096,11 @@ class Wic2(WicTestCase):
|
||||||
self.append_config(config)
|
self.append_config(config)
|
||||||
bitbake('core-image-minimal')
|
bitbake('core-image-minimal')
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
|
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
||||||
|
machine = self.td['MACHINE']
|
||||||
|
|
||||||
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'])
|
|
||||||
deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
|
|
||||||
machine = bb_vars['MACHINE']
|
|
||||||
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
||||||
self.assertEqual(True, os.path.exists(image_path))
|
self.assertTrue(os.path.exists(image_path))
|
||||||
|
|
||||||
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
|
sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
|
||||||
|
|
||||||
|
@ -1245,7 +1242,7 @@ class Wic2(WicTestCase):
|
||||||
|
|
||||||
def test_sparse_copy(self):
|
def test_sparse_copy(self):
|
||||||
"""Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs"""
|
"""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.td['COREBASE'], 'scripts', 'lib', 'wic')
|
||||||
sys.path.insert(0, libpath)
|
sys.path.insert(0, libpath)
|
||||||
from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp
|
from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp
|
||||||
with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse:
|
with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse:
|
||||||
|
@ -1300,9 +1297,8 @@ class Wic2(WicTestCase):
|
||||||
bitbake('core-image-minimal')
|
bitbake('core-image-minimal')
|
||||||
|
|
||||||
# get path to the image
|
# get path to the image
|
||||||
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'])
|
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
||||||
deploy_dir = bb_vars['DEPLOY_DIR_IMAGE']
|
machine = self.td['MACHINE']
|
||||||
machine = bb_vars['MACHINE']
|
|
||||||
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
||||||
|
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user