diff mbox series

[2/2] oe-selftest: devtool: do not add ide-sdk test kits to the user's CMake kits

Message ID 20261025200949.1757990-2-adrian.freihofer@siemens.com
State New
Headers show
Series [1/2] devtool: ide-sdk: honor XDG_DATA_HOME for the CMake kits | expand

Commit Message

AdrianF Oct. 25, 2026, 8:09 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

The shared sysroot test of devtool ide-sdk adds a cmake-kit with the path
of the temporary test build directory to ~/.local/share/CMakeTools. Every
test run adds another stale kit, which is never removed again. Use a
temporary XDG_DATA_HOME for the test, and verify that the kit is added
there.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/lib/oeqa/selftest/cases/devtool.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index b848623a6e..e95de98e80 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -4564,9 +4564,14 @@  class DevtoolIdeSdkSharedTests(DevtoolIdeSdkTests):
         # Handle the workspace (which is not needed by this test case)
         self._check_workspace()
 
+        # Do not add a cmake-kit to the kits of the user
+        xdg_data_home = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(xdg_data_home)
+        ide_env = dict(os.environ, XDG_DATA_HOME=xdg_data_home)
+
         result_init = runCmd(
             'devtool ide-sdk -m shared oe-selftest-image cmake-example meson-example --ide=code',
-            output_log=self._cmd_logger)
+            output_log=self._cmd_logger, env=ide_env)
         bb_vars = get_bb_vars(
             ['REAL_MULTIMACH_TARGET_SYS', 'DEPLOY_DIR_IMAGE', 'COREBASE'], "meta-ide-support")
         environment_script = 'environment-setup-%s' % bb_vars['REAL_MULTIMACH_TARGET_SYS']
@@ -4578,6 +4583,11 @@  class DevtoolIdeSdkSharedTests(DevtoolIdeSdkTests):
         # Verify the cross environment script is available
         self.assertExists(environment_script_path)
 
+        # Verify the cmake-kit is added to the location where CMake Tools looks for it
+        with open(os.path.join(xdg_data_home, 'CMakeTools', 'cmake-tools-kits.json')) as f:
+            kits = json.load(f)
+        self.assertEqual([kit['environmentSetupScript'] for kit in kits], [environment_script_path])
+
         def runCmdEnv(cmd, cwd, output_log=self._cmd_logger):
             cmd = '/bin/sh -c ". %s > /dev/null && %s"' % (
                 environment_script_path, cmd)