diff mbox series

[v3] libxslt: add ptest support

Message ID 20251022204136.8276-1-pratik.farkase@est.tech
State New
Headers show
Series [v3] libxslt: add ptest support | expand

Commit Message

Pratik Farkase Oct. 22, 2025, 8:41 p.m. UTC
Add ptest support for libxslt 1.1.43 including:
- do_compile_ptest and do_install_ptest
- test data installation
- cleanup of buildpath references
- added run-ptest installation

Enable --with-plugins only when ptest is enabled, per review feedback.

v3:
- Remove unconditional --with-plugins (leftover from v2)

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-support/libxslt/files/run-ptest  | 25 ++++++++++++
 .../recipes-support/libxslt/libxslt_1.1.43.bb | 40 +++++++++++++++++--
 3 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100755 meta/recipes-support/libxslt/files/run-ptest

Comments

Gyorgy Sarvari Oct. 23, 2025, 7:16 a.m. UTC | #1
On 10/22/25 22:41, Pratik Farkase via lists.openembedded.org wrote:
> Add ptest support for libxslt 1.1.43 including:
> - do_compile_ptest and do_install_ptest
> - test data installation
> - cleanup of buildpath references
> - added run-ptest installation
>
> Enable --with-plugins only when ptest is enabled, per review feedback.
>
> v3:
> - Remove unconditional --with-plugins (leftover from v2)
>
> Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
> ---
>  .../distro/include/ptest-packagelists.inc     |  1 +
>  meta/recipes-support/libxslt/files/run-ptest  | 25 ++++++++++++
>  .../recipes-support/libxslt/libxslt_1.1.43.bb | 40 +++++++++++++++++--
>  3 files changed, 63 insertions(+), 3 deletions(-)
>  create mode 100755 meta/recipes-support/libxslt/files/run-ptest
>
> diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
> index 9950e46776..b295e0049f 100644
> --- a/meta/conf/distro/include/ptest-packagelists.inc
> +++ b/meta/conf/distro/include/ptest-packagelists.inc
> @@ -47,6 +47,7 @@ PTESTS_FAST = "\
>      libxml-simple-perl \
>      libxml2 \
>      libxmlb \
> +    libxslt \
>      logrotate \
>      lua \
>      lzo \
> diff --git a/meta/recipes-support/libxslt/files/run-ptest b/meta/recipes-support/libxslt/files/run-ptest
> new file mode 100755
> index 0000000000..a2b28e6a75
> --- /dev/null
> +++ b/meta/recipes-support/libxslt/files/run-ptest
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +set -eu
> +PT_DIR="$(dirname "$0")"
> +cd "$PT_DIR/tests"
> +
> +echo "=== Running libxslt ptests (verbose) ==="
> +
> +if [ -x .libs/runtest ]; then
> +    echo "Running .libs/runtest --verbose --timing"
> +    ./.libs/runtest --verbose --timing 2>&1 | tee runtest.log
> +elif [ -x ./runtest ]; then
> +    echo "Running runtest --verbose --timing"
> +    ./runtest --verbose --timing 2>&1 | tee runtest.log
> +else
> +    echo "ERROR: runtest not found"
> +    exit 1
> +fi
> +
> +if [ -x .libs/run-threads ]; then
> +    echo "Running .libs/run-threads --verbose"
> +    ./.libs/run-threads --verbose 2>&1 | tee -a runtest.log
> +fi
> +
> +echo "=== Finished libxslt ptests ==="
> +
> diff --git a/meta/recipes-support/libxslt/libxslt_1.1.43.bb b/meta/recipes-support/libxslt/libxslt_1.1.43.bb
> index e08e92085d..c1793710e5 100644
> --- a/meta/recipes-support/libxslt/libxslt_1.1.43.bb
> +++ b/meta/recipes-support/libxslt/libxslt_1.1.43.bb
> @@ -11,10 +11,11 @@ LICENSE = "MIT"
>  LIC_FILES_CHKSUM = "file://Copyright;md5=0cd9a07afbeb24026c9b03aecfeba458"
>  
>  SECTION = "libs"
> -DEPENDS = "libxml2"
> +DEPENDS = "libxml2 libxslt-native"
>  
>  SRC_URI = "https://download.gnome.org/sources/libxslt/1.1/libxslt-${PV}.tar.xz \
> -           file://gnome-libxslt-bug-139-apple-fix.diff"
> +           file://gnome-libxslt-bug-139-apple-fix.diff \
> +	    file://run-ptest"
>  
>  SRC_URI[sha256sum] = "5a3d6b383ca5afc235b171118e90f5ff6aa27e9fea3303065231a6d403f0183a"
>  
> @@ -26,7 +27,39 @@ S = "${WORKDIR}/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
> +
> +RDEPENDS:${PN}-ptest += "${PN}-bin make libxslt-utils libxml2-utils xmlto coreutils sed grep diffutils bash libxml2-utils perl"
> +
> +do_compile_ptest() {
> +    cp -r ${S}/tests ${B}/
> +    oe_runmake -C ${B}/tests runtest || true
> +    if grep -q "run-threads" ${B}/tests/Makefile; then
> +        oe_runmake -C ${B}/tests run-threads || true
> +    fi
> +}
> +
> +do_install_ptest() {
> +    install -d ${D}${PTEST_PATH}/tests
> +
> +    if [ -d ${B}/tests/.libs ]; then
> +        cp -a ${B}/tests/.libs ${D}${PTEST_PATH}/tests/
> +    fi
> +
> +    for f in runtest run-threads; do
> +        if [ -f ${B}/tests/$f ]; then
> +            install -m 0755 ${B}/tests/$f ${D}${PTEST_PATH}/tests/
> +            sed -i -e "s#${TMPDIR}##g" \
> +                   -e "s#${B}##g" \
> +                   -e "s#${S}##g" \
> +                   ${D}${PTEST_PATH}/tests/$f || true
> +        fi
> +    done
> +
> +    cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests/ || true
> +    find ${D}${PTEST_PATH}/tests -name 'Makefile*' -delete || true
> +    find ${D}${PTEST_PATH}/tests -name '.deps' -type d -exec rm -rf {} + || true
> +}
>  
>  do_configure:prepend () {
>  	# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header.
> @@ -39,6 +72,7 @@ do_configure:prepend () {
>  }
>  
>  EXTRA_OECONF = "--without-python --without-debug --without-crypto"
> +EXTRA_OECONF:append:ptest = " --with-plugins"

Hmmmm... does this work as intended? Just trying to confirm. It might
work, override logic have surprised me before, but I'm not familiar with
this syntax... I was thinking for more along the lines of
EXTRA_OECCONF += "${@bb.utils.contains('PTEST_ENABLED, '1',
'--with-plugins', '')}"

