@@ -105,6 +105,7 @@ PTESTS_FAST = "\
wayland \
xz \
zlib \
+ zstd \
"
PTESTS_FAST:remove:mips64 = "qemu"
PTESTS_PROBLEMS:append:mips64 = " qemu"
new file mode 100644
@@ -0,0 +1,18 @@
+#!/bin/sh
+# SPDX-License-Identifier: MIT
+
+cd "$(dirname "$0")/tests" || exit 1
+
+run_test() {
+ name=$1; shift
+ if "$@"; then echo "PASS: $name"; else echo "FAIL: $name"; fi
+}
+
+run_test fullbench ./fullbench -i1
+
+if [ -d cli-tests ] && command -v python3 >/dev/null 2>&1; then
+ ./cli-tests/run.py --exec-prefix="" --zstd="$(command -v zstd)" --datagen=./datagen
+ run_test cli-tests test $? -eq 0
+else
+ echo "SKIP: cli-tests"
+fi
@@ -12,7 +12,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=0822a32f7acdbe013606746641746ee8 \
file://COPYING;md5=39bba7d2cf0ba1036f2a6e2be52fe3f0 \
"
-SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https;tag=v${PV}"
+SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https;tag=v${PV} \
+ file://run-ptest \
+ "
SRCREV = "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
@@ -44,3 +46,40 @@ PACKAGE_BEFORE_PN = "libzstd"
FILES:libzstd = "${libdir}/libzstd${SOLIBS}"
BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+do_compile_ptest() {
+ oe_runmake -C ${S}/tests fullbench datagen \
+ ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+
+ # Test binaries
+ install -m 0755 ${S}/tests/fullbench ${D}${PTEST_PATH}/tests/
+ install -m 0755 ${S}/tests/datagen ${D}${PTEST_PATH}/tests/
+
+ # cli-tests
+ cp -r ${S}/tests/cli-tests ${D}${PTEST_PATH}/tests/
+
+ # Golden test data needed by cli-tests
+ for d in golden-compression golden-decompression golden-dictionaries; do
+ cp -r ${S}/tests/$d ${D}${PTEST_PATH}/tests/
+ done
+
+ # Remove tests incompatible with ptest environment:
+ # levels.sh: --ultra/--max levels require >8GB RAM
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/compression/levels.sh
+ # window-resize.sh: 1GB window size requires >4GB RAM
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/compression/window-resize.sh
+ # compress-file-to-dir-without-write-perm.sh: ptest runs as root,
+ # which bypasses filesystem permission checks
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh
+ # cltools/: zstdgrep requires GNU grep --label option not available
+ # in BusyBox grep
+ rm -rf ${D}${PTEST_PATH}/tests/cli-tests/cltools
+}
+
+RDEPENDS:${PN}-ptest += "bash python3-core python3-modules"
Add ptest support for zstd running fullbench and the upstream cli-tests suite, providing integration testing of compression, decompression, dictionaries, file handling, and CLI behavior. Tests included: - fullbench: validates all internal compression/decompression functions - cli-tests: 36 shell-based integration tests covering compression, decompression, dictionaries, file-stat, progress, symlinks, and multi-threading Tested on qemux86-64 with ptest-runner: fullbench PASS, cli-tests 36/36 PASS. Runtime is ~32 seconds. Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> --- Changes in v3: - Reduced test scope to fullbench + cli-tests only - Removed fuzzer, zstreamtest, decodecorpus, poolTests, invalidDictionaries, legacy, and playTests.sh - No longer requires 4GB RAM (removed QB_MEM override) - Moved from PTESTS_SLOW to PTESTS_FAST (~32s runtime vs ~13min in v2) Changes in v2: - Added source .c/.h files as training corpus for dictionary builder tests - Fixed cli-tests invocation .../distro/include/ptest-packagelists.inc | 1 + meta/recipes-extended/zstd/zstd/run-ptest | 18 ++++++++ meta/recipes-extended/zstd/zstd_1.5.7.bb | 41 ++++++++++++++++++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-extended/zstd/zstd/run-ptest