summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6import os
7import socketserver
8import subprocess
9
10from oeqa.selftest.case import OESelftestTestCase
11from oeqa.utils.commands import bitbake, get_bb_var, runqemu
12
13class Debuginfod(OESelftestTestCase):
14 def test_debuginfod(self):
15 self.write_config("""
16DISTRO_FEATURES:append = " debuginfod"
17CORE_IMAGE_EXTRA_INSTALL += "elfutils"
18 """)
19 bitbake("core-image-minimal elfutils-native:do_addto_recipe_sysroot")
20
21 native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "elfutils-native")
22 cmd = [os.path.join(native_sysroot, "usr", "bin", "debuginfod"), "--verbose", get_bb_var("DEPLOY_DIR")]
23 for format in get_bb_var("PACKAGE_CLASSES").split():
24 if format == "package_deb":
25 cmd.append("--scan-deb-dir")
26 elif format == "package_ipk":
27 cmd.append("--scan-deb-dir")
28 elif format == "package_rpm":
29 cmd.append("--scan-rpm-dir")
30 # Find a free port
31 with socketserver.TCPServer(("localhost", 0), None) as s:
32 port = s.server_address[1]
33 cmd.append("--port=%d" % port)
34
35 try:
36 debuginfod = subprocess.Popen(cmd)
37
38 with runqemu("core-image-minimal", runqemuparams="nographic") as qemu:
39 cmd = "DEBUGINFOD_URLS=http://%s:%d/ debuginfod-find debuginfo /usr/bin/debuginfod" % (qemu.server_ip, port)
40 status, output = qemu.run_serial(cmd)
41 # This should be more comprehensive
42 self.assertIn("/.cache/debuginfod_client/", output)
43 finally:
44 debuginfod.kill()