Openembedded Core Discussions
 help / color / mirror / Atom feed
From: AdrianF <adrian.freihofer@siemens.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH v2 07/14] oe-selftest: devtool ide-sdk: add real debug coverage for meson+code
Date: Tue,  4 Aug 2026 13:59:31 +0200	[thread overview]
Message-ID: <20260804120034.378787-8-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20260804120034.378787-1-adrian.freihofer@siemens.com>

From: Adrian Freihofer <adrian.freihofer@siemens.com>

test_devtool_ide_sdk_code_meson never booted qemu-system (missing
@OETestTag("runqemu") and runqemu()), passed a hardcoded, non-existent
target address (root@192.168.17.17), and only checked _gdb_cross()
(gdb-cross --version). It never validated the generated launch.json
nor performed an actual remote debugging session, unlike its cmake
sibling test_devtool_ide_sdk_code_cmake.

Bring it to parity with test_devtool_ide_sdk_code_cmake: boot
qemu-system, use the real qemu.ip as target address, and call
_verify_launch_json() plus _verify_launch_json_debugging() to exercise
a genuine gdbserver-based debug session through the generated
launch.json/tasks.json. This closes the last gap in the 2x2 matrix of
build system (cmake/meson) x ide mode (code/none): all four
combinations now have real breakpoint-debugging coverage.

_verify_launch_json_debugging() matched the 'once' debug configuration
by looking for "usr-bin-{recipe_name}_once" in its name. But the
config name is derived from the binary's install path, so it is
"usr-bin-{example_exe}_once". This happened to work for cmake-example,
where the binary name equals the recipe name, but not for
meson-example, whose recipe name is 'meson-example' while the
installed binary is 'mesonex'. Match on example_exe instead, and drop
the now-unused recipe_name parameter.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 83 +++++++++++++++----------
 1 file changed, 50 insertions(+), 33 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index dbcb05022a..3b24ce3914 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -3395,7 +3395,7 @@ class DevtoolIdeSdkTests(DevtoolBase):
         self.assertEqual(len(once_configs), 2, f"Should have two once configuration, found: {once_configs}")
         self.assertEqual(len(attach_configs), 1, f"Should have one attach configuration, found: {attach_configs}")
 
