diff mbox series

[22/24] oe-selftest: devtool ide-sdk: test install task

Message ID 20260830142922.17241-23-adrian.freihofer@siemens.com
State New
Headers show
Series devtool: ide-sdk: NFS/slirp support, deploy filtering, and robustness fixes | expand

Commit Message

AdrianF Aug. 30, 2026, 2:28 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Verify that the ide-sdk setup generates the do_install task script and that
the script runs successfully. This covers the prepared-task runner used by
the IDE deployment workflow without requiring Qemu.

Replace the ad-hoc dependsOn handling in _verify_launch_config() with a
new helper that mirrors VS Code's task dependency resolution and
execution order. This ensures that the selftest runs the same sequence
of tasks as VS Code would, including compile and install/deploy
prerequisites, before starting the debug server. This also aligns the
gdb and lldb selftest paths to avoid behavior drift and improve test
reliability.
---
 meta/lib/oeqa/selftest/cases/devtool.py | 86 ++++++++++++++++++++-----
 1 file changed, 70 insertions(+), 16 deletions(-)

Comments

patchtest@automation.yoctoproject.org Aug. 30, 2026, 2:56 p.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/22-24-oe-selftest-devtool-ide-sdk-test-install-task.patch

FAIL: test Signed-off-by presence: Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s" (test_mbox.TestMbox.test_signed_off_by_presence)

PASS: pretest pylint (test_python_pylint.PyLint.pretest_pylint)
PASS: test auh changelog truncation notice (test_mbox.TestMbox.test_auh_changelog_truncation_notice)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test pylint (test_python_pylint.PyLint.test_pylint)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new source patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new source patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new source patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 35f2aa2e6c..c05cf7bc82 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -3116,7 +3116,7 @@  class DevtoolIdeSdkTests(DevtoolBase):
         """Verify the scripts referred by the tasks.json file are fine.
 
         This function does not depend on Qemu. Therefore it verifies the scripts
-        exists and the delete step works as expected. But it does not try to
+        exists and the install step works as expected. But it does not try to
         deploy to Qemu.
         """
         recipe_id, recipe_id_pretty = self._get_recipe_ids(recipe_name)
@@ -3134,6 +3134,11 @@  class DevtoolIdeSdkTests(DevtoolBase):
         i_and_d_script_path = os.path.join(
             self._workspace_scripts_dir(recipe_name), i_and_d_script)
         self.assertExists(i_and_d_script_path)
+        install_script = 'bb_run_do_install_' + recipe_id
+        install_script_path = os.path.join(
+            self._workspace_scripts_dir(recipe_name), install_script)
+        self.assertExists(install_script_path)
+        runCmd(install_script_path, cwd=tempdir, output_log=self._cmd_logger)
 
         deploy_script_path = os.path.join(
             self._workspace_scripts_dir(recipe_name), 'deploy_target_' + recipe_id)
@@ -3368,6 +3373,60 @@  class DevtoolIdeSdkTests(DevtoolBase):
         self.assertEqual(actual_group, group,
                          msg="%s not owned by group %s: got %s" % (conf_file, group, actual_group))
 
+    def _run_vscode_task_with_dependencies(self, tempdir, task_label, run_main_task=True):
+        """Run a VS Code shell task and its dependsOn chain.
+
+        The helper mirrors VS Code task dependency ordering for selftests, so
+        preLaunchTask prerequisites (e.g. compile and do_install/deploy tasks)
+        run before the debug server task.
+        """
+        tasks_path = os.path.join(tempdir, '.vscode', 'tasks.json')
+        self.assertExists(tasks_path, 'tasks.json not found at %s' % tasks_path)
+
+        with open(tasks_path) as tasks_j:
+            tasks_d = json.load(tasks_j)
+
+        task_by_label = {
+            task.get('label'): task
+            for task in tasks_d.get('tasks', [])
+            if task.get('label')
+        }
+        self.assertIn(task_label, task_by_label,
+                      "Task '%s' not found in tasks.json" % task_label)
+
+        ran = set()
+
+        def run_task(label, execute_task):
+            if label in ran:
+                return
+
+            task = task_by_label[label]
+            deps = task.get('dependsOn', [])
+            if isinstance(deps, str):
+                deps = [deps]
+
+            for dep in deps:
+                self.assertIn(dep, task_by_label,
+                              "DependsOn task '%s' not found in tasks.json" % dep)
+                run_task(dep, True)
+
+            if execute_task:
+                command = task.get('command')
+                if command:
+                    args = task.get('args', [])
+                    if not isinstance(args, list):
+                        args = [args]
+                    task_cmd = [command] + [str(arg) for arg in args]
+
+                    task_cwd = task.get('options', {}).get('cwd', tempdir)
+                    if isinstance(task_cwd, str):
+                        task_cwd = task_cwd.replace('${workspaceFolder}', tempdir)
+                    runCmd(task_cmd, cwd=task_cwd, output_log=self._cmd_logger)
+
+            ran.add(label)
+
+        run_task(task_label, run_main_task)
+
 
 class DevtoolIdeSdkGccTests(DevtoolIdeSdkTests):
 
@@ -3853,21 +3912,10 @@  class DevtoolIdeSdkGccTests(DevtoolIdeSdkTests):
             (task for task in tasks if task["label"] == prelaunch_task_name), None)
         self.assertIsNotNone(prelaunch_task, f"PreLaunchTask '{prelaunch_task_name}' not found in tasks.json")
 
-        # Find the dependsOn task if exists (install and deploy-target)
-        if "dependsOn" in prelaunch_task:
-            depends_task_names = prelaunch_task["dependsOn"]
-            for depends_task_name in depends_task_names:
-                depends_task = next(
-                    (task for task in tasks if task["label"] == depends_task_name), None)
-                self.assertIsNotNone(depends_task, f"DependsOn task '{depends_task_name}' not found in tasks.json")
-                # For simplicity, we assume the dependsOn task is a prerequisite and does not affect the main command
-                self.logger.debug(f"PreLaunchTask '{prelaunch_task_name}' depends on '{depends_task_name}'")
-
-                # Extract command details from dependsOn task
-                depends_task_command = depends_task["command"]
-                depends_task_args = depends_task.get("args", [])
-                self.logger.debug(f"Would execute dependsOn task: {depends_task_command} {' '.join(depends_task_args)}")
-                runCmd(f"{depends_task_command} {' '.join(depends_task_args)}", output_log=self._cmd_logger)
+        # Execute preLaunchTask prerequisites exactly like VS Code dependsOn
+        # handling, but keep starting the debug server in this method.
+        self._run_vscode_task_with_dependencies(
+            tempdir, prelaunch_task_name, run_main_task=False)
 
         # Verify task structure and extract command details
         self.assertEqual(prelaunch_task["type"], "shell", f"Task '{prelaunch_task_name}' should be shell type")
@@ -4635,6 +4683,12 @@  class DevtoolIdeSdkClangTests(DevtoolIdeSdkTests):
         self.assertIsNotNone(prelaunch_task,
                              "preLaunchTask '%s' not found in tasks.json" % prelaunch_task_name)
 
+        # Run compile/install/deploy prerequisites exactly as VS Code would,
+        # but keep starting the debug server itself in this method so we can
+        # retain explicit readiness handling and diagnostics.
+        self._run_vscode_task_with_dependencies(
+            tempdir, prelaunch_task_name, run_main_task=False)
+
         # Extract the SSH command and start lldb-server on the target
         task_command = prelaunch_task["command"]
         task_args = prelaunch_task["args"]