]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
selftest: minidebuginfo.py respect IMAGE_LINK_NAME
authorMartin Jansa <Martin.Jansa@gmail.com>
Mon, 13 Mar 2023 12:15:38 +0000 (13:15 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 22 Mar 2023 13:53:24 +0000 (13:53 +0000)
* use IMAGE_LINK_NAME instead of hardcoding
  core-image-minimal-${MACHINE} assumption

[YOCTO #12937]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
meta/lib/oeqa/selftest/cases/minidebuginfo.py

index 7947c3803c5584fdde834a04b32e9c12c4ba1b9f..aa1f9fa1f77e6fbfb120cfdec8183341d40b33ea 100644 (file)
@@ -9,7 +9,7 @@ import tempfile
 import shutil
 
 from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import bitbake, get_bb_var, runCmd
+from oeqa.utils.commands import bitbake, get_bb_var, get_bb_vars, runCmd
 
 
 class Minidebuginfo(OESelftestTestCase):
@@ -17,27 +17,28 @@ class Minidebuginfo(OESelftestTestCase):
         target_sys = get_bb_var("TARGET_SYS")
         binutils = "binutils-cross-{}".format(get_bb_var("TARGET_ARCH"))
 
+        image = 'core-image-minimal'
+        bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME', 'READELF'], image)
+
         self.write_config("""
 PACKAGE_MINIDEBUGINFO = "1"
 IMAGE_FSTYPES = "tar.bz2"
 """)
-        bitbake("core-image-minimal {}:do_addto_recipe_sysroot".format(binutils))
+        bitbake("{} {}:do_addto_recipe_sysroot".format(image, binutils))
 
-        deploy_dir = get_bb_var("DEPLOY_DIR_IMAGE")
         native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", binutils)
-        readelf = get_bb_var("READELF", "core-image-minimal")
 
         # confirm that executables and shared libraries contain an ELF section
         # ".gnu_debugdata" which stores minidebuginfo.
         with tempfile.TemporaryDirectory(prefix = "unpackfs-") as unpackedfs:
-            filename = os.path.join(deploy_dir, "core-image-minimal-{}.tar.bz2".format(self.td["MACHINE"]))
+            filename = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], "{}.tar.bz2".format(bb_vars['IMAGE_LINK_NAME']))
             shutil.unpack_archive(filename, unpackedfs)
 
-            r = runCmd([readelf, "-W", "-S", os.path.join(unpackedfs, "bin", "busybox")],
+            r = runCmd([bb_vars['READELF'], "-W", "-S", os.path.join(unpackedfs, "bin", "busybox")],
                     native_sysroot = native_sysroot, target_sys = target_sys)
             self.assertIn(".gnu_debugdata", r.output)
 
-            r = runCmd([readelf, "-W", "-S", os.path.join(unpackedfs, "lib", "libc.so.6")],
+            r = runCmd([bb_vars['READELF'], "-W", "-S", os.path.join(unpackedfs, "lib", "libc.so.6")],
                     native_sysroot = native_sysroot, target_sys = target_sys)
             self.assertIn(".gnu_debugdata", r.output)