| Message ID | 20251031062405.122538-1-nikhil.r@bmwtechworks.in | 
|---|---|
| State | New | 
| Headers | show | 
| Series | [scarthgap] inotify-tools: add ptest support for inotify-tools | expand | 
On 10/31/25 07:24, Nikhil R via lists.openembedded.org wrote: > 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: > :~# ptest-runner inotify-tools > START: ptest-runner > 2025-10-30T08:38 > 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: 15 > END: /usr/lib/inotify-tools/ptest > 2025-10-30T08:38 > STOP: ptest-runner > TOTAL: 1 FAIL: 0 It seems this has no PASS/FAIL status: https://wiki.yoctoproject.org/wiki/Ptest#Implementing_ptest_in_a_package_recipe Due to this it can't be evaluated in an automated way. > 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 | 21 +++++++++++++++++++ > .../inotify-tools/inotify-tools_3.22.6.0.bb | 16 +++++++++++++- > 2 files changed, 36 insertions(+), 1 deletion(-) > create mode 100644 meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest > > 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..1bd51248d8 > --- /dev/null > +++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest > @@ -0,0 +1,21 @@ > +#!/bin/sh > +# run-ptest for inotify-tools > + > +set -e > + > +# Run the test binary and capture output > +output=$(./test 2>&1) > +status=$? > + > +# Print the output for logging > +echo "$output" > + I don't really understand this, why is the output buffered in a variable? Also, due to "set -e" the output won't be visible if the test fails. Am I missing something? > +# Evaluate result based on exit code > +if [ $status -eq 0 ]; then > + echo "All tests passed successfully." > + exit 0 > +else > + echo "Test program exited with status $status." > + echo "Some tests may have failed. See output above for details." > + exit 1 > +fi > 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}" > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#121224): https://lists.openembedded.org/g/openembedded-devel/message/121224 > Mute This Topic: https://lists.openembedded.org/mt/116044057/6084445 > Group Owner: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [skandigraun@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Hi Gyorgy, Thanks for the feedback you're right, capturing the test output in a variable causes buffering, and with set -e, the output wouldn’t appear if the test fails , I’ll update the script and send back
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..1bd51248d8 --- /dev/null +++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest @@ -0,0 +1,21 @@ +#!/bin/sh +# run-ptest for inotify-tools + +set -e + +# Run the test binary and capture output +output=$(./test 2>&1) +status=$? + +# Print the output for logging +echo "$output" + +# Evaluate result based on exit code +if [ $status -eq 0 ]; then + echo "All tests passed successfully." + exit 0 +else + echo "Test program exited with status $status." + echo "Some tests may have failed. See output above for details." + exit 1 +fi 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}"
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: :~# ptest-runner inotify-tools START: ptest-runner 2025-10-30T08:38 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: 15 END: /usr/lib/inotify-tools/ptest 2025-10-30T08:38 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 | 21 +++++++++++++++++++ .../inotify-tools/inotify-tools_3.22.6.0.bb | 16 +++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-support/inotify-tools/inotify-tools/run-ptest