But if this works too, then there is no need to change.

>  # older versions of this recipe had ${PN}-utils
>  RPROVIDES:${PN}-bin += "${PN}-utils"
>  RCONFLICTS:${PN}-bin += "${PN}-utils"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225212): https://lists.openembedded.org/g/openembedded-core/message/225212
> Mute This Topic: https://lists.openembedded.org/mt/115899975/6084445
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [skandigraun@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Pratik Farkase Oct. 23, 2025, 7:46 a.m. UTC | #2
Hi Gyorgy,

Yes, the ":append:ptest" syntax works as intended here — it's functionally
equivalent to using bb.utils.contains('PTEST_ENABLED', '1', ...), but is the
newer override-style form that's been adopted widely in OE-Core recipes.

I verified that EXTRA_OECONF includes "--with-plugins" only when ptest is
enabled (DISTRO_FEATURES contains "ptest"). I tested both of these overrides
and the result seems to be same.

So the existing form behaves correctly, but I can switch to the older
conditional form if preferred.

Thanks for this good suggestion!

Best Regards,
Pratik
Mathieu Dubois-Briand Oct. 23, 2025, 1:59 p.m. UTC | #3
On Wed Oct 22, 2025 at 10:41 PM CEST, Pratik Farkase wrote:
> Add ptest support for libxslt 1.1.43 including:
> - do_compile_ptest and do_install_ptest
> - test data installation
> - cleanup of buildpath references
> - added run-ptest installation
>
> Enable --with-plugins only when ptest is enabled, per review feedback.
>
> v3:
> - Remove unconditional --with-plugins (leftover from v2)
>
> Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
> ---

Hi Pratik,

It looks like we still have some ptest issues:

AssertionError:
ptests which had no test results:
['libxslt']

https://autobuilder.yoctoproject.org/valkyrie/#/builders/56/builds/665
https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/2523

Ptest logs can be found here:

https://valkyrie.yocto.io/pub/non-release/20251023-70/testresults/qemuriscv64-ptest/core-image-ptest-libxmlb/
https://valkyrie.yocto.io/pub/non-release/20251023-70/testresults/qemux86-64-ptest/core-image-ptest-libxmlb/

Can you have a look at these failures please?

Thanks,
Mathieu
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 9950e46776..b295e0049f 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -47,6 +47,7 @@  PTESTS_FAST = "\
     libxml-simple-perl \
     libxml2 \
     libxmlb \
+    libxslt \
     logrotate \
     lua \
     lzo \
diff --git a/meta/recipes-support/libxslt/files/run-ptest b/meta/recipes-support/libxslt/files/run-ptest
new file mode 100755
index 0000000000..a2b28e6a75
--- /dev/null
+++ b/meta/recipes-support/libxslt/files/run-ptest
@@ -0,0 +1,25 @@ 
+#!/bin/sh
+set -eu
+PT_DIR="$(dirname "$0")"
+cd "$PT_DIR/tests"
+
+echo "=== Running libxslt ptests (verbose) ==="
+
+if [ -x .libs/runtest ]; then
+    echo "Running .libs/runtest --verbose --timing"
+    ./.libs/runtest --verbose --timing 2>&1 | tee runtest.log
+elif [ -x ./runtest ]; then
+    echo "Running runtest --verbose --timing"
+    ./runtest --verbose --timing 2>&1 | tee runtest.log
+else
+    echo "ERROR: runtest not found"
+    exit 1
+fi
+
+if [ -x .libs/run-threads ]; then
+    echo "Running .libs/run-threads --verbose"
+    ./.libs/run-threads --verbose 2>&1 | tee -a runtest.log
+fi
+
+echo "=== Finished libxslt ptests ==="
+
diff --git a/meta/recipes-support/libxslt/libxslt_1.1.43.bb b/meta/recipes-support/libxslt/libxslt_1.1.43.bb
index e08e92085d..c1793710e5 100644
--- a/meta/recipes-support/libxslt/libxslt_1.1.43.bb
+++ b/meta/recipes-support/libxslt/libxslt_1.1.43.bb
@@ -11,10 +11,11 @@  LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://Copyright;md5=0cd9a07afbeb24026c9b03aecfeba458"
 
 SECTION = "libs"
-DEPENDS = "libxml2"
+DEPENDS = "libxml2 libxslt-native"
 
 SRC_URI = "https://download.gnome.org/sources/libxslt/1.1/libxslt-${PV}.tar.xz \
-           file://gnome-libxslt-bug-139-apple-fix.diff"
+           file://gnome-libxslt-bug-139-apple-fix.diff \
+	    file://run-ptest"
 
 SRC_URI[sha256sum] = "5a3d6b383ca5afc235b171118e90f5ff6aa27e9fea3303065231a6d403f0183a"
 
@@ -26,7 +27,39 @@  S = "${WORKDIR}/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
+
+RDEPENDS:${PN}-ptest += "${PN}-bin make libxslt-utils libxml2-utils xmlto coreutils sed grep diffutils bash libxml2-utils perl"
+
+do_compile_ptest() {
+    cp -r ${S}/tests ${B}/
+    oe_runmake -C ${B}/tests runtest || true
+    if grep -q "run-threads" ${B}/tests/Makefile; then
+        oe_runmake -C ${B}/tests run-threads || true
+    fi
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+
+    if [ -d ${B}/tests/.libs ]; then
+        cp -a ${B}/tests/.libs ${D}${PTEST_PATH}/tests/
+    fi
+
+    for f in runtest run-threads; do
+        if [ -f ${B}/tests/$f ]; then
+            install -m 0755 ${B}/tests/$f ${D}${PTEST_PATH}/tests/
+            sed -i -e "s#${TMPDIR}##g" \
+                   -e "s#${B}##g" \
+                   -e "s#${S}##g" \
+                   ${D}${PTEST_PATH}/tests/$f || true
+        fi
+    done
+
+    cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests/ || true
+    find ${D}${PTEST_PATH}/tests -name 'Makefile*' -delete || true
+    find ${D}${PTEST_PATH}/tests -name '.deps' -type d -exec rm -rf {} + || true
+}
 
 do_configure:prepend () {
 	# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header.
@@ -39,6 +72,7 @@  do_configure:prepend () {
 }
 
 EXTRA_OECONF = "--without-python --without-debug --without-crypto"
+EXTRA_OECONF:append:ptest = " --with-plugins"
 # older versions of this recipe had ${PN}-utils
 RPROVIDES:${PN}-bin += "${PN}-utils"
 RCONFLICTS:${PN}-bin += "${PN}-utils"