Hi Himani,

I'll review this before Ross Burton gets to it ! ;-)

On 2026-09-15 03:36, Himani Ramesh Barde 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 run-ptest wrapper emits automake-style PASS/FAIL/SKIP results and
skips the JBIG test (JBIG is not in the default PACKAGECONFIG) and the
thumbnail test (the thumbnail tool is not built by default).

The recipe is registered in ptest-packagelists.inc (PTESTS_SLOW), and

What was the execution time that determined that you would add this to slow.

buildpaths QA is skipped for the -ptest package since the compiled test
binaries legitimately embed build paths.

Well, maybe not legitimately but we haven't yet demanded that the ptest code be reproducbile AFAIK.


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

Why were 2 skipped ?
Specify how many tests were run for those curious and since you have that data on hand.


Signed-off-by: Himani Ramesh Barde<[email protected]>
---
  .../distro/include/ptest-packagelists.inc     |  1 +
  .../recipes-multimedia/libtiff/tiff/run-ptest | 31 ++++++++++++++
  meta/recipes-multimedia/libtiff/tiff_4.7.2.bb | 42 ++++++++++++++++++-
  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..40301ed
--- /dev/null
+++ b/meta/recipes-multimedia/libtiff/tiff/run-ptest
@@ -0,0 +1,31 @@
+#!/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
+
+CPROGS="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"

Ross will likely have more to say here but my take is:

+1 point for using a list in run-ptest and iterating over it.
-1 point since this list is also in the recipe.

There's likely a way to have the list live in the RECIPE ONLY and
then generate or fill-in the run-ptest script at build time.

Gemini suggested this:

|PTEST_APPS = "app1 app2 app3" SRC_URI += "file://run-ptest" inherit ptest do_install_ptest() { install -m 0755 ${UNPACKDIR}/run-ptest ${D}${PTEST_PATH}/run-ptest # Replace the placeholder with the BitBake variable contents sed -i -e 's/@PTEST_APPS@/${PTEST_APPS}/g' ${D}${PTEST_PATH}/run-ptest } |


There may be better ways.

+
+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..ea4300b 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,42 @@ do_install:append() {
  }
BBCLASSEXTEND = "native nativesdk"
+
+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 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
+        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
+    # test_ifd_loop_detection embeds -DSOURCE_DIR=../../tiff-${PV}/test; fill
+    # that path into run-ptest so it can be symlinked to the installed tests.
+    sed -i -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 += "make bash tiff-utils"
Do we really need 'make ' to run the tests?
I don't see where you call that in run-ptest.

Is bash really a requirement or can we just use whatever POSIX compliant shell in installed ?



As embedded devs, we wince when we see bash being pulled in needlessly. ;-)

Can you check if any scripts that have: #!/bin/bash  pass shellcheck:
https://www.shellcheck.net/
and if so, try running them with just /bin/sh

If that works, you should send a patch / PR to libtiff upstream .

This is good work but it can wait until you hear back from upstream for a v2. Ideally, any patches would have an upstream status of Backport or at least submitted.

+
+# The compiled C test programs embed build paths in debug info; this is
+# expected for ptest binaries and not relevant to the shipped library.
+INSANE_SKIP:${PN}-ptest += "buildpaths"

oe-core.git on master
❯ rg INSANE_SKIP.*ptest | wc -l
10

so this is not the preferred solution.

Some fixes for such insanity will be in the list below:

oe-core.git on master

❯ git log -22 --oneline -G"^INSANE_SKIP.*-ptest"  | rg -v add
a09c0fa79c lttng-tools: Upgrade 2.13.15 -> 2.14.0
8fc31fb235 valgrind: disable ptests
0a6821ca4a gettext: Drop ptest INSANE_SKIPs
e7f221bafb m4: Drop ptest INSANE_SKIPs
df1e2e5bbf python3-packaging: enable ptest
5beb30cdf3 python3-cffi: enable ptest
dc5cd169e8 nettle: rewrite ptest integration
7870364e48 glide: remove as 'go mod' has become standard
cfecef4e69 dbus-test: merge into main dbus recipe
41ecc76c7f elfutils: Fix ptest dependencies
42344347be Convert to new override syntax
3ebfc4fc4e elfutils: silence a new QA warning
7c22dc2e34 libmodule-build-perl: upgrade 0.4229 -> 0.4231
099a2a212f go.bbclass: separate the ptest logic to go-ptest class
e5b8f83d29 go: Remove INSANE_SKIP_* textrel that are now handled in go.bbclass
7d84075830 valgrind: Include debugging symbols in ptests
524fcf3412 nettle: fix ptest failure


See if you can eliminate the embedded build paths. There are likely examples of that in git history as well.
Ask for help if you get stuck.

Good work, v2 in a few weeks please.

--
# Randy MacLeod
# Wind River Linux
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245904): 
https://lists.openembedded.org/g/openembedded-core/message/245904
Mute This Topic: https://lists.openembedded.org/mt/121257807/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to