Skip to contentSkip to conversation

libmd: add ptest for 'libmd'

PATCH New Naman Jain 1 participant 1 message Sep 19, 2025

lore
Share & tools
lore

Naman Jain

author
#0 lore raw

PATCH 1/1 libmd: add ptest for 'libmd'

Adapt the compile 'test' phony target from Makefile and deploy as ptest for libmd.
It takes less than 30seconds for ptest completion

---
 meta/recipes-support/libmd/files/run-ptest | 18 ++++++++++++++++++
 meta/recipes-support/libmd/libmd_1.1.0.bb  | 17 ++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-support/libmd/files/run-ptest
meta/recipes-support/libmd/files/run-ptest new file +18 -0
new file mode 100644
index 0000000000..0c4a5f64ec
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+cd test
+status = 0
+
+for testbin in *; do
+    if [ -x "$testbin" ] && [ ! -d "$testbin" ]; then
+        if "./$testbin"; then
+            echo "PASS: $testbin"
+        else
+            echo "FAIL: $testbin"
+            status=1
+        fi
+    fi
+done
+
+return $status
+
meta/recipes-support/libmd/libmd_1.1.0.bb +16 -1
index dc588a0f95..a39a5ec65b 100644
@@ -11,6 +11,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0436d4fb62a71f661d6e8b7812f9e1df"
 SRC_URI = "https://archive.hadrons.org/software/libmd/libmd-${PV}.tar.xz"
 SRC_URI[sha256sum] = "1bd6aa42275313af3141c7cf2e5b964e8b1fd488025caf2f971f43b00776b332"
 
-inherit autotools
+inherit autotools ptest
+
+do_compile_ptest() {
+    sed -i "/\$(MAKE) \$(AM_MAKEFLAGS) check-TESTS/d" test/Makefile
+    oe_runmake check
+}
+
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/test
+    for bin in ${B}/test/*; do
+        if [ -x "$bin" ]; then
+            libtool --mode=install install "$bin" ${D}${PTEST_PATH}/test/$(basename "$bin")
+        fi
+    done
+}
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.34.1