summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@digi.com>2022-11-03 07:56:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-11-11 13:43:40 +0000
commit44aeb523c85f1433966f6355fff28f0c481ba363 (patch)
tree8469d2d1950d415580381c562281e7b78555009f
parent3a403ea562c7bc7aa07c40f5095c6078dc33366b (diff)
downloadpoky-44aeb523c85f1433966f6355fff28f0c481ba363.tar.gz
oeqa/selftest/minidebuginfo: Create selftest for minidebuginfo
Add a new selftest to validate minidebuginfo support. This selftest builds a complete target image with PACKAGE_MINIDEBUGINFO enabled. ELFs included in the image are expected to have minidebuginfo included in the resulting executables and shared libraries, the self test validates this by unpacking the image and checking for the associated ".gnu_debugdata" section on busybox and libc ELFs. (From OE-Core rev: 5063a31ad05b75ec6ac12158fe759e81fcdb1585) Signed-off-by: Nathan Rossi <nathan.rossi@digi.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/minidebuginfo.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/minidebuginfo.py b/meta/lib/oeqa/selftest/cases/minidebuginfo.py
new file mode 100644
index 0000000000..7947c3803c
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/minidebuginfo.py
@@ -0,0 +1,43 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6import os
7import subprocess
8import tempfile
9import shutil
10
11from oeqa.selftest.case import OESelftestTestCase
12from oeqa.utils.commands import bitbake, get_bb_var, runCmd
13
14
15class Minidebuginfo(OESelftestTestCase):
16 def test_minidebuginfo(self):
17 target_sys = get_bb_var("TARGET_SYS")
18 binutils = "binutils-cross-{}".format(get_bb_var("TARGET_ARCH"))
19
20 self.write_config("""
21PACKAGE_MINIDEBUGINFO = "1"
22IMAGE_FSTYPES = "tar.bz2"
23""")
24 bitbake("core-image-minimal {}:do_addto_recipe_sysroot".format(binutils))
25
26 deploy_dir = get_bb_var("DEPLOY_DIR_IMAGE")
27 native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", binutils)
28 readelf = get_bb_var("READELF", "core-image-minimal")
29
30 # confirm that executables and shared libraries contain an ELF section
31 # ".gnu_debugdata" which stores minidebuginfo.
32 with tempfile.TemporaryDirectory(prefix = "unpackfs-") as unpackedfs:
33 filename = os.path.join(deploy_dir, "core-image-minimal-{}.tar.bz2".format(self.td["MACHINE"]))
34 shutil.unpack_archive(filename, unpackedfs)
35
36 r = runCmd([readelf, "-W", "-S", os.path.join(unpackedfs, "bin", "busybox")],
37 native_sysroot = native_sysroot, target_sys = target_sys)
38 self.assertIn(".gnu_debugdata", r.output)
39
40 r = runCmd([readelf, "-W", "-S", os.path.join(unpackedfs, "lib", "libc.so.6")],
41 native_sysroot = native_sysroot, target_sys = target_sys)
42 self.assertIn(".gnu_debugdata", r.output)
43