public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 03/14] selftest: wic: respect IMAGE_LINK_NAME
Date: Mon, 13 Mar 2023 13:15:30 +0100	[thread overview]
Message-ID: <c0bbef2cf864152e71b40cda69cb0bc886d211a8.1678709427.git.Martin.Jansa@gmail.com> (raw)
In-Reply-To: <cover.1678709427.git.Martin.Jansa@gmail.com>

* use IMAGE_LINK_NAME instead of hardcoding
  core-image-minimal-${MACHINE} assumption

[YOCTO #12937]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/lib/oeqa/selftest/cases/wic.py | 38 ++++++++++++++---------------
 1 file 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):
         config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\
                  'MACHINE_FEATURES:append = " efi"\n'
         self.append_config(config)
-        bitbake('wic-image-minimal')
+        image = 'wic-image-minimal'
+        bitbake(image)
         self.remove_config(config)
 
-        deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
-        machine = self.td['MACHINE']
-        prefix = os.path.join(deploy_dir, 'wic-image-minimal-%s.' % machine)
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
+        prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME'])
+
         # check if we have result image and manifests symlinks
         # pointing to existing files
         for suffix in ('wic', 'manifest'):
@@ -1049,14 +1050,14 @@ class Wic2(WicTestCase):
 
     def _rawcopy_plugin(self, fstype):
         """Test rawcopy plugin"""
-        img = 'core-image-minimal'
-        machine = self.td["MACHINE"]
+        image = 'core-image-minimal'
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
         params = ',unpack' if fstype.endswith('.gz') else ''
         with NamedTemporaryFile("w", suffix=".wks") as wks:
-            wks.write('part / --source rawcopy --sourceparams="file=%s-%s.%s%s"\n'\
-                      % (img, machine, fstype, params))
+            wks.write('part / --source rawcopy --sourceparams="file=%s.%s%s"\n'\
+                      % (bb_vars['IMAGE_LINK_NAME'], fstype, params))
             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)
             wksname = os.path.splitext(os.path.basename(wks.name))[0]
             out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1077,12 +1078,11 @@ class Wic2(WicTestCase):
         """Test empty plugin"""
         config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "test_empty_plugin.wks"\n'
         self.append_config(config)
-        bitbake('core-image-minimal')
+        image = 'core-image-minimal'
+        bitbake(image)
         self.remove_config(config)
-        deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
-        machine = self.td['MACHINE']
-
-        image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
+        image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
         self.assertTrue(os.path.exists(image_path))
 
         sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
@@ -1297,12 +1297,12 @@ class Wic2(WicTestCase):
         # build an image
         config = 'IMAGE_FSTYPES = "wic"\nWKS_FILE = "directdisk.wks"\n'
         self.append_config(config)
-        bitbake('core-image-minimal')
+        image = 'core-image-minimal'
+        bitbake(image)
 
         # get path to the image
-        deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
-        machine = self.td['MACHINE']
-        image_path = os.path.join(deploy_dir, 'core-image-minimal-%s.wic' % machine)
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image)
+        image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.wic' % bb_vars['IMAGE_LINK_NAME'])
 
         self.remove_config(config)
 
@@ -1310,7 +1310,7 @@ class Wic2(WicTestCase):
             # expand image to 1G
             new_image_path = None
             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)
                 new_image_path = sparse.name
 
-- 
2.39.2



  parent reply	other threads:[~2023-03-13 12:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1678709427.git.Martin.Jansa@gmail.com>
2023-03-13 12:15 ` [PATCH 01/14] git-submodule-test: disable upstream version check Martin Jansa
2023-03-13 12:15 ` [PATCH 02/14] selftest: devtool: set BB_HASHSERVE_UPSTREAM when setting SSTATE_MIRROR Martin Jansa
2023-03-13 12:15 ` Martin Jansa [this message]
2023-03-13 12:15 ` [PATCH 04/14] selftest: wic: respect IMAGE_LINK_NAME also in test_rawcopy_plugin_qemu Martin Jansa
2023-03-13 12:15 ` [PATCH 05/14] selftest: runqemu: respect IMAGE_LINK_NAME Martin Jansa
2023-03-13 12:15 ` [PATCH 06/14] selftest: multiconfig-image-packager: try to " Martin Jansa
2023-03-13 12:15 ` [PATCH 07/14] image-artifact-names.bbclass: add INITRAMFS_IMAGE_NAME from kernel.bbclass Martin Jansa
2023-03-13 12:15 ` [PATCH 08/14] selftest: fitimage.py: respect INITRAMFS_IMAGE_NAME and KERNEL_FIT_LINK_NAME Martin Jansa
2023-03-13 12:15 ` [PATCH 09/14] image-artifact-names: add IMAGE_MACHINE_SUFFIX variable Martin Jansa
2023-04-18 22:43   ` [OE-core] " Paul Eggleton
2023-05-11  7:41     ` Martin Jansa
2023-11-28 10:41       ` Martin Jansa
2023-03-13 12:15 ` [PATCH 10/14] selftest: gdbserver.py: respect IMAGE_LINK_NAME Martin Jansa
2023-03-13 12:15 ` [PATCH 11/14] selftest: minidebuginfo.py " Martin Jansa
2023-03-13 12:15 ` [PATCH 12/14] selftest: efibootpartition.py: fix QEMU_USE_KVM usage Martin Jansa
2023-03-13 12:15 ` [PATCH 13/14] runqemu: get_first_file() rename cmd* to glob* Martin Jansa
2023-03-13 12:15 ` [PATCH 14/14] selftest: imagefeatures.py: respect IMAGE_LINK_NAME for debugfs and manifest as well Martin Jansa
     [not found] ` <174BF9A290681E00.25836@lists.openembedded.org>
2023-04-05 15:17   ` [OE-core] [PATCH 12/14] selftest: efibootpartition.py: fix QEMU_USE_KVM usage Martin Jansa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0bbef2cf864152e71b40cda69cb0bc886d211a8.1678709427.git.Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox