All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tiff: add ptest support
       [not found] <20260915073518.2271284-1-HimaniRamesh.Barde@windriver.com>
@ 2026-09-21 10:11 ` Himani Ramesh Barde
  2026-09-22  9:12   ` [OE-core] " Antonin Godard
  0 siblings, 1 reply; 2+ messages in thread
From: Himani Ramesh Barde @ 2026-09-21 10:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy MacLeod, Shiva Komati, Himani Ramesh Barde

Enable ptest for tiff (libtiff), running the upstream test suite shipped
in the source test/ directory: the C unit-test programs (check_PROGRAMS)
plus the shell-script tests that exercise the tiff command-line tools.

do_compile_ptest builds the test programs via "make check TESTS=" (build
only, no run). do_install_ptest installs the compiled test binaries (real
ELF from test/.libs, static testtypes from test/), the shell test scripts,
the shared common.sh helper, and the images/refs data. common.sh is
adjusted so the scripts find the installed tiff tools in ${bindir} rather
than the build tree's ../tools, and run-ptest recreates the SOURCE_DIR
path that test_ifd_loop_detection was compiled with so its images resolve
on target.

The list of C test programs is defined once in the recipe (TIFF_PTEST_PROGS)
and substituted into run-ptest at install time to avoid duplication. The
wrapper emits automake-style PASS/FAIL/SKIP results and skips two tests
whose optional support is not built in the default configuration: the JBIG
test (jbig is not in the default PACKAGECONFIG) and the thumbnail test (the
thumbnail tool is not built).

Registered in ptest-packagelists.inc under PTESTS_SLOW; the suite runs in
roughly 30s on qemux86-64.

Validated on qemux86-64: 17 C unit tests and 85 shell-script tests pass,
2 skipped (jbig, thumbnail), 0 failed.

Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
---

v2:
- Drop the INSANE_SKIP buildpaths (test binaries package reproducibly; QA passes).
- Drop make and bash from RDEPENDS (run-ptest never calls make; the test
  scripts are all #!/bin/sh).
- Define the C test program list once (TIFF_PTEST_PROGS) and substitute it
  into run-ptest at install time instead of duplicating it.
- Commit log: add test counts and note the ~30s runtime.

 .../distro/include/ptest-packagelists.inc     |  1 +
 .../recipes-multimedia/libtiff/tiff/run-ptest | 29 ++++++++++++
 meta/recipes-multimedia/libtiff/tiff_4.7.2.bb | 44 ++++++++++++++++++-
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100755 meta/recipes-multimedia/libtiff/tiff/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 2b5d665..837e1c1 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -151,6 +151,7 @@ PTESTS_SLOW = "\
     tar \
     tcl \
     tcl8 \
+    tiff \
     util-linux \
     zstd \
 "
diff --git a/meta/recipes-multimedia/libtiff/tiff/run-ptest b/meta/recipes-multimedia/libtiff/tiff/run-ptest
new file mode 100755
index 0000000..5abee0e
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/run-ptest
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Run the libtiff test suite and emit ptest-style PASS/FAIL/SKIP lines.
+cd "$(dirname "$0")/test" || exit 1
+
+# test_ifd_loop_detection is built with -DSOURCE_DIR="@SOURCE_DIR@" and opens
+# its images via that relative path; symlink it to the installed test dir.
+if [ ! -e "@SOURCE_DIR@" ]; then
+    mkdir -p "$(dirname @SOURCE_DIR@)"
+    ln -sf "$(pwd)" "@SOURCE_DIR@" 2>/dev/null || true
+fi
+
+# @PROGS@ is filled in from TIFF_PTEST_PROGS at install time.
+CPROGS="@PROGS@"
+
+for t in $CPROGS; do
+    if [ -x "./$t" ]; then
+        if ./"$t" >/dev/null 2>&1; then echo "PASS: $t"; else echo "FAIL: $t"; fi
+    fi
+done
+
+for t in *.sh; do
+    [ "$t" = "common.sh" ] && continue
+    case "$t" in
+        *jbig*) echo "SKIP: $t (JBIG support not enabled)"; continue ;;
+        tiffcp-thumbnail.sh)
+            command -v thumbnail >/dev/null 2>&1 || { echo "SKIP: $t (thumbnail tool not built)"; continue; } ;;
+    esac
+    if sh "./$t" >/dev/null 2>&1; then echo "PASS: $t"; else echo "FAIL: $t"; fi
+done
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
index 8bc3a48..55fe1df 100644
--- a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
+++ b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=4ab490c3088a0acff254eb2f8c577547"
 CVE_PRODUCT = "libtiff"
 
 SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
+           file://run-ptest \
 	   "
 
 SRC_URI[sha256sum] = "672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a"
@@ -23,7 +24,7 @@ CVE_STATUS[CVE-2023-6277] = "fixed-version: Fixed since 4.7.0, NVD tracks this a
 CVE_STATUS[CVE-2025-8851] = "fixed-version: Fixed since 4.7.0, NVD tracks this as fixed in 2024-08-11 vulnerability"
 CVE_STATUS[CVE-2026-4775] = "fixed-version: Fixed since 4.7.2, NVD tracks this as version-less vulnerability"
 
