public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [OE-core][master][PATCH v2] libsamplerate0: Adding ptest for libsamplerate0
@ 2026-03-23  9:22 Shaik Moin
  2026-03-26 14:05 ` Ross Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Shaik Moin @ 2026-03-23  9:22 UTC (permalink / raw)
  To: openembedded-core; +Cc: careers.myinfo

Executables Description:
 callback_hang_test		-	Verifies that callback-based processing does not hang and that the library properly returns control without deadlocks.
 callback_test			-	Tests the callback-driven processing mode of libsamplerate (SRC's non-blocking interface).
 clone_test			-	Ensures the SRC state objects can be cloned correctly and continue producing identical output.
 downsample_test		-	Tests accuracy and behavior when downsampling audio (reducing sample rate).
 float_short_test		-	Tests conversions between float and short integer sample formats.
 misc_test			-	Runs assorted sanity and utility tests that don't fit into other categories.
 multi_channel_test		-	Verifies correct handling of multi-channel audio (e.g., stereo, 5.1) during sample-rate conversion.
 multichan_throughput_test	-	Measures throughput and performance for multi-channel SRC processing.
 nullptr_test			-	Ensures libsamplerate properly rejects or handles NULL pointers and invalid state.
 reset_test			-	Tests the reset() behavior - state clearing, flushing buffers, resetting filters.
 simple_test			-	The most basic test of sample-rate conversion functionality - often converting a small buffer to ensure fundamental correctness.
 snr_bw_test			-	Measures Signal - Noise Ratio (SNR) and bandwidth performance for different converter algorithms.
 src-evaluate			-	Evaluates internal SRC filter performance, quality, and algorithmic behavior.
 termination_test		-	Ensures end - stream / termination behavior is handled correctly without artifacts or crashes.
 throughput_test		-	Benchmarks throughput for mono or simple use cases to measure raw processing speed.
 varispeed_test			-	Tests variable sample-rate operation (changing SRC ratio on the fly).

Time taken to execute the ptest:- Approx ~3 mins

Signed-off-by: Shaik Moin <moins@kpit.com>
---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../libsamplerate/files/run-ptest             | 51 +++++++++++++++++++
 .../libsamplerate/libsamplerate0_0.2.2.bb     | 34 ++++++++++++-
 3 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-multimedia/libsamplerate/files/run-ptest

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index d0c2c2816c..bf1605e78b 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -127,6 +127,7 @@ PTESTS_SLOW = "\
     libmodule-build-perl \
     libpng \
     ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'libseccomp', '',d)} \
+    libsamplerate0 \
     lttng-tools \
     lz4 \
     openssh \
diff --git a/meta/recipes-multimedia/libsamplerate/files/run-ptest b/meta/recipes-multimedia/libsamplerate/files/run-ptest
new file mode 100644
index 0000000000..0e2afde1f6
--- /dev/null
+++ b/meta/recipes-multimedia/libsamplerate/files/run-ptest
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+DIR="."
+
+total=0
+pass=0
+fail=0
+
+list_tmp="$(mktemp)"
+
+# Build list of test executables, excluding this runner script
+# Portable: use -perm -u+x instead of -executable
+find "$DIR" -maxdepth 1 -type f -perm -u+x 2>/dev/null \
+  ! -name run-ptest \
+  ! -name ".*" \
+| sed 's|^\./||' \
+| LC_ALL=C sort > "$list_tmp"
+
+echo "----- Executables are:-----"
+if [ -s "$list_tmp" ]; then
+    cat "$list_tmp"
+else
+    echo "(none)"
+fi
+echo "----------------------------------------------"
+
+while IFS= read -r T; do
+    [ -n "$T" ] || continue
+    echo "Running $T"
+    total=$((total + 1))
+
+    if "$DIR/$T"; then
+        echo "PASS: $T"
+        pass=$((pass + 1))
+    else
+        status=$?
+        echo "FAIL: $T (exit=$status)"
+        fail=$((fail + 1))
+    fi
+done < "$list_tmp"
+
+rm -f "$list_tmp"
+
+echo "============================================================================"
+echo "# TOTAL: $total"
+echo "# PASS:  $pass"
+echo "# FAIL:  $fail"
+echo "============================================================================"
+
+# Exit non-zero if any test failed
+[ "$fail" -eq 0 ] && exit 0 || exit 1
diff --git a/meta/recipes-multimedia/libsamplerate/libsamplerate0_0.2.2.bb b/meta/recipes-multimedia/libsamplerate/libsamplerate0_0.2.2.bb
index 819096878b..8a0fe4e108 100644
--- a/meta/recipes-multimedia/libsamplerate/libsamplerate0_0.2.2.bb
+++ b/meta/recipes-multimedia/libsamplerate/libsamplerate0_0.2.2.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=336d6faf40fb600bafb0061f4052f1f4 \
 DEPENDS = "libsndfile1"
 
 SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/libsamplerate-${PV}.tar.xz \
+           file://run-ptest \
 "
 
 SRC_URI[sha256sum] = "3258da280511d24b49d6b08615bbe824d0cacc9842b0e4caf11c52cf2b043893"
@@ -18,9 +19,40 @@ GITHUB_BASE_URI = "https://github.com/libsndfile/libsamplerate/releases"
 
 S = "${UNPACKDIR}/libsamplerate-${PV}"
 
-inherit autotools pkgconfig github-releases
+inherit autotools pkgconfig github-releases ptest
 
 # FFTW and ALSA are only used in tests and examples, so they don't affect
 # normal builds. It should be safe to ignore these, but explicitly disabling
 # them adds some extra certainty that builds are deterministic.
 EXTRA_OECONF = "--disable-fftw --disable-alsa"
+do_compile:append() {
+    oe_runmake buildtest-TESTS
+}
+
+do_install_ptest() {
+    t=${D}${PTEST_PATH}
+
+    #    This lets libtool do any needed relinking and install the right binary.
+    if [ -x "${B}/libtool" ] && [ -d "${B}/tests" ]; then
+        find "${B}/tests" -maxdepth 1 -type f -perm -111 2>/dev/null \
+        | while IFS= read -r wrapper; do
+            bn=$(basename "$wrapper")
+            case "$bn" in
+                *.a|*.la|*.o|*.lo|*.la~) continue ;;
+            esac
+            [ -e "$t/$bn" ] && continue
+            # Install via libtool using the wrapper
+            "${B}/libtool" --mode=install install -c "$wrapper" "$t/$bn"
+        done
+    fi
+
+    #    install them directly.
+    if [ -d "${B}/tests/.libs" ]; then
+        find "${B}/tests/.libs" -maxdepth 1 -type f -perm -111 2>/dev/null \
+        | while IFS= read -r realbin; do
+            bn=$(basename "$realbin")
+            [ -e "$t/$bn" ] && continue
+            install -m 0755 "$realbin" "$t/$bn"
+        done
+    fi
+}
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core][master][PATCH v2] libsamplerate0: Adding ptest for libsamplerate0
  2026-03-23  9:22 [OE-core][master][PATCH v2] libsamplerate0: Adding ptest for libsamplerate0 Shaik Moin
@ 2026-03-26 14:05 ` Ross Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Burton @ 2026-03-26 14:05 UTC (permalink / raw)
  To: careers.myinfo@gmail.com; +Cc: openembedded-core@lists.openembedded.org

