]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oeqa/selftest/debuginfod: don't re-use the database
authorRoss Burton <ross.burton@arm.com>
Thu, 8 Sep 2022 11:54:15 +0000 (12:54 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 9 Sep 2022 11:24:44 +0000 (12:24 +0100)
debuginfod writes the files it scans to a database in $HOME, which isn't
ideal when the build trees that get scanned typically are deleted after
the test has finished. This can result in debuginfod trying to return
objects that no longer exist on disk:

libc error: stat /home/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1032306/tmp/deploy/rpm/core2_64/elfutils-dbg-0.187-r0.core2_64.rpm: No such file or directory
libc error: stat /home/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1113320/tmp/deploy/rpm/core2_64/elfutils-dbg-0.187-r0.core2_64.rpm: No such file or directory
libc error: stat /home/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-1113320/tmp/deploy/rpm/core2_64/elfutils-dbg-0.187-r0.core2_64.rpm: No such file or directory

Solve this, and save writing a database on disk at all, by using the
special database path :memory: which keeps the database in memory only,
so state can't leak between tests.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/debuginfod.py

index 01359ec64998b76ce7ffbf91c663ca3663be060c..3c401192829865aa5264cf220cb9fa1cb3a7a1ac 100644 (file)
@@ -10,16 +10,24 @@ 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("""
+        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")]
+        cmd = [
+            os.path.join(native_sysroot, "usr", "bin", "debuginfod"),
+            "--verbose",
+            "--database=:memory:",
+            get_bb_var("DEPLOY_DIR"),
+        ]
         for format in get_bb_var("PACKAGE_CLASSES").split():
             if format == "package_deb":
                 cmd.append("--scan-deb-dir")
@@ -36,7 +44,10 @@ CORE_IMAGE_EXTRA_INSTALL += "elfutils"
             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)
+                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)