diff mbox series

[v1] libxslt: add ptest support

Message ID 20260506092057.27057-1-pratik.farkase@est.tech
State Under Review
Headers show
Series [v1] libxslt: add ptest support | expand

Commit Message

Pratik Farkase May 6, 2026, 9:20 a.m. UTC
Add ptest support for libxslt, running the upstream runtest binary which
validates XSLT transformations across REC conformance, general, encoding,
documents, numbers, keys, namespaces, extensions, reports, and EXSLT
function tests.

NOTE: The encoding/bug-146 test is excluded as it requires windows-1251 iconv
support not available in minimal images.

Tested on qemux86-64 with ptest-runner: 747 tests, 0 errors.

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../recipes-support/libxslt/libxslt/run-ptest | 17 ++++++++++++
 .../recipes-support/libxslt/libxslt_1.1.45.bb | 26 +++++++++++++++++--
 3 files changed, 42 insertions(+), 2 deletions(-)
 create mode 100755 meta/recipes-support/libxslt/libxslt/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 1ce8eda46d..566445187d 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -60,6 +60,7 @@  PTESTS_FAST = "\
     libxml-simple-perl \
     libxml2 \
     libxmlb \
+    libxslt \
     libyaml \
     logrotate \
     lua \
diff --git a/meta/recipes-support/libxslt/libxslt/run-ptest b/meta/recipes-support/libxslt/libxslt/run-ptest
new file mode 100755
index 0000000000..b82725295c
--- /dev/null
+++ b/meta/recipes-support/libxslt/libxslt/run-ptest
@@ -0,0 +1,17 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: MIT
+
+cd "$(dirname "$0")/tests" || exit 1
+
+output=$(./runtest 2>&1)
+ret=$?
+
+echo "$output" | while IFS= read -r line; do
+    echo "$line"
+done
+
+if [ $ret -eq 0 ]; then
+    echo "PASS: runtest"
+else
+    echo "FAIL: runtest"
+fi
diff --git a/meta/recipes-support/libxslt/libxslt_1.1.45.bb b/meta/recipes-support/libxslt/libxslt_1.1.45.bb
index 449ea2dd24..028fa0e5bf 100644
--- a/meta/recipes-support/libxslt/libxslt_1.1.45.bb
+++ b/meta/recipes-support/libxslt/libxslt_1.1.45.bb
@@ -13,7 +13,9 @@  LIC_FILES_CHKSUM = "file://Copyright;md5=0cd9a07afbeb24026c9b03aecfeba458"
 SECTION = "libs"
 DEPENDS = "libxml2"
 
-SRC_URI = "https://download.gnome.org/sources/libxslt/1.1/libxslt-${PV}.tar.xz"
+SRC_URI = "https://download.gnome.org/sources/libxslt/1.1/libxslt-${PV}.tar.xz \
+           file://run-ptest \
+           "
 
 SRC_URI[sha256sum] = "9acfe68419c4d06a45c550321b3212762d92f41465062ca4ea19e632ee5d216e"
 
@@ -25,7 +27,7 @@  S = "${UNPACKDIR}/libxslt-${PV}"
 
 BINCONFIG = "${bindir}/xslt-config"
 
-inherit autotools pkgconfig binconfig-disabled lib_package multilib_header
+inherit autotools pkgconfig binconfig-disabled lib_package multilib_header ptest
 
 do_configure:prepend () {
 	# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header.
@@ -56,3 +58,23 @@  FILES:${PN} += "${libdir}/libxslt-plugins"
 FILES:${PN}-dev += "${libdir}/xsltConf.sh"
 
 BBCLASSEXTEND = "native nativesdk"
+
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests runtest
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    ${B}/libtool --mode=install install -m 0755 ${B}/tests/runtest ${D}${PTEST_PATH}/tests/
+
+    for d in general REC REC2 documents encoding exslt extensions \
+             keys namespaces numbers plugins reports; do
+        if [ -d ${S}/tests/$d ]; then
+            cp -r ${S}/tests/$d ${D}${PTEST_PATH}/tests/
+        fi
+    done
+
+    # Remove encoding test that requires windows-1251 iconv support
+    rm -f ${D}${PTEST_PATH}/tests/encoding/bug-146.*
+}