diff mbox series

[scarthgap,V2] inotify-tools: add ptest support for inotify-tools

Message ID 20251031074206.132589-1-nikhil.r@bmwtechworks.in
State New
Headers show
Series [scarthgap,V2] inotify-tools: add ptest support for inotify-tools | expand

Commit Message

Nikhil R Oct. 31, 2025, 7:42 a.m. UTC
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

output:
root@qemux86-64:~# ptest-runner inotify-tools
START: ptest-runner
2025-10-31T07:27
BEGIN: /usr/lib/inotify-tools/ptest
If you want to do a malloc trace, set MALLOC_TRACE to a path for logging.
event_to_str: test begin
event_to_str: test end
event_to_str_sep: test begin
event_to_str_sep: test end
str_to_event: test begin
str_to_event: test end
str_to_event_sep: test begin
str_to_event_sep: test end
basic_watch_info: test begin
basic_watch_info: test end
watch_limit: test begin
watch_limit: Warning, this test may take a while
watch_limit: test end
tst_inotifytools_snprintf: test begin
tst_inotifytools_snprintf: test end
Out of 362746 tests, 362746 succeeded and 0 failed.
All tests passed successfully.
DURATION: 16
END: /usr/lib/inotify-tools/ptest
2025-10-31T07:27
STOP: ptest-runner
TOTAL: 1 FAIL: 0

Verified that enabling ptest does not modify existing package contents
for inotify-tools

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

Patch

diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest b/meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest
new file mode 100644
index 0000000000..c45b75e387
--- /dev/null
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest
@@ -0,0 +1,15 @@ 
+#!/bin/sh
+# run-ptest for inotify-tools
+
+# Run the test binary and show output
+./test
+status=$?
+
+# Exit with the test’s result code
+if [ $status -eq 0 ]; then
+    echo "All tests passed successfully."
+else
+    echo "Some tests failed. See output above for details."
+fi
+
+exit $status
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb
index 8a0ae17ad7..3629ce45b2 100644
--- a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb
+++ b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb
@@ -10,11 +10,12 @@  SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https \
            file://0002-libinotifytools-Bridge-differences-between-musl-glib.patch \
            file://0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch \
            file://0003-replace-stat64-lstat64-with-stat-lstat.patch \
+           file://run-ptest \
            "
 
 S = "${WORKDIR}/git"
 
-inherit autotools
+inherit autotools ptest
 
 EXTRA_OECONF = "--disable-doxygen"
 
@@ -25,3 +26,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}"