diff options
author | Ross Burton <ross.burton@arm.com> | 2022-08-25 13:00:40 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-30 10:33:35 +0100 |
commit | f941dad9d723ead66b88b9905c40c4fbe7002936 (patch) | |
tree | 4922a5a844eee083da454662d6ede7cbcc8ae4d5 /meta/lib/oeqa/selftest/cases/debuginfod.py | |
parent | 4830a76a3ccba8128ebd0817c636045ae080659a (diff) | |
download | poky-f941dad9d723ead66b88b9905c40c4fbe7002936.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.
(From OE-Core rev: d035fd394fd2747ab4b75867af6123f3efb1990f)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/debuginfod.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/debuginfod.py | 44 |
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 | # | ||
6 | import os | ||
7 | import socketserver | ||
8 | import subprocess | ||
9 | |||
10 | from oeqa.selftest.case import OESelftestTestCase | ||
11 | from oeqa.utils.commands import bitbake, get_bb_var, runqemu | ||
12 | |||
13 | class Debuginfod(OESelftestTestCase): | ||
14 | def test_debuginfod(self): | ||
15 | self.write_config(""" | ||
16 | DISTRO_FEATURES:append = " debuginfod" | ||
17 | CORE_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() | ||