diff mbox series

[meta-oe,master] inotify-tools: add ptest support for inotify-tools

Message ID 20251024101646.924946-1-Sana.Kazi@bmwtechworks.in
State Under Review
Headers show
Series [meta-oe,master] inotify-tools: add ptest support for inotify-tools | expand

Commit Message

Sana Kazi Oct. 24, 2025, 10:16 a.m. UTC
From: Nikhil R <nikhil.r@bmwtechworks.in>

Add ptest support for inotify-tools by introducing a run-ptest script.
The ptest verifies the correct functioning of inotify event handling
and related utilities.

Test coverage includes:
 - File creation, modification, and deletion event monitoring
 - Event handling and command-line option parsing
 - Basic consistency and behavior of inotify event queues

The ptest completes in under 20 seconds

Signed-off-by: Nikhil R <nikhil.r@bmwtechworks.in>
---
 .../inotify-tools/files/run-ptest             | 21 +++++++++++++++++++
 .../inotify-tools/inotify-tools_4.25.9.0.bb   | 16 +++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/inotify-tools/files/run-ptest
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/inotify-tools/files/run-ptest b/meta-oe/recipes-support/inotify-tools/files/run-ptest
new file mode 100644
index 0000000000..f3b23d86f0
--- /dev/null
+++ b/meta-oe/recipes-support/inotify-tools/files/run-ptest
@@ -0,0 +1,21 @@ 
+#!/bin/sh
+# run-ptest for inotify-tools
+
+set -e
+
+# Run the test binary and capture output
+output=$(./test)
+
+# Print the output for logging
+echo "$output"
+
+# Extract the summary line
+summary=$(echo "$output" | tail -n 1)
+
+# Check if any tests failed
+if echo "$summary" | grep -q "0 failed"; then
+    exit 0
+else
+    echo "Some tests failed!"
+    exit 1
+fi
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools_4.25.9.0.bb b/meta-oe/recipes-support/inotify-tools/inotify-tools_4.25.9.0.bb
index a107925ce1..a03b835641 100644
--- a/meta-oe/recipes-support/inotify-tools/inotify-tools_4.25.9.0.bb
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools_4.25.9.0.bb
@@ -7,10 +7,11 @@  LIC_FILES_CHKSUM = "file://COPYING;md5=ac6c26e52aea428ee7f56dc2c56424c6"
 SRCREV = "81c6c9881edf4844f2b8250e63f82da9cb7f5444"
 
 SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https \
+           file://run-ptest \
            "
 
 
-inherit autotools
+inherit autotools ptest
 
 EXTRA_OECONF = "--disable-doxygen"
 
@@ -21,3 +22,16 @@  CFLAGS += "-Wno-error"
 PACKAGES =+ "libinotifytools"
 
 FILES:libinotifytools = "${libdir}/lib*.so.*"
+
+do_compile_ptest() {
+        cd libinotifytools/src
+        oe_runmake
+        oe_runmake test
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}
+    cp -r ${B}/libinotifytools/src/.libs/test ${D}${PTEST_PATH}/
+}
+
+FILES:${PN}-ptest += "${PTEST_PATH}"