mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 18:49:32 +02:00
selftest: wic: respect IMAGE_LINK_NAME
* use IMAGE_LINK_NAME instead of hardcoding
core-image-minimal-${MACHINE} assumption
[YOCTO #12937]
(From OE-Core rev: d6151aeb1e8f6162113b1123fa0f162536e48a44)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9dd62390e2
commit
af9f67606c
@@ -805,12 +805,13 @@ class Wic2(WicTestCase):
|
|||||||
config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\
|
config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\
|
||||||
'MACHINE_FEATURES:append = " efi"\n'
|
'MACHINE_FEATURES:append = " efi"\n'
|
||||||
self.append_config(config)
|
self.append_config(config)
|
||||||
bitbake('wic-image-minimal')
|
image = 'wic-image-minimal'
|
||||||
|
bitbake(image)
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
|
|
||||||
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
|
||||||
machine = self.td['MACHINE']
|
prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME'])
|
||||||
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
|
||||||
for suffix in ('wic', 'manifest'):
|
for suffix in ('wic', 'manifest'):
|
||||||
@@ -1049,14 +1050,14 @@ class Wic2(WicTestCase):
|
|||||||
|
|
||||||
def _rawcopy_plugin(self, fstype):
|
def _rawcopy_plugin(self, fstype):
|
||||||
"""Test rawcopy plugin"""
|
"""Test rawcopy plugin"""
|
||||||
img = 'core-image-minimal'
|
image = 'core-image-minimal'
|
||||||
machine = self.td["MACHINE"]
|
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
|
||||||
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"\n'\
|
||||||
% (img, machine, fstype, params))
|
% (bb_vars['IMAGE_LINK_NAME'], fstype, params))
|
||||||
wks.flush()
|
wks.flush()
|
||||||
cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
|
cmd = "wic create %s -e %s -o %s" % (wks.name, image, self.resultdir)
|
||||||
runCmd(cmd)
|
runCmd(cmd)
|
||||||
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
wksname = os.path.splitext(os.path.basename(wks.name))[0]
|
||||||
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
|
out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
|
||||||
@@ -1077,12 +1078,11 @@ class Wic2(WicTestCase):
|
|||||||
"""Test empty plugin"""
|
"""Test empty plugin"""
|
||||||
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n'
|
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n'
|
||||||
self.append_config(config)
|
self.append_config(config)
|
||||||
bitbake('core-image-minimal')
|
image = 'core-image-minimal'
|
||||||
|
bitbake(image)
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
|
||||||
machine = self.td['MACHINE']
|
image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
|
||||||
|
|
||||||
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
|
||||||
self.assertTrue(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')
|
||||||
@@ -1297,12 +1297,12 @@ class Wic2(WicTestCase):
|
|||||||
# build an image
|
# build an image
|
||||||
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "directdisk.wks"\n'
|
config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "directdisk.wks"\n'
|
||||||
self.append_config(config)
|
self.append_config(config)
|
||||||
bitbake('core-image-minimal')
|
image = 'core-image-minimal'
|
||||||
|
bitbake(image)
|
||||||
|
|
||||||
# get path to the image
|
# get path to the image
|
||||||
deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
|
bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
|
||||||
machine = self.td['MACHINE']
|
image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
|
||||||
image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
|
|
||||||
|
|
||||||
self.remove_config(config)
|
self.remove_config(config)
|
||||||
|
|
||||||
@@ -1310,7 +1310,7 @@ class Wic2(WicTestCase):
|
|||||||
# expand image to 1G
|
# expand image to 1G
|
||||||
new_image_path = None
|
new_image_path = None
|
||||||
with NamedTemporaryFile(mode='wb', suffix='.wic.exp',
|
with NamedTemporaryFile(mode='wb', suffix='.wic.exp',
|
||||||
dir=deploy_dir, delete=False) as sparse:
|
dir=bb_vars['DEPLOY_DIR_IMAGE'], delete=False) as sparse:
|
||||||
sparse.truncate(1024 ** 3)
|
sparse.truncate(1024 ** 3)
|
||||||
new_image_path = sparse.name
|
new_image_path = sparse.name
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user