-    def _verify_launch_json_debugging(self, tempdir, qemu, recipe_name, example_exe):
+    def _verify_launch_json_debugging(self, tempdir, qemu, example_exe):
         """Verify remote debugging and deployment works using launch.json configurations
 
         This method tests the VSCode debug configurations by:
@@ -3434,15 +3434,19 @@ class DevtoolIdeSdkTests(DevtoolBase):
         tasks = tasks_d["tasks"]
 
         # Test one configuration for remote debugging
+        # The config name is derived from the binary's install path
+        # (e.g. "usr-bin-<example_exe>"), which is not necessarily the same
+        # as the recipe name (e.g. meson-example installs a binary named
+        # "mesonex").
         once_config_count = 0
         for config in configurations:
-            if f"usr-bin-{recipe_name}_once" in config["name"]:
+            if f"usr-bin-{example_exe}_once" in config["name"]:
                 once_config_count += 1
                 self._verify_launch_config(tempdir, config, tasks, qemu, example_exe,
                                            self._gdb_debug_cpp_example, self._gdb_debug_cpp_example_check)
             # It works but is not 100% reliable in VSCode
             # This one: https://github.com/microsoft/vscode-cpptools/issues/4243 ?
-            # elif f"usr-bin-{recipe_name}_attach" in config["name"]
+            # elif f"usr-bin-{example_exe}_attach" in config["name"]
             #     self._verify_launch_config(tempdir, config, tasks, qemu, example_exe)
             else:
                 continue
@@ -3569,51 +3573,64 @@ class DevtoolIdeSdkTests(DevtoolBase):
             self._verify_launch_json(tempdir)
 
             # Verify deployment and remote debugging works
-            self._verify_launch_json_debugging(tempdir, qemu, recipe_name, example_exe)
+            self._verify_launch_json_debugging(tempdir, qemu, example_exe)
 
+    @OETestTag("runqemu")
     def test_devtool_ide_sdk_code_meson(self):
         """Verify a meson recipe works with ide=code mode"""
         recipe_name = "meson-example"
+        example_exe = "mesonex"
         build_file = "meson.build"
         testimage = "oe-selftest-image"
 
         self._check_workspace()
         self._write_bb_config([recipe_name])
-        tempdir = self._devtool_ide_sdk_recipe(
-            recipe_name, build_file, testimage)
-        bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@192.168.17.17 -c --ide=code' % (
-            recipe_name, testimage)
-        runCmd(bitbake_sdk_cmd, output_log=self._cmd_logger)
 
-        with open(os.path.join(tempdir, '.vscode', 'settings.json')) as settings_j:
-            settings_d = json.load(settings_j)
-        meson_exe = settings_d["mesonbuild.mesonPath"]
-        meson_build_folder = settings_d["mesonbuild.buildFolder"]
+        # Verify deployment to Qemu (system mode) works
+        self._check_runqemu_prerequisites()
+        bitbake(testimage)
+        with runqemu(testimage, runqemuparams="nographic") as qemu:
+            tempdir = self._devtool_ide_sdk_recipe(
+                recipe_name, build_file, testimage)
+            bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=code' % (
+                recipe_name, testimage, qemu.ip)
+            runCmd(bitbake_sdk_cmd, output_log=self._cmd_logger)
 
-        # Verify the wrapper for meson native is available
-        self.assertExists(meson_exe)
+            with open(os.path.join(tempdir, '.vscode', 'settings.json')) as settings_j:
+                settings_d = json.load(settings_j)
+            meson_exe = settings_d["mesonbuild.mesonPath"]
+            meson_build_folder = settings_d["mesonbuild.buildFolder"]
 
-        # Verify meson re-uses the o files compiled by bitbake
-        result = runCmd('%s compile -C  %s' %
-                        (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
-        self.assertIn("ninja: no work to do.", result.output)
+            # Verify the wrapper for meson native is available
+            self.assertExists(meson_exe)
 
-        # Verify the unit tests work (in Qemu)
-        runCmd('%s test -C %s' % (meson_exe, meson_build_folder), cwd=tempdir,
-               output_log=self._cmd_logger)
+            # Verify meson re-uses the o files compiled by bitbake
+            result = runCmd('%s compile -C  %s' %
+                            (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
+            self.assertIn("ninja: no work to do.", result.output)
 
-        # Verify re-building and testing works again
-        result = runCmd('%s compile -C  %s --clean' %
-                        (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
-        self.assertIn("Cleaning...", result.output)
-        result = runCmd('%s compile -C  %s' %
-                        (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
-        self.assertIn("Linking target", result.output)
-        runCmd('%s test -C %s' % (meson_exe, meson_build_folder), cwd=tempdir,
-               output_log=self._cmd_logger)
+            # Verify the unit tests work (in Qemu user mode)
+            runCmd('%s test -C %s' % (meson_exe, meson_build_folder), cwd=tempdir,
+                   output_log=self._cmd_logger)
 
-        self._verify_install_script_code(tempdir,  recipe_name)
-        self._gdb_cross()
+            # Verify re-building and testing works again
+            result = runCmd('%s compile -C  %s --clean' %
+                            (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
+            self.assertIn("Cleaning...", result.output)
+            result = runCmd('%s compile -C  %s' %
+                            (meson_exe, meson_build_folder), cwd=tempdir, output_log=self._cmd_logger)
+            self.assertIn("Linking target", result.output)
+            runCmd('%s test -C %s' % (meson_exe, meson_build_folder), cwd=tempdir,
+                   output_log=self._cmd_logger)
+
+            self._verify_install_script_code(tempdir,  recipe_name)
+            self._gdb_cross()
+
+            # Verify the launch.json file created is valid
+            self._verify_launch_json(tempdir)
+
+            # Verify deployment and remote debugging works
+            self._verify_launch_json_debugging(tempdir, qemu, example_exe)
 
     @OETestTag("runqemu")
     def test_devtool_ide_sdk_code_kernel_module(self):
-- 
2.55.0



  parent reply	other threads:[~2026-08-04 12:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 11:59 [PATCH v2 00/14] devtool ide-sdk: clang and lldb support AdrianF
2026-08-04 11:59 ` [PATCH v2 01/14] oe-selftest: devtool: use stat for reading user/group names in ide-sdk tests AdrianF
2026-08-04 11:59 ` [PATCH v2 02/14] devtool: ide-sdk: fix duplicate -p flag in _target_ssh_args AdrianF
2026-08-04 11:59 ` [PATCH v2 03/14] devtool: ide-sdk: fix $@ overwritten by set in install_and_deploy script AdrianF
2026-08-04 11:59 ` [PATCH v2 04/14] devtool: ide-sdk: fix meson compile_commands.json AdrianF
2026-08-04 11:59 ` [PATCH v2 05/14] devtool: deploy-target: fix run strip under pseudo AdrianF
2026-08-04 11:59 ` [PATCH v2 06/14] oe-selftest: devtool ide-sdk: cover breakpoints in exe, header and library AdrianF
2026-08-04 11:59 ` AdrianF [this message]
2026-08-04 11:59 ` [PATCH v2 08/14] devtool: ide-sdk debugger back-end abstraction AdrianF
2026-08-04 11:59 ` [PATCH v2 09/14] devtool: ide-sdk: wait for gdbserver port before returning AdrianF
2026-08-04 11:59 ` [PATCH v2 10/14] devtool: ide-sdk add LLDB support for clang toolchain AdrianF
2026-08-04 11:59 ` [PATCH v2 11/14] devtool: ide-sdk: add LLDB support for ide=none (clang toolchain) AdrianF
2026-08-04 11:59 ` [PATCH v2 12/14] meta-selftest: refactor cpp examples into .inc files and add clang variants AdrianF
2026-08-04 11:59 ` [PATCH v2 13/14] oe-selftest: devtool ide-sdk: add clang/LLDB test AdrianF
2026-08-07 15:11   ` [OE-core] " Mathieu Dubois-Briand
2026-08-07 15:17     ` Freihofer, Adrian
2026-08-07 15:44       ` Mathieu Dubois-Briand
2026-08-09  9:46         ` adrian.freihofer
2026-08-04 11:59 ` [PATCH v2 14/14] oe-selftest: devtool ide-sdk: add test for ide=none LLDB/clang support AdrianF

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804120034.378787-8-adrian.freihofer@siemens.com \
    --to=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox