]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
libksba: add ptest support
authorPratik Farkase <pratik.farkase@est.tech>
Fri, 13 Feb 2026 10:31:07 +0000 (11:31 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Feb 2026 18:05:10 +0000 (18:05 +0000)
Add ptest support to enable automated testing of libksba
using ptest-runner.

The implementation builds and installs test executables from
the tests/ directory along with the required test data files
from the samples/ directory.

Test results on qemux86-64:
        PASS: cert-basic
PASS: t-cms-parser
PASS: t-crl-parser
PASS: t-der-builder
PASS: t-dnparser
PASS: t-ocsp
PASS: t-oid
PASS: t-reader

All 8 tests pass.

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/ptest-packagelists.inc
meta/recipes-support/libksba/libksba/run-ptest [new file with mode: 0755]
meta/recipes-support/libksba/libksba_1.6.7.bb

index 1a735fe9341deee32a2c68aed5b94e980352b916..1bb7458fc9dde247db991c6e9b11c555f1beca7e 100644 (file)
@@ -35,6 +35,7 @@ PTESTS_FAST = "\
     libconvert-asn1-perl \
     libexif \
     libgpg-error\
+    libksba \
     libmd \
     libnl \
     libpcre \
diff --git a/meta/recipes-support/libksba/libksba/run-ptest b/meta/recipes-support/libksba/libksba/run-ptest
new file mode 100755 (executable)
index 0000000..d09bbb0
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+cd tests
+
+for t in cert-basic t-cms-parser t-crl-parser t-der-builder t-dnparser t-ocsp t-oid t-reader; do
+    ./$t
+    if [ $? -eq 0 ]; then
+        echo "PASS: $t"
+    else
+        echo "FAIL: $t"
+    fi
+done
index d97fa8497741df79d87e0227a4ebe2fb98551c00..4b9e22538c579bf1cea990bb2b561d03e1124de8 100644 (file)
@@ -18,13 +18,15 @@ DEPENDS = "libgpg-error"
 
 BINCONFIG = "${bindir}/ksba-config"
 
-inherit autotools binconfig-disabled pkgconfig texinfo
+inherit autotools binconfig-disabled pkgconfig texinfo ptest
 
 require recipes-support/gnupg/drop-unknown-suffix.inc
 
 UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
 SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
-           file://ksba-add-pkgconfig-support.patch"
+           file://ksba-add-pkgconfig-support.patch \
+           file://run-ptest \
+           "
 
 SRC_URI[sha256sum] = "cf72510b8ebb4eb6693eef765749d83677a03c79291a311040a5bfd79baab763"
 
@@ -33,4 +35,20 @@ do_configure:prepend () {
        rm -f ${S}/m4/gpg-error.m4
 }
 
+do_compile_ptest() {
+    oe_runmake -C tests check TESTS=
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    for test in ${B}/tests/cert-basic ${B}/tests/t-cms-parser ${B}/tests/t-crl-parser \
+                ${B}/tests/t-der-builder ${B}/tests/t-dnparser ${B}/tests/t-ocsp \
+                ${B}/tests/t-oid ${B}/tests/t-reader; do
+        ${B}/libtool --mode=install install -m 0755 $test ${D}${PTEST_PATH}/tests/
+    done
+
+    cp -r ${S}/tests/samples ${D}${PTEST_PATH}/tests/
+}
+
 BBCLASSEXTEND = "native nativesdk"