diff mbox series

[5/5] libexif: rewrite ptest handling

Message ID 20251218174248.2580279-5-ross.burton@arm.com
State New
Headers show
Series [1/5] scripts/makefile-getvar: be more resilient | expand

Commit Message

Ross Burton Dec. 18, 2025, 5:42 p.m. UTC
What started as replacing the installation of libtool wrapper scripts
ended up being a rewrite of the ptest integration.

There are only ~15 tests so we can install the binaries with libtool,
extract the test names from the Makefile, and just run them with a few
lines of shell.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../recipes-support/libexif/libexif/run-ptest | 34 +++++++++++++++++--
 .../recipes-support/libexif/libexif_0.6.25.bb | 21 ++++--------
 2 files changed, 38 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-support/libexif/libexif/run-ptest b/meta/recipes-support/libexif/libexif/run-ptest
index 2d23159eb03..6a50f64822a 100644
--- a/meta/recipes-support/libexif/libexif/run-ptest
+++ b/meta/recipes-support/libexif/libexif/run-ptest
@@ -1,3 +1,33 @@ 
-#!/bin/sh
+#! /bin/sh
 
-make -o Makefile runtest-TESTS
+all=0
+passed=0
+failed=0
+skipped=0
+
+for t in @TESTS@; do
+    "./$t"
+    case "$?" in
+        0)
+            echo "PASS: $t"
+            passed=$((passed + 1))
+            ;;
+        77)
+            echo "SKIP: $t"
+            skipped=$((skipped + 1))
+            ;;
+        *)
+            echo "FAIL: $t"
+            failed=$((failed + 1))
+            ;;
+    esac
+    all=$((all + 1))
+done
+
+if [ "$failed" -eq 0 ]; then
+    echo "All $all tests passed ($skipped skipped)"
+    exit 0
+else
+    echo "$failed of $all tests failed ($skipped skipped)"
+    exit 1
+fi
diff --git a/meta/recipes-support/libexif/libexif_0.6.25.bb b/meta/recipes-support/libexif/libexif_0.6.25.bb
index 59c22753d04..c57855303f4 100644
--- a/meta/recipes-support/libexif/libexif_0.6.25.bb
+++ b/meta/recipes-support/libexif/libexif_0.6.25.bb
@@ -23,25 +23,16 @@  do_compile_ptest() {
 }
 
 do_install_ptest() {
-    install ${B}/test/test*[!\.o] ${D}${PTEST_PATH}
-    for f in ${D}${PTEST_PATH}/test*; do
-        sed -i "s/\(LD_LIBRARY_PATH=\).*\(:\$LD_LIBRARY_PATH\)\"/\1.\2/" $f
-    done
-
-    install ${B}/test/Makefile ${D}${PTEST_PATH}
-    sed -i -e "/^srcdir/c srcdir = \$\{PWD\}" ${D}${PTEST_PATH}/Makefile
-
-    install -d ${D}${PTEST_PATH}/nls
-    install ${B}/test/nls/*[!\.o] ${D}${PTEST_PATH}/nls
-    install -d ${D}${PTEST_PATH}/.libs
-    install ${B}/test/.libs/* ${D}${PTEST_PATH}/.libs
-
     install ${S}/test/*.sh ${D}${PTEST_PATH}
 
+    for file in $(find ${B}/test/test-* -executable -type f); do
+        ${B}/libtool --mode=install install $file ${D}/${PTEST_PATH}
+    done
+
     install -d ${D}${PTEST_PATH}/testdata
     install ${S}/test/testdata/* ${D}${PTEST_PATH}/testdata
+
+    sed -i -e "s/@TESTS@/$(makefile-getvar ${B}/test/Makefile TESTS)/" ${D}${PTEST_PATH}/run-ptest
 }
 
-RDEPENDS:${PN}-ptest += "make bash"
-
 BBCLASSEXTEND = "native nativesdk"