* [PATCH v3] tiff: add ptest support
[not found] <20260921100952.2619282-1-HimaniRamesh.Barde@windriver.com>
@ 2026-09-25 8:05 ` Himani Ramesh Barde
2026-09-27 7:32 ` [OE-core] " Mathieu Dubois-Briand
2026-09-30 7:34 ` [PATCH v4] " Himani Ramesh Barde
0 siblings, 2 replies; 3+ messages in thread
From: Himani Ramesh Barde @ 2026-09-25 8:05 UTC (permalink / raw)
To: openembedded-core; +Cc: Randy MacLeod, Shiva Komati, Himani Ramesh Barde
Run the libtiff test suite as a ptest: the C unit tests (the automake
check_PROGRAMS) and the shell tests that drive the tiff command-line tools.
do_compile_ptest builds the test programs. do_install_ptest installs the
binaries, the shell scripts, the common.sh helper, and the images/ and
refs/ data, and points common.sh at the installed tools in ${bindir}
instead of the build tree. The recipe lists the C programs once, in
TIFF_PTEST_PROGS, and fills that list into run-ptest at install time.
One test, test_ifd_loop_detection, opened its images through a build-time
path instead of relative to the current directory, so it failed once
installed. A small upstream patch makes it read the images from ".", like
the other tests, so it now passes on every architecture.
run-ptest prints automake-style PASS/FAIL/SKIP lines. Two tests skip in the
default configuration:
- the JBIG test, because jbig is not in the default PACKAGECONFIG
- the thumbnail test, because the thumbnail tool is not built
Registered under PTESTS_SLOW in ptest-packagelists.inc; the suite runs in
about 30s on qemux86-64.
Validated on qemux86-64:
- 17 C unit tests pass
- 85 shell tests pass
- 2 skip (jbig, thumbnail)
- 0 fail
Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
---
v3:
- Fix test_ifd_loop_detection on non-x86 architectures. It opened its
images through the build-time SOURCE_DIR path, which does not exist in
the installed ptest; a small upstream patch makes it read them relative
to ".", like the other tests. This replaces the run-ptest symlink that
v2 used to fake that path.
- Reword the commit message per review.
v2:
- Drop the INSANE_SKIP buildpaths; the test binaries package cleanly.
- Drop make and bash from RDEPENDS (run-ptest calls neither).
- Define the C test program list once (TIFF_PTEST_PROGS) instead of
duplicating it in run-ptest.
.../distro/include/ptest-packagelists.inc | 1 +
.../recipes-multimedia/libtiff/tiff/run-ptest | 23 ++++++++++
...t_ifd_loop_detection-relative-images.patch | 38 +++++++++++++++++
meta/recipes-multimedia/libtiff/tiff_4.7.2.bb | 42 ++++++++++++++++++-
4 files changed, 103 insertions(+), 1 deletion(-)
create mode 100755 meta/recipes-multimedia/libtiff/tiff/run-ptest
create mode 100644 meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
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..ebf11c9
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/run-ptest
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Run the libtiff test suite and emit ptest-style PASS/FAIL/SKIP lines.
+cd "$(dirname "$0")/test" || exit 1
+
+
+# @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/test_ifd_loop_detection-relative-images.patch b/meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
new file mode 100644
index 0000000..789be95
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
+Date: Tue, 22 Sep 2026 00:00:00 +0000
+Subject: [PATCH] test_ifd_loop_detection: find images relative to CWD
+
+test_ifd_loop_detection is the only C test in the suite that references
+its input images through the compile-time SOURCE_DIR macro
+(-DSOURCE_DIR="@srcdir@") instead of opening them relative to the current
+working directory the way every other test does. When the test is run
+from an installed location (for example an OpenEmbedded ptest package)
+the build-time @srcdir@ path no longer exists, so the images are not
+found and the test fails.
+
+Override SOURCE_DIR to "." so the images are resolved relative to the
+directory the test is executed from, matching the behaviour of the other
+tests. In-tree "make check" still works because it runs the test from the
+build test/ directory whose srcdir is already ".".
+
+Upstream-Status: Submitted [libtiff]
+
+Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
+---
+ test/test_ifd_loop_detection.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/test/test_ifd_loop_detection.c b/test/test_ifd_loop_detection.c
+--- a/test/test_ifd_loop_detection.c
++++ b/test/test_ifd_loop_detection.c
+@@ -34,6 +34,9 @@
+ #include <string.h>
+
+ #include "tiffio.h"
++
++#undef SOURCE_DIR
++#define SOURCE_DIR "."
+
+ /* Compare 'requested_dir_number' with number written in PageName tag
+ * into the IFD to identify that IFD. */
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
index 8bc3a48..767b295 100644
--- a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
+++ b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=4ab490c3088a0acff254eb2f8c577547"
CVE_PRODUCT = "libtiff"
SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
+ file://test_ifd_loop_detection-relative-images.patch \
+ file://run-ptest \
"
SRC_URI[sha256sum] = "672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a"
@@ -23,7 +25,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 +66,41 @@ 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 C test program list from TIFF_PTEST_PROGS.
+ sed -i -e "s|@PROGS@|${TIFF_PTEST_PROGS}|" ${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] 3+ messages in thread
* Re: [OE-core] [PATCH v3] tiff: add ptest support
2026-09-25 8:05 ` [PATCH v3] tiff: add ptest support Himani Ramesh Barde
@ 2026-09-27 7:32 ` Mathieu Dubois-Briand
2026-09-30 7:34 ` [PATCH v4] " Himani Ramesh Barde
1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Dubois-Briand @ 2026-09-27 7:32 UTC (permalink / raw)
To: HimaniRamesh.Barde, openembedded-core; +Cc: Randy MacLeod, Shiva Komati
On Fri Sep 25, 2026 at 10:05 AM CEST, Himani Ramesh Barde via lists.openembedded.org wrote:
> Run the libtiff test suite as a ptest: the C unit tests (the automake
> check_PROGRAMS) and the shell tests that drive the tiff command-line tools.
>
> do_compile_ptest builds the test programs. do_install_ptest installs the
> binaries, the shell scripts, the common.sh helper, and the images/ and
> refs/ data, and points common.sh at the installed tools in ${bindir}
> instead of the build tree. The recipe lists the C programs once, in
> TIFF_PTEST_PROGS, and fills that list into run-ptest at install time.
>
> One test, test_ifd_loop_detection, opened its images through a build-time
> path instead of relative to the current directory, so it failed once
> installed. A small upstream patch makes it read the images from ".", like
> the other tests, so it now passes on every architecture.
>
> run-ptest prints automake-style PASS/FAIL/SKIP lines. Two tests skip in the
> default configuration:
>
> - the JBIG test, because jbig is not in the default PACKAGECONFIG
> - the thumbnail test, because the thumbnail tool is not built
>
> Registered under PTESTS_SLOW in ptest-packagelists.inc; the suite runs in
> about 30s on qemux86-64.
>
> Validated on qemux86-64:
>
> - 17 C unit tests pass
> - 85 shell tests pass
> - 2 skip (jbig, thumbnail)
> - 0 fail
>
> Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
> ---
Hi Himani Ramesh,
Thanks for the new version. It looks like the embedded patch fails to
apply here:
ERROR: tiff-4.7.2-r0 do_patch: QA Issue: Fuzz detected:
Applying patch test_ifd_loop_detection-relative-images.patch
patching file test/test_ifd_loop_detection.c
Hunk #1 succeeded at 45 with fuzz 2 (offset 11 lines).
https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/4740
Can you have a look at the issue?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v4] tiff: add ptest support
2026-09-25 8:05 ` [PATCH v3] tiff: add ptest support Himani Ramesh Barde
2026-09-27 7:32 ` [OE-core] " Mathieu Dubois-Briand
@ 2026-09-30 7:34 ` Himani Ramesh Barde
1 sibling, 0 replies; 3+ messages in thread
From: Himani Ramesh Barde @ 2026-09-30 7:34 UTC (permalink / raw)
To: openembedded-core
Cc: Randy MacLeod, Shiva Komati, Mathieu Dubois-Briand,
Himani Ramesh Barde
Run the libtiff test suite as a ptest: the C unit tests (the automake
check_PROGRAMS) and the shell tests that drive the tiff command-line tools.
do_compile_ptest builds the test programs. do_install_ptest installs the
binaries, the shell scripts, the common.sh helper, and the images/ and
refs/ data, and points common.sh at the installed tools in ${bindir}
instead of the build tree. The recipe lists the C programs once, in
TIFF_PTEST_PROGS, and fills that list into run-ptest at install time.
One test, test_ifd_loop_detection, opened its images through a build-time
path instead of relative to the current directory, so it failed once
installed. A small upstream patch makes it read the images from ".", like
the other tests, so it now passes on every architecture.
run-ptest prints automake-style PASS/FAIL/SKIP lines. Two tests skip in the
default configuration:
- the JBIG test, because jbig is not in the default PACKAGECONFIG
- the thumbnail test, because the thumbnail tool is not built
Registered under PTESTS_SLOW in ptest-packagelists.inc; the suite runs in
about 30s on qemux86-64.
Validated on qemux86-64:
- 17 C unit tests pass
- 85 shell tests pass
- 2 skip (jbig, thumbnail)
- 0 fail
Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
---
v4:
- Regenerate the embedded test_ifd_loop_detection patch against tiff
4.7.2 so it applies without fuzz (reported by the autobuilder).
v3:
- Fix test_ifd_loop_detection on non-x86 architectures. It opened its
images through the build-time SOURCE_DIR path, which does not exist in
the installed ptest; a small upstream patch makes it read them relative
to ".", like the other tests. This replaces the run-ptest symlink that
v2 used to fake that path.
- Reword the commit message per review.
v2:
- Drop the INSANE_SKIP buildpaths; the test binaries package cleanly.
- Drop make and bash from RDEPENDS (run-ptest calls neither).
- Define the C test program list once (TIFF_PTEST_PROGS) instead of
duplicating it in run-ptest.
.../distro/include/ptest-packagelists.inc | 1 +
.../recipes-multimedia/libtiff/tiff/run-ptest | 23 ++++++++++
...t_ifd_loop_detection-relative-images.patch | 34 +++++++++++++++
meta/recipes-multimedia/libtiff/tiff_4.7.2.bb | 42 ++++++++++++++++++-
4 files changed, 99 insertions(+), 1 deletion(-)
create mode 100755 meta/recipes-multimedia/libtiff/tiff/run-ptest
create mode 100644 meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
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..ebf11c9
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/run-ptest
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Run the libtiff test suite and emit ptest-style PASS/FAIL/SKIP lines.
+cd "$(dirname "$0")/test" || exit 1
+
+
+# @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/test_ifd_loop_detection-relative-images.patch b/meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
new file mode 100644
index 0000000..c46e74d
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/test_ifd_loop_detection-relative-images.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
+Date: Tue, 22 Sep 2026 00:00:00 +0000
+Subject: [PATCH] test_ifd_loop_detection: find images relative to CWD
+
+test_ifd_loop_detection is the only C test in the suite that references
+its input images through the compile-time SOURCE_DIR macro
+(-DSOURCE_DIR="@srcdir@") instead of opening them relative to the current
+working directory the way every other test does. When the test is run
+from an installed location (for example an OpenEmbedded ptest package)
+the build-time @srcdir@ path no longer exists, so the images are not
+found and the test fails.
+
+Override SOURCE_DIR to "." so the images are resolved relative to the
+directory the test is executed from, matching the behaviour of the other
+tests. In-tree "make check" still works because it runs the test from the
+build test/ directory whose srcdir is already ".".
+
+Upstream-Status: Submitted [libtiff]
+
+Signed-off-by: Himani Ramesh Barde <HimaniRamesh.Barde@windriver.com>
+---
+--- a/test/test_ifd_loop_detection.c
++++ b/test/test_ifd_loop_detection.c
+@@ -46,6 +46,9 @@
+
+ #include "tiffio.h"
+
++#undef SOURCE_DIR
++#define SOURCE_DIR "."
++
+ // #define DEBUG_TESTING
+ #ifdef DEBUG_TESTING
+ #define GOTOFAILURE \
diff --git a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
index 8bc3a48..767b295 100644
--- a/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
+++ b/meta/recipes-multimedia/libtiff/tiff_4.7.2.bb
@@ -9,6 +9,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.md;md5=4ab490c3088a0acff254eb2f8c577547"
CVE_PRODUCT = "libtiff"
SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
+ file://test_ifd_loop_detection-relative-images.patch \
+ file://run-ptest \
"
SRC_URI[sha256sum] = "672bd7d10aee4606171afb864f3570b83340f6a33e2c186dc0512f7145ffdf6a"
@@ -23,7 +25,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 +66,41 @@ 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 C test program list from TIFF_PTEST_PROGS.
+ sed -i -e "s|@PROGS@|${TIFF_PTEST_PROGS}|" ${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] 3+ messages in thread
end of thread, other threads:[~2026-09-30 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260921100952.2619282-1-HimaniRamesh.Barde@windriver.com>
2026-09-25 8:05 ` [PATCH v3] tiff: add ptest support Himani Ramesh Barde
2026-09-27 7:32 ` [OE-core] " Mathieu Dubois-Briand
2026-09-30 7:34 ` [PATCH v4] " Himani Ramesh Barde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox