From: Adrian Freihofer <[email protected]>

Add test_devtool_ide_sdk_none_qemu_slirp which verifies the complete
devtool ide-sdk workflow using runqemu slirp networking instead of TAP
devices.

The test checks that:
  - update_qb_slirp_opt() writes QB_SLIRP_OPT (including the SSH
    hostfwd entry) to the image workspace bbappend before the build.
  - The image boots in runqemu slirp mode (no TAP device setup needed).
  - devtool deploy-target successfully reaches the target via the slirp
    SSH port forward (localhost:2222 by default).
  - The full edit/compile/deploy/verify cycle works over the slirp
    connection, just as it does in the TAP-based tests.

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 50 +++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py 
b/meta/lib/oeqa/selftest/cases/devtool.py
index 1ecf4c24f5..c18b94ab5a 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -3864,6 +3864,56 @@ class DevtoolIdeSdkGccTests(DevtoolIdeSdkTests):
             # Verify deployment and remote debugging works
             self._verify_launch_json_debugging(tempdir, qemu, example_exe)
 
+    @OETestTag("runqemu")
+    def test_devtool_ide_sdk_none_qemu_slirp(self):
+        """Verify devtool ide-sdk works with runqemu slirp networking.
+
+        Slirp mode uses SSH port forwarding (default: localhost:2222 -> 
guest:22).
+        This test checks that:
+          - update_qb_slirp_opt() writes the QB_SLIRP_OPT host-forwarding
+            entries to the image workspace bbappend before the build.
+          - runqemu boots the image in slirp mode.
+          - devtool deploy-target reaches the target via localhost:2222.
+        """
+        recipe_name = "cmake-example"
+        build_file = "CMakeLists.txt"
+        testimage = "oe-selftest-image"
+
+        self._check_workspace()
+        self._write_bb_config()
+
+        # devtool modify and build image; QB_SLIRP_OPT is written to the 
bbappend.
+        tempdir = self._devtool_ide_sdk_recipe(recipe_name, build_file, None)
+        runCmd('devtool ide-sdk %s %s -c --ide=none' % (recipe_name, 
testimage),
+               output_log=self._cmd_logger)
+
+        # Verify QB_SLIRP_OPT was written to the workspace bbappend.
+        appends_dir = os.path.join(self.workspacedir, 'appends')
+        bbappend = os.path.join(appends_dir, testimage + '.bbappend')
+        self.assertExists(bbappend, 'Image bbappend not created at %s' % 
bbappend)
+        with open(bbappend) as f:
+            bbappend_content = f.read()
+        self.assertIn('QB_SLIRP_OPT', bbappend_content,
+                      'QB_SLIRP_OPT not written to image bbappend')
+        self.assertIn('hostfwd=tcp:127.0.0.1:2222-:22', bbappend_content,
+                      'SSH slirp port forward missing from QB_SLIRP_OPT')
+
+        with runqemu(testimage, runqemuparams="nographic slirp") as qemu:
+            slirp_host = qemu.ip
+            slirp_port = qemu.port or '2222'
+
+            # Re-run ide-sdk with the actual slirp address; image is already 
built.
+            bitbake_sdk_cmd = (
+                'devtool ide-sdk %s %s -t root@%s -P %s --skip-bitbake 
--ide=none'
+                % (recipe_name, testimage, slirp_host, slirp_port))
+            runCmd(bitbake_sdk_cmd, output_log=self._cmd_logger)
+
+            self._gdb_cross()
+            compile_cmd = self._verify_cmake_preset(tempdir)
+            self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name,
+                                        recipe_name, compile_cmd)
+
+
 class DevtoolIdeSdkKernelTests(DevtoolIdeSdkTests):
 
     @OETestTag("runqemu")
-- 
2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244717): 
https://lists.openembedded.org/g/openembedded-core/message/244717
Mute This Topic: https://lists.openembedded.org/mt/121005252/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to