libpng: Add ptest

Install libpng test-suite to run it as a ptest.
As the test-suite takes more than 30 seconds to run,
add libpng-ptest to PTESTS_SLOW in ptest-packagelists.inc

(From OE-Core rev: 8dca5305c950e6a06b3f344ffdbbb7386d802095)

Signed-off-by: Poonam Jadhav <poonam.jadhav@kpit.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Poonam Jadhav 2025-06-16 10:06:57 +05:30 committed by Richard Purdie
parent 5dff1c40db
commit eb9b83d6c9
3 changed files with 48 additions and 2 deletions

View File

@ -108,6 +108,7 @@ PTESTS_SLOW = "\
libevent \
libgcrypt \
libmodule-build-perl \
libpng \
libseccomp \
lttng-tools \
lz4 \

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -eux
cd src
make check-TESTS

View File

@ -10,7 +10,10 @@ DEPENDS = "zlib"
LIBV = "16"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/${BP}.tar.xz"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}${LIBV}/${BP}.tar.xz \
file://run-ptest \
"
SRC_URI[sha256sum] = "46fd06ff37db1db64c0dc288d78a3f5efd23ad9ac41561193f983e20937ece03"
MIRRORS += "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/ ${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}${LIBV}/older-releases/"
@ -19,7 +22,7 @@ UPSTREAM_CHECK_URI = "http://libpng.org/pub/png/libpng.html"
BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config"
inherit autotools binconfig-disabled pkgconfig
inherit autotools binconfig-disabled pkgconfig ptest
# Work around missing symbols
ARMNEON = "${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off", d)}"
@ -30,4 +33,39 @@ PACKAGES =+ "${PN}-tools"
FILES:${PN}-tools = "${bindir}/png-fix-itxt ${bindir}/pngfix ${bindir}/pngcp"
RDEPENDS:${PN}-ptest += "make bash gawk"
do_install_ptest() {
# Install test scripts to ptest path
install -d ${D}${PTEST_PATH}/src/tests
install -m 755 ${S}/tests/* ${D}${PTEST_PATH}/src/tests
install -m 755 ${S}/test-driver ${D}${PTEST_PATH}
install -d ${D}${PTEST_PATH}/src/tests/scripts
install -m 755 ${S}/scripts/*.awk ${D}${PTEST_PATH}/src/tests/scripts
install -m 644 ${S}/scripts/pnglib* ${S}/scripts/*.c ${S}/scripts/*.def ${S}/scripts/macro.lst ${D}${PTEST_PATH}/src/tests/scripts
install -m 644 ${S}/scripts/pnglibconf.h.prebuilt ${D}${PTEST_PATH}/src/tests/scripts/pnglibconf.h
install -d ${D}${PTEST_PATH}/src/contrib/tools
install -m 755 ${S}/contrib/tools/*.sh ${D}${PTEST_PATH}/src/contrib/tools
install -m 644 ${S}/contrib/tools/*.c ${S}/contrib/tools/*.h ${D}${PTEST_PATH}/src/contrib/tools
# Install .libs directory binaries to ptest path
install -m 755 ${B}/.libs/pngtest ${B}/.libs/pngstest ${B}/.libs/pngimage ${B}/.libs/pngunknown ${B}/.libs/pngvalid ${D}${PTEST_PATH}/src
# Copy png files to ptest path
cd ${S} && find contrib -name '*.png' | cpio -pd ${D}${PTEST_PATH}/src
# Install Makefile and png files
install -m 644 ${S}/pngtest.png ${D}${PTEST_PATH}/src
install -m 644 ${S}/*.png ${S}/*.h ${S}/*.c ${S}/*.dfa ${B}/pnglibconf.out ${S}/Makefile.am ${S}/Makefile.in ${D}${PTEST_PATH}/src/tests
sed -e 's/^abs_srcdir = ..*/abs_srcdir = \.\./' \
-e 's/^top_srcdir = ..*/top_srcdir = \.\./' \
-e 's/^srcdir = ..*/srcdir = \./' \
-e 's/^Makefile: ..*/Makefile: /' \
-e 's/check-TESTS: $(check_PROGRAMS)/check-TESTS:/g' \
${B}/Makefile > ${D}${PTEST_PATH}/src/Makefile
sed -e 's|#!/bin/awk|#!/usr/bin/awk|g' -i ${D}${PTEST_PATH}/src/tests/scripts/*.awk
}
BBCLASSEXTEND = "native nativesdk"