@@ -122,6 +122,7 @@ PTESTS_SLOW = "\
libmodule-build-perl \
libpng \
${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'libseccomp', '',d)} \
+ libsamplerate0 \
lttng-tools \
lz4 \
openssh \
new file mode 100644
@@ -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 "$(basename "$0")" \
+ ! -name ".*" \
+ -printf '%f\n' \
+| 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
@@ -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
+}
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