]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
libexif: rewrite ptest handling
authorRoss Burton <ross.burton@arm.com>
Thu, 18 Dec 2025 17:42:47 +0000 (17:42 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 22 Dec 2025 17:54:58 +0000 (17:54 +0000)
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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-support/libexif/libexif/run-ptest
meta/recipes-support/libexif/libexif_0.6.25.bb

index 2d23159eb03ab7b5a859b9b46597f88aedc0fb48..6a50f64822a0aedfeadee8cf5b93b6edaa45d21e 100644 (file)
@@ -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
index 59c22753d04aa91268ac7f075723d20e02c6344b..c57855303f4e81892b2d440739de5eb563dde223 100644 (file)
@@ -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
-}
 
-RDEPENDS:${PN}-ptest += "make bash"
+    sed -i -e "s/@TESTS@/$(makefile-getvar ${B}/test/Makefile TESTS)/" ${D}${PTEST_PATH}/run-ptest
+}
 
 BBCLASSEXTEND = "native nativesdk"