Hi,

> On 23 Mar 2026, at 09:22, Shaik Moin via lists.openembedded.org <careers.myinfo=gmail.com@lists.openembedded.org> wrote:

First, your From address doesn’t match your Signed-off-by and isn’t obviously your address.  If you have problems sending email from your @kpit.com address then I suggest you look at using `b4 send` instead: this lets you post patches without having to actually send email.

> +find "$DIR" -maxdepth 1 -type f -perm -u+x 2>/dev/null \
> +  ! -name run-ptest \
> +  ! -name ".*" \
> +| sed 's|^\./||' \
> +| LC_ALL=C sort > "$list_tmp"
> +
> +echo "----- Executables are:-----"
> +if [ -s "$list_tmp" ]; then
> +    cat "$list_tmp"
> +else
> +    echo "(none)"
> +fi
> +echo "----------------------------------------------"
> +
> +while IFS= read -r T; do

If you just put the test binaries into a subdirectory, you can just iterate over them without needing ten lines of complex logic.

> +do_install_ptest() {
> +    t=${D}${PTEST_PATH}
> +
> +    #    This lets libtool do any needed relinking and install the right binary.
> +    if [ -x "${B}/libtool" ] && [ -d "${B}/tests" ]; then
> +        find "${B}/tests" -maxdepth 1 -type f -perm -111 2>/dev/null \
> +        | while IFS= read -r wrapper; do
> +            bn=$(basename "$wrapper")
> +            case "$bn" in
> +                *.a|*.la|*.o|*.lo|*.la~) continue ;;
> +            esac
> +            [ -e "$t/$bn" ] && continue
> +            # Install via libtool using the wrapper
> +            "${B}/libtool" --mode=install install -c "$wrapper" "$t/$bn"
> +        done
> +    fi
> +
> +    #    install them directly.
> +    if [ -d "${B}/tests/.libs" ]; then
> +        find "${B}/tests/.libs" -maxdepth 1 -type f -perm -111 2>/dev/null \
> +        | while IFS= read -r realbin; do
> +            bn=$(basename "$realbin")
> +            [ -e "$t/$bn" ] && continue
> +            install -m 0755 "$realbin" "$t/$bn"
> +        done
> +    fi
> +}

Why is there a block for if libsamplerate0 was built without libtool, but also assumes the libtool directory structure? That makes no sense.

Instead of complex find/while/read loops you can just do something like:

for t in $(makefile-getvar ${B}/Makefile TESTS); do
  ${B}/libtool —mode=install install ${B}/$t ${D}${PTEST_DIR}/$(basename $t)
done

(makefile-getvar is a utility in oe-core/scripts to get the value of a makefile variable)

Ross


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-26 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23  9:22 [OE-core][master][PATCH v2] libsamplerate0: Adding ptest for libsamplerate0 Shaik Moin
2026-03-26 14:05 ` Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox