summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2023-03-13 13:15:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 13:53:29 +0000
commitaf9f67606ccb0cf0ca6ef35af1616d8e42776b85 (patch)
treeeb13fd2c5f1008caa46a537c996e427a261d17db
parent9dd62390e24caea8dbe6625cff5a46ca03383396 (diff)
downloadpoky-af9f67606ccb0cf0ca6ef35af1616d8e42776b85.tar.gz
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>
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index b9430cdb3b..7c31848732 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -805,12 +805,13 @@ class Wic2(WicTestCase):
805 config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ 805 config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\
806 'MACHINE_FEATURES:append = " efi"\n' 806 'MACHINE_FEATURES:append = " efi"\n'
807 self.append_config(config) 807 self.append_config(config)
808 bitbake('wic-image-minimal') 808 image = 'wic-image-minimal'
809 bitbake(image)
809 self.remove_config(config) 810 self.remove_config(config)
810 811
811 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') 812 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
812 machine = self.td['MACHINE'] 813 prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME'])
813 prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine) 814
814 # check if we have result image and manifests symlinks 815 # check if we have result image and manifests symlinks
815 # pointing to existing files 816 # pointing to existing files
816 for suffix in ('wic', 'manifest'): 817 for suffix in ('wic', 'manifest'):
@@ -1049,14 +1050,14 @@ class Wic2(WicTestCase):
1049 1050
1050 def _rawcopy_plugin(self, fstype): 1051 def _rawcopy_plugin(self, fstype):
1051 """Test rawcopy plugin""" 1052 """Test rawcopy plugin"""
1052 img = 'core-image-minimal' 1053 image = 'core-image-minimal'
1053 machine = self.td["MACHINE"] 1054 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
1054 params = ',unpack' if fstype.endswith('.gz') else '' 1055 params = ',unpack' if fstype.endswith('.gz') else ''
1055 with NamedTemporaryFile("w", suffix=".wks") as wks: 1056 with NamedTemporaryFile("w", suffix=".wks") as wks:
1056 wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\ 1057 wks.write('part / --source rawcopy --sourceparams="file=%s.%s%s"\n'\
1057 % (img, machine, fstype, params)) 1058 % (bb_vars['IMAGE_LINK_NAME'], fstype, params))
1058 wks.flush() 1059 wks.flush()
1059 cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) 1060 cmd = "wic create %s -e %s -o %s" % (wks.name, image, self.resultdir)
1060 runCmd(cmd) 1061 runCmd(cmd)
1061 wksname = os.path.splitext(os.path.basename(wks.name))[0] 1062 wksname = os.path.splitext(os.path.basename(wks.name))[0]
1062 out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname)) 1063 out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1077,12 +1078,11 @@ class Wic2(WicTestCase):
1077 """Test empty plugin""" 1078 """Test empty plugin"""
1078 config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n' 1079 config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n'
1079 self.append_config(config) 1080 self.append_config(config)
1080 bitbake('core-image-minimal') 1081 image = 'core-image-minimal'
1082 bitbake(image)
1081 self.remove_config(config) 1083 self.remove_config(config)
1082 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') 1084 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
1083 machine = self.td['MACHINE'] 1085 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
1084
1085 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
1086 self.assertTrue(os.path.exists(image_path)) 1086 self.assertTrue(os.path.exists(image_path))
1087 1087
1088 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') 1088 sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
@@ -1297,12 +1297,12 @@ class Wic2(WicTestCase):
1297 # build an image 1297 # build an image
1298 config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "directdisk.wks"\n' 1298 config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "directdisk.wks"\n'
1299 self.append_config(config) 1299 self.append_config(config)
1300 bitbake('core-image-minimal') 1300 image = 'core-image-minimal'
1301 bitbake(image)
1301 1302
1302 # get path to the image 1303 # get path to the image
1303 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') 1304 bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
1304 machine = self.td['MACHINE'] 1305 image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
1305 image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
1306 1306
1307 self.remove_config(config) 1307 self.remove_config(config)
1308 1308
@@ -1310,7 +1310,7 @@ class Wic2(WicTestCase):
1310 # expand image to 1G 1310 # expand image to 1G
1311 new_image_path = None 1311 new_image_path = None
1312 with NamedTemporaryFile(mode='wb', suffix='.wic.exp', 1312 with NamedTemporaryFile(mode='wb', suffix='.wic.exp',
1313 dir=deploy_dir, delete=False) as sparse: 1313 dir=bb_vars['DEPLOY_DIR_IMAGE'], delete=False) as sparse:
1314 sparse.truncate(1024 ** 3) 1314 sparse.truncate(1024 ** 3)
1315 new_image_path = sparse.name 1315 new_image_path = sparse.name
1316 1316