diff mbox series

[18/20] oeqa/selftest: run IDE tasks with configured environment

Message ID 20261026-devtool-ide-sdk-cargo-v1-18-d4504e124d07@savoirfairelinux.com
State New
Headers show
Series devtool: ide-sdk: add support for Rust recipes | expand

Commit Message

Enguerrand de Ribaucourt Oct. 26, 2026, 8:55 a.m. UTC
Apply each generated shell task's options.env and return its runCmd results.
Cargo build tasks intentionally keep only the SDK PATH, and the following
rebuild integration test needs both to execute and inspect that task.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 99e6531877..114536fc16 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -3485,6 +3485,7 @@  class DevtoolIdeSdkTests(DevtoolBase):
         self.assertIn(task_label, task_by_label,
                       "Task '%s' not found in tasks.json" % task_label)
 
+        task_results = []
         ran = set()
 
         def run_task(label, execute_task):
@@ -3509,14 +3510,20 @@  class DevtoolIdeSdkTests(DevtoolBase):
                         args = [args]
                     task_cmd = [command] + [str(arg) for arg in args]
 
-                    task_cwd = task.get('options', {}).get('cwd', tempdir)
+                    task_options = task.get('options', {})
+                    task_cwd = task_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)
+                    task_env = os.environ.copy()
+                    task_env.update(task_options.get('env', {}))
+                    task_results.append(runCmd(
+                        task_cmd, cwd=task_cwd, env=task_env,
+                        output_log=self._cmd_logger))
 
             ran.add(label)
 
         run_task(task_label, run_main_task)
+        return task_results
 
     def _ide_sdk_package_opts(self):
         """Extra `devtool ide-sdk --package` options. Override to scope packages."""