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 <[email protected]>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../recipes-support/libksba/libksba/run-ptest | 12 ++++++++++
 meta/recipes-support/libksba/libksba_1.6.7.bb | 22 +++++++++++++++++--
 3 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100755 meta/recipes-support/libksba/libksba/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc 
b/meta/conf/distro/include/ptest-packagelists.inc
index fbbd118255..d11caa745d 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -32,6 +32,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
index 0000000000..d09bbb0cdf
--- /dev/null
+++ b/meta/recipes-support/libksba/libksba/run-ptest
@@ -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
diff --git a/meta/recipes-support/libksba/libksba_1.6.7.bb 
b/meta/recipes-support/libksba/libksba_1.6.7.bb
index d97fa84977..f4d076e72e 100644
--- a/meta/recipes-support/libksba/libksba_1.6.7.bb
+++ b/meta/recipes-support/libksba/libksba_1.6.7.bb
@@ -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"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231110): 
https://lists.openembedded.org/g/openembedded-core/message/231110
Mute This Topic: https://lists.openembedded.org/mt/117789988/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to