diff mbox series

[v1] npth: add ptest support

Message ID 20260915105039.38728-1-pratik.farkase@est.tech
State New
Headers show
Series [v1] npth: add ptest support | expand

Commit Message

Pratik Farkase Sept. 15, 2026, 10:50 a.m. UTC
Add ptest support using npth's upstream test suite, which exercises the
core threading wrappers: mutex locking (t-mutex), thread creation and
join (t-thread), condition variable signalling (t-cond) and fork
handling (t-fork).

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 meta/conf/distro/include/ptest-packagelists.inc |  1 +
 meta/recipes-support/npth/npth/run-ptest        | 12 ++++++++++++
 meta/recipes-support/npth/npth_1.8.bb           | 17 +++++++++++++++--
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/npth/npth/run-ptest
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index f01abc4a57..f8e8245bc3 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -65,6 +65,7 @@  PTESTS_FAST = "\
     lzo \
     m4 \
     nettle \
+    npth \
     opkg \
     popt \
     procps \
diff --git a/meta/recipes-support/npth/npth/run-ptest b/meta/recipes-support/npth/npth/run-ptest
new file mode 100644
index 0000000000..c5dcd1798a
--- /dev/null
+++ b/meta/recipes-support/npth/npth/run-ptest
@@ -0,0 +1,12 @@ 
+#!/bin/sh
+
+cd "$(dirname "$0")/tests" || exit 1
+
+for t in t-mutex t-thread t-cond t-fork; do
+    [ -x "./$t" ] || continue
+    if "./$t"; then
+        echo "PASS: $t"
+    else
+        echo "FAIL: $t"
+    fi
+done
diff --git a/meta/recipes-support/npth/npth_1.8.bb b/meta/recipes-support/npth/npth_1.8.bb
index a354af2a7c..48f3b0b9e6 100644
--- a/meta/recipes-support/npth/npth_1.8.bb
+++ b/meta/recipes-support/npth/npth_1.8.bb
@@ -6,14 +6,27 @@  LICENSE = "LGPL-2.0-or-later"
 LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2caced0b25dfefd4c601d92bd15116de"
 UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
 
-SRC_URI = "${GNUPG_MIRROR}/npth/npth-${PV}.tar.bz2"
+SRC_URI = "${GNUPG_MIRROR}/npth/npth-${PV}.tar.bz2 \
+           file://run-ptest \
+           "
 
 SRC_URI[sha256sum] = "8bd24b4f23a3065d6e5b26e98aba9ce783ea4fd781069c1b35d149694e90ca3e"
 
-inherit autotools multilib_header
+inherit autotools multilib_header ptest
 
 do_install:append() {
     oe_multilib_header npth.h
 }
 
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests $(makefile-getvar ${B}/tests/Makefile TESTS)
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    for t in $(makefile-getvar ${B}/tests/Makefile TESTS); do
+        ${B}/libtool --mode=install install -m 0755 ${B}/tests/$t ${D}${PTEST_PATH}/tests/
+    done
+}
+
 BBCLASSEXTEND = "native nativesdk"