summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-08-25 13:00:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-30 10:28:26 +0100
commitd035fd394fd2747ab4b75867af6123f3efb1990f (patch)
tree2a9afe8f105b6b2bddeef5996db0f173d162ead2 /meta/lib/oeqa
parent8e1614a906086fb46c5dd7b7f2dffab91194165c (diff)
downloadopenembedded-core-d035fd394fd2747ab4b75867af6123f3efb1990f.tar.gz
oeqa/selftest: add test for debuginfod
Add a new selftest to exercise the debuginfod support, by starting a debuginfod on DEPLOY_DIR and verifying that an image can fetch the symbols for a binary. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/debuginfod.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/debuginfod.py b/meta/lib/oeqa/selftest/cases/debuginfod.py
new file mode 100644
index 0000000000..01359ec649
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/debuginfod.py
@@ -0,0 +1,44 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+import os
+import socketserver
+import subprocess
+
+from oeqa.selftest.case import OESelftestTestCase
+from oeqa.utils.commands import bitbake, get_bb_var, runqemu
+
+class Debuginfod(OESelftestTestCase):
+ def test_debuginfod(self):
+ self.write_config("""
+DISTRO_FEATURES:append = " debuginfod"
+CORE_IMAGE_EXTRA_INSTALL += "elfutils"
+ """)
+ bitbake("core-image-minimal elfutils-native:do_addto_recipe_sysroot")
+
+ native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "elfutils-native")
+ cmd = [os.path.join(native_sysroot, "usr", "bin", "debuginfod"), "--verbose", get_bb_var("DEPLOY_DIR")]
+ for format in get_bb_var("PACKAGE_CLASSES").split():
+ if format == "package_deb":
+ cmd.append("--scan-deb-dir")
+ elif format == "package_ipk":
+ cmd.append("--scan-deb-dir")
+ elif format == "package_rpm":
+ cmd.append("--scan-rpm-dir")
+ # Find a free port
+ with socketserver.TCPServer(("localhost", 0), None) as s:
+ port = s.server_address[1]
+ cmd.append("--port=%d" % port)
+
+ try:
+ debuginfod = subprocess.Popen(cmd)
+
+ with runqemu("core-image-minimal", runqemuparams="nographic") as qemu:
+ cmd = "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/debuginfod" % (qemu.server_ip, port)
+ status, output = qemu.run_serial(cmd)
+ # This should be more comprehensive
+ self.assertIn("/.cache/debuginfod_client/", output)
+ finally:
+ debuginfod.kill()