Openembedded Core Discussions
 help / color / mirror / Atom feed
From: AdrianF <adrian.freihofer@siemens.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH v2 04/14] oe-selftest: devtool: check example services are running
Date: Wed, 31 Dec 2025 12:46:34 +0100	[thread overview]
Message-ID: <20251231114718.4031606-5-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20251231114718.4031606-1-adrian.freihofer@siemens.com>

From: Adrian Freihofer <adrian.freihofer@siemens.com>

When running the devtool ide-sdk test with qemu, verify that the example
services are actually running on the target by using pgrep to check for
the example executable names.

Also verify that the configuration files in /etc are owned by the proper
user and group, both before and after the install_and_deploy scripts
have run. This is also a check that the install_and_deploy scripts
are working correctly with pseudo.

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

diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 681dcee08c..e78e6ed226 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -2810,6 +2810,22 @@ class DevtoolIdeSdkTests(DevtoolBase):
         self.assertIn("Running tests...", result.output)
         self.assertIn("100% tests passed", result.output)
 
+    def _verify_service_running(self, qemu, service_name):
+        """Helper to verify a service is running in Qemu"""
+        status, output = qemu.run("pgrep %s" % service_name)
+        self.assertEqual(status, 0, msg="%s service not running: %s" %
+                         (service_name, output))
+        self.assertTrue(output.strip().isdigit(),
+                        f"pgrep output should be a PID integer, got: {output.strip()}")
+
+    def _verify_conf_file(self, qemu, conf_file, owner, group):
+        """Helper to verify a configuration file is owned by the proper user and group"""
+        ls_cmd = "ls -l %s" % conf_file
+        status, output = qemu.run(ls_cmd)
+        self.assertEqual(status, 0, msg="Failed to ls %s: %s" % (conf_file, output))
+        self.assertRegex(output, rf"^-.+ {owner} {group} .+ {re.escape(conf_file)}$",
+                         msg="%s not owned by %s:%s: %s" % (conf_file, owner, group, output))
+
     @OETestTag("runqemu")
     def test_devtool_ide_sdk_none_qemu(self):
         """Start qemu-system and run tests for multiple recipes. ide=none is used."""
@@ -2826,7 +2842,16 @@ class DevtoolIdeSdkTests(DevtoolBase):
             # cmake-example recipe
             recipe_name = "cmake-example"
             example_exe = "cmake-example"
+            example_user_group = "cmake-example"
+            conf_file = "/etc/cmake-example.conf"
             build_file = "CMakeLists.txt"
+
+            # Verify the cmake-example service is running on the target
+            self._verify_service_running(qemu, example_exe)
+            # Verify /etc/cmake-example.conf is owned by the cmake-example user
+            self._verify_conf_file(qemu, conf_file, example_user_group, example_user_group)
+
+            # Setup the recipe with devtool ide-sdk cmake-example ...
             tempdir = self._devtool_ide_sdk_recipe(
                 recipe_name, build_file, testimage)
             bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % (
@@ -2835,14 +2860,29 @@ class DevtoolIdeSdkTests(DevtoolBase):
             self._gdb_cross()
             self._verify_cmake_preset(tempdir)
             self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe)
+
             # Verify the oe-scripts sym-link is valid
             self.assertEqual(self._workspace_scripts_dir(
                 recipe_name), self._sources_scripts_dir(tempdir))
 
+            # Verify /etc/meson-example.conf is still owned by the cmake-example user
+            # after the install and deploy scripts updated the file
+            self._verify_conf_file(qemu, conf_file, example_exe, example_exe)
+
+
             # meson-example recipe
             recipe_name = "meson-example"
             example_exe = "mesonex"
+            example_user_group = "meson-example"
+            conf_file = "/etc/meson-example.conf"
             build_file = "meson.build"
+
+            # Verify the meson-example service is running on the target
+            self._verify_service_running(qemu, example_exe)
+            # Verify /etc/meson-example.conf is owned by the meson-example user
+            self._verify_conf_file(qemu, conf_file, example_user_group, example_user_group)
+
+            # Setup the recipe with devtool ide-sdk meson-example ...
             tempdir = self._devtool_ide_sdk_recipe(
                 recipe_name, build_file, testimage)
             bitbake_sdk_cmd = 'devtool ide-sdk %s %s -t root@%s -c --ide=none' % (
@@ -2850,10 +2890,15 @@ class DevtoolIdeSdkTests(DevtoolBase):
             runCmd(bitbake_sdk_cmd, output_log=self._cmd_logger)
             self._gdb_cross()
             self._devtool_ide_sdk_qemu(tempdir, qemu, recipe_name, example_exe)
+
             # Verify the oe-scripts sym-link is valid
             self.assertEqual(self._workspace_scripts_dir(
                 recipe_name), self._sources_scripts_dir(tempdir))
 
+            # Verify /etc/meson-example.conf is still owned by the meson-example user
+            # after the install and deploy scripts updated the file
+            self._verify_conf_file(qemu, conf_file, example_user_group, example_user_group)
+
     def test_devtool_ide_sdk_code_cmake(self):
         """Verify a cmake recipe works with ide=code mode"""
         recipe_name = "cmake-example"
-- 
2.52.0



  parent reply	other threads:[~2025-12-31 11:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-31 11:46 [PATCH v2 00/14] IDE SDK Improvements AdrianF
2025-12-31 11:46 ` [PATCH v2 01/14] devtool: ide-sdk find bitbake-setup init-build-env AdrianF
2025-12-31 11:46 ` [PATCH v2 02/14] oe-selftest: devtool: DevtoolIdeSdkTests debug logging AdrianF
2025-12-31 11:46 ` [PATCH v2 03/14] cpp-example: run as a service AdrianF
2025-12-31 11:46 ` AdrianF [this message]
2025-12-31 11:46 ` [PATCH v2 05/14] devtool: ide-sdk: add gdbserver attach mode support AdrianF
2025-12-31 11:46 ` [PATCH v2 06/14] devtool: ide-sdk: move code to ide_none AdrianF
2025-12-31 11:46 ` [PATCH v2 07/14] devtool: ide-sdk: make install_and_deploy script pass target arg AdrianF
2025-12-31 11:46 ` [PATCH v2 08/14] devtool: ide-sdk: vscode replace scripts AdrianF
2025-12-31 11:46 ` [PATCH v2 09/14] oe-selftest: devtool ide-sdk cover vscode remote debugging AdrianF
2025-12-31 11:46 ` [PATCH v2 10/14] devtool: ide-sdk: evaluate DEBUG_PREFIX_MAP AdrianF
2025-12-31 11:46 ` [PATCH v2 11/14] cpp-example: Add std::vector example AdrianF
2025-12-31 11:46 ` [PATCH v2 12/14] devtool: ide-sdk: Support GDB pretty-printing for C++ STL types AdrianF
2025-12-31 11:46 ` [PATCH v2 13/14] oe-selftest: devtool: add test for gdb pretty-printing AdrianF
2026-01-02 14:44   ` [OE-core] " Mathieu Dubois-Briand
2025-12-31 11:46 ` [PATCH v2 14/14] oe-selftest: devtool: add compile step in ide-sdk tests AdrianF
2026-01-13  8:17 ` [OE-core] [PATCH v2 00/14] IDE SDK Improvements Antonin Godard
2026-01-14 18:37   ` adrian.freihofer
2026-01-20 11:59     ` Antonin Godard
2026-01-26  7:47       ` adrian.freihofer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251231114718.4031606-5-adrian.freihofer@siemens.com \
    --to=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox