Skip to contentSkip to conversation

libksba: add ptest support

PATCH Superseded Pratik Farkase 1 participant 2 messages Feb 13

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libksba: add ptest support

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.

---
 .../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
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fbbd118255..d11caa745d 100644
@@ -32,6 +32,7 @@ PTESTS_FAST = "\
     libconvert-asn1-perl \
     libexif \
     libgpg-error\
+    libksba \
     libmd \
     libnl \
     libpcre \
meta/recipes-support/libksba/libksba/run-ptest new file +12 -0
new file mode 100755
index 0000000000..d09bbb0cdf
@@ -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
meta/recipes-support/libksba/libksba_1.6.7.bb +20 -2
index d97fa84977..f4d076e72e 100644
@@ -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"
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/1 libksba: add ptest support

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.

---
Changes in v2:
- Fix SRC_URI syntax: add missing backslash after
ksba-add-pkgconfig-support.patch

---
 .../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
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index fbbd118255..d11caa745d 100644
@@ -32,6 +32,7 @@ PTESTS_FAST = "\
     libconvert-asn1-perl \
     libexif \
     libgpg-error\
+    libksba \
     libmd \
     libnl \
     libpcre \
meta/recipes-support/libksba/libksba/run-ptest new file +12 -0
new file mode 100755
index 0000000000..d09bbb0cdf
@@ -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
meta/recipes-support/libksba/libksba_1.6.7.bb +20 -2
index d97fa84977..4b9e22538c 100644
@@ -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"
Signature · 1 line
2.43.0