diff mbox series

selftest/glibc: add docstrings to the selftest classes

Message ID 20260308151507.185124-1-adrian.freihofer@siemens.com
State Under Review
Headers show
Series selftest/glibc: add docstrings to the selftest classes | expand

Commit Message

AdrianF March 8, 2026, 3:15 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Add docstrings to GlibcSelfTest classes and comments to the
glibc-testsuite recipe explaining how this test concept works.

This commit does not change the code itself.

Related [Yocto #16113]

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/lib/oeqa/selftest/cases/glibc.py         | 30 +++++++++++++++++
 .../glibc/glibc-testsuite_2.42.bb             | 32 +++++++++++++++++++
 2 files changed, 62 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/glibc.py b/meta/lib/oeqa/selftest/cases/glibc.py
index b2b115972f..a65afb1367 100644
--- a/meta/lib/oeqa/selftest/cases/glibc.py
+++ b/meta/lib/oeqa/selftest/cases/glibc.py
@@ -20,6 +20,36 @@  def parse_values(content):
                 break
 
 class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
+    """
+    Base class for running the glibc test suite (bitbake glibc-testsuite -c check).
+
+    The glibc-testsuite recipe cross-compiles the glibc tests, which are then
+    executed via Autotools' make check. The check-test-wrapper script dispatches
+    each individual test to either QEMU user-space emulation or a remote SSH
+    target, depending on TOOLCHAIN_TEST_TARGET. For more details see the
+    do_check task of the glibc-testsuite recipe.
+
+    Unlike ptests, the glibc tests are not installed via do_install but instead
+    run in-place directly from the build directory (B). This is true for both
+    execution modes implemented by this base class via run_check():
+
+    User-space mode (ssh=None):
+        TOOLCHAIN_TEST_TARGET is left at its default ("user"), so
+        check-test-wrapper runs each test binary under QEMU user-space
+        emulation against the target sysroot. Results are collected under
+        the ptest suite name "glibc-user".
+
+    SSH/system mode (ssh=<ip>):
+        TOOLCHAIN_TEST_TARGET is set to "ssh" and the SSH connection details
+        (host, user, port) are configured so check-test-wrapper forwards each
+        test to the remote target over SSH. Since the tests run from the build
+        directory, that directory must be accessible on the target, which is
+        achieved by NFS-mounting it into the QEMU system running core-image-minimal.
+        Results are collected under the ptest suite name "glibc".
+
+    In both modes, results are parsed from the tests.sum file produced by
+    make check and recorded via the OEPTestResultTestCase ptest helpers.
+    """
     def run_check(self, ssh = None):
         # configure ssh target
         features = []
diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.42.bb b/meta/recipes-core/glibc/glibc-testsuite_2.42.bb
index 6477612feb..28af6961c3 100644
--- a/meta/recipes-core/glibc/glibc-testsuite_2.42.bb
+++ b/meta/recipes-core/glibc/glibc-testsuite_2.42.bb
@@ -1,3 +1,35 @@ 
+# Recipe for cross-compiling and running the glibc test suite.
+#
+# Unlike regular recipes, this recipe does not install any files (do_install
+# and do_populate_sysroot are disabled). Instead, the tests are run in-place
+# from the build directory (B) via the do_check task:
+#
+#   bitbake glibc-testsuite -c check
+#
+# This is driven by the OE selftest in meta/lib/oeqa/selftest/cases/glibc.py,
+# which supports two execution modes controlled by TOOLCHAIN_TEST_TARGET:
+#
+#   user (default):
+#     Each test binary is run under QEMU user-space emulation on the host,
+#     using the target sysroot. qemu-native is added to DEPENDS automatically.
+#
+#   ssh:
+#     Each test binary is executed on a remote target over SSH. The caller
+#     must set TOOLCHAIN_TEST_HOST, TOOLCHAIN_TEST_HOST_USER and
+#     TOOLCHAIN_TEST_HOST_PORT. In the emulated selftest variant, the target
+#     is a QEMU system (core-image-minimal) with the host build directory
+#     NFS-mounted at the same path, so the tests can access their binaries
+#     and data files directly.
+#
+# In both modes the check-test-wrapper script is passed as Autotools'
+# test-wrapper, which intercepts each test invocation and forwards it to
+# the appropriate execution backend.
+#
+# Running only specific tests is possible by using for example
+#   make test t=misc/tst-syslog
+# instead of
+#   make check
+
 require glibc_${PV}.bb
 require glibc-tests.inc