After a source edit, run the ordered Cargo build/install/deploy tasks and
verify the changed Fibonacci result. Use a helper to shift source lines so
the breakpoint location can change without hard-coded line numbers; reuse
the shared LLDB runner for both debug sessions.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Enguerrand de Ribaucourt 
<[email protected]>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py 
b/meta/lib/oeqa/selftest/cases/devtool.py
index 87dc8a1ee5..b9adb624c4 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -3147,6 +3147,15 @@ class DevtoolIdeSdkTests(DevtoolBase):
                     return lineno
         self.fail("Could not find marker %r in %s" % (marker, source_path))
 
+    def _insert_source_line_shift(self, source_path, marker, line_count):
+        with open(source_path) as source_handle:
+            source = source_handle.read()
+        self.assertEqual(source.count(marker), 1)
+        inserted_lines = ''.join(
+            '    // line shift %d\n' % index for index in range(line_count))
+        with open(source_path, 'w') as source_handle:
+            source_handle.write(source.replace(marker, inserted_lines + 
marker, 1))
+
     def _find_multi_script_port(self, recipe_name, script_prefix, example_exe):
         """Discover the port assigned to a generated 'multi' mode debug-server
         script (gdbserver_*/lldb_server_*), since each --ide plugin allocates
@@ -4511,6 +4520,28 @@ class DevtoolIdeSdkRustTests(DevtoolIdeSdkTests):
                 'Repeated ide-sdk runs must preserve the Cargo source remap')
             self._verify_rust_lldb_debugging(tempdir, expected_input=4)
 
+            main_rs = os.path.join(tempdir, 'src', 'main.rs')
+            self._insert_source_line_shift(main_rs, '    match n {', 4)
+            with open(main_rs) as source_file:
+                shifted_source = source_file.read()
+            self.assertEqual(shifted_source.count('fibonacci(4)'), 1)
+            with open(main_rs, 'w') as source_file:
+                source_file.write(
+                    shifted_source.replace('fibonacci(4)', 'fibonacci(5)', 1))
+
+            with open(os.path.join(tempdir, '.vscode', 'tasks.json')) as 
tasks_file:
+                tasks = json.load(tasks_file)['tasks']
+            install_task = next(
+                task for task in tasks
+                if task['label'].startswith('install && deploy-target '))
+            task_results = self._run_vscode_task_with_dependencies(
+                tempdir, install_task['label'])
+            self.assertTrue(
+                any('Compiling cargo-example' in result.output
+                    for result in task_results),
+                'Cargo build task did not recompile the modified Rust source')
+            self._verify_rust_lldb_debugging(tempdir, expected_input=5)
+
     def _verify_rust_lldb_debugging(self, tempdir, expected_input):
         with open(os.path.join(tempdir, '.vscode', 'launch.json')) as 
launch_file:
             launch = json.load(launch_file)['configurations'][0]

-- 
2.53.0

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

Reply via email to