-inherit autotools multilib_header
+inherit autotools multilib_header ptest
 
 CACHED_CONFIGUREVARS = "ax_cv_check_gl_libgl=no"
 
@@ -64,3 +65,44 @@ do_install:append() {
 }
 
 BBCLASSEXTEND = "native nativesdk"
+
+# C unit-test programs (check_PROGRAMS) built and run by ptest. Defined once
+# here and substituted into run-ptest at install time to avoid duplication.
+TIFF_PTEST_PROGS = "ascii_tag long_tag short_tag strip_rw rewrite custom_dir \
+    custom_dir_EXIF_231 defer_strile_loading defer_strile_writing \
+    test_directory test_IFD_enlargement test_open_options \
+    test_append_to_strip test_ifd_loop_detection testtypes \
+    test_signed_tags raw_decode"
+
+do_compile_ptest() {
+    oe_runmake -C ${B}/test check TESTS=""
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/test
+    # Compiled C unit-test programs. libtool leaves a wrapper script in test/
+    # and the real ELF binary in test/.libs/; testtypes is static and lives
+    # only in test/.
+    for prog in ${TIFF_PTEST_PROGS}; do
+        if [ -e ${B}/test/.libs/$prog ]; then
+            install -m 0755 ${B}/test/.libs/$prog ${D}${PTEST_PATH}/test/
+        else
+            install -m 0755 ${B}/test/$prog ${D}${PTEST_PATH}/test/
+        fi
+    done
+    # Shell test scripts and the shared helper
+    install ${S}/test/*.sh ${D}${PTEST_PATH}/test/
+    install ${S}/test/common.sh ${D}${PTEST_PATH}/test/
+    # Point the test scripts at the installed tiff tools instead of ../tools
+    sed -i -e "s|^TOOLS=.*|TOOLS=${bindir}|" ${D}${PTEST_PATH}/test/common.sh
+    # Fill in the program list and the SOURCE_DIR path baked into
+    # test_ifd_loop_detection so run-ptest resolves them at runtime.
+    sed -i -e "s|@PROGS@|${TIFF_PTEST_PROGS}|" \
+           -e "s|@SOURCE_DIR@|../../tiff-${PV}/test|g" \
+           ${D}${PTEST_PATH}/run-ptest
+    # Input images and reference outputs
+    cp -r ${S}/test/images ${D}${PTEST_PATH}/test/
+    cp -r ${S}/test/refs ${D}${PTEST_PATH}/test/
+}
+
+RDEPENDS:${PN}-ptest += "tiff-utils"
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH v2] tiff: add ptest support
  2026-09-21 10:11 ` [PATCH v2] tiff: add ptest support Himani Ramesh Barde
@ 2026-09-22  9:12   ` Antonin Godard
  0 siblings, 0 replies; 2+ messages in thread
From: Antonin Godard @ 2026-09-22  9:12 UTC (permalink / raw)
  To: HimaniRamesh.Barde, openembedded-core; +Cc: Randy MacLeod, Shiva Komati

Hi,

On Mon Sep 21, 2026 at 12:11 PM CEST, Himani Ramesh Barde via lists.openembedded.org wrote:
> Enable ptest for tiff (libtiff), running the upstream test suite shipped
> in the source test/ directory: the C unit-test programs (check_PROGRAMS)
> plus the shell-script tests that exercise the tiff command-line tools.
>
> do_compile_ptest builds the test programs via "make check TESTS=" (build
> only, no run). do_install_ptest installs the compiled test binaries (real
> ELF from test/.libs, static testtypes from test/), the shell test scripts,
> the shared common.sh helper, and the images/refs data. common.sh is
> adjusted so the scripts find the installed tiff tools in ${bindir} rather
> than the build tree's ../tools, and run-ptest recreates the SOURCE_DIR
> path that test_ifd_loop_detection was compiled with so its images resolve
> on target.
>
> The list of C test programs is defined once in the recipe (TIFF_PTEST_PROGS)
> and substituted into run-ptest at install time to avoid duplication. The
> wrapper emits automake-style PASS/FAIL/SKIP results and skips two tests
> whose optional support is not built in the default configuration: the JBIG
> test (jbig is not in the default PACKAGECONFIG) and the thumbnail test (the
> thumbnail tool is not built).
>
> Registered in ptest-packagelists.inc under PTESTS_SLOW; the suite runs in
> roughly 30s on qemux86-64.
>
> Validated on qemux86-64: 17 C unit tests and 85 shell-script tests pass,
> 2 skipped (jbig, thumbnail), 0 failed.

This fails on different architectures on our test infra:

Failed ptests:
{'tiff': ['test_ifd_loop_detection']}

Full log: https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/9053625/raw_inline
Parent build: https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/4607
Other archs:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/109/builds/1249
https://autobuilder.yoctoproject.org/valkyrie/#/builders/110/builds/1234

Can you have a look?

Thanks,
Antonin


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-22  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260915073518.2271284-1-HimaniRamesh.Barde@windriver.com>
2026-09-21 10:11 ` [PATCH v2] tiff: add ptest support Himani Ramesh Barde
2026-09-22  9:12   ` [OE-core] " Antonin Godard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.