From: Pratik Farkase <pratik.farkase@est.tech>
To: openembedded-core@lists.openembedded.org
Cc: pratik.farkase@ericsson.com, Pratik Farkase <pratik.farkase@est.tech>
Subject: [PATCH v2] zstd: add ptest support
Date: Tue, 19 May 2026 11:08:16 +0200 [thread overview]
Message-ID: <20260519090816.17783-1-pratik.farkase@est.tech> (raw)
In-Reply-To: <20260508083451.11094-1-pratik.farkase@est.tech>
Add comprehensive ptest support for zstd running the full upstream test
suite covering compression correctness, streaming, dictionaries, CLI
behavior, and fuzz testing.
Tests included:
- fullbench: validates all internal compression/decompression functions
- poolTests: thread pool ordering and synchronization
- invalidDictionaries: dictionary error handling
- legacy: legacy format (v0.4+) compatibility
- fuzzer: randomized compression/decompression (200s, ~700+ rounds)
- zstreamtest: streaming API fuzzer (90s, ~250+ rounds)
- decodecorpus: random frame generation and decode (30s, ~450+ rounds)
- playTests.sh: comprehensive CLI validation including compression,
decompression, multithreading, dictionaries, sparse files, frame
concatenation, long distance matching, benchmarks, and round-trips
- cli-tests: 36 Python-based CLI integration tests covering
compression, decompression, progress, file-stat, dictionaries,
symlinks, and file handling
Tests excluded from cli-tests (environment limitations):
- compression/levels.sh: requires >8GB for --ultra/--max levels
- compression/window-resize.sh: requires >4GB for 1GB window
- file-stat/compress-file-to-dir-without-write-perm.sh: ptest runs
as root which bypasses permission checks
- cltools/: requires GNU grep (--label), unavailable with BusyBox
Source .c/.h files from tests/ and programs/ are installed as training
corpus for the dictionary builder tests.
zstreamtest requires 4096MB RAM for (hashLog=29 allocates ~2.8GB).
Set QB_MEM:virtclass-mcextend-zstd = "-m 4096" in core-image-ptest.
Tested on qemux86-64 (4GB) with ptest-runner: 9 PASS, 0 FAIL. Runtime is ~13 min.
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
.../distro/include/ptest-packagelists.inc | 1 +
meta/recipes-core/images/core-image-ptest.bb | 1 +
meta/recipes-extended/zstd/zstd/run-ptest | 27 +++++++++++
meta/recipes-extended/zstd/zstd_1.5.7.bb | 48 ++++++++++++++++++-
4 files changed, 76 insertions(+), 1 deletion(-)
create mode 100755 meta/recipes-extended/zstd/zstd/run-ptest
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 50b6a8a41e..05caa44c43 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -146,6 +146,7 @@ PTESTS_SLOW = "\
tcl \
tcl8 \
util-linux \
+ zstd \
"
# python3 ptests hang on qemuriscv64
diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb
index b20e8ca76d..c9d4414c85 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -45,6 +45,7 @@ QB_MEM:virtclass-mcextend-python3-numpy = "-m 4096"
QB_MEM:virtclass-mcextend-tcl = "-m 5100"
QB_MEM:virtclass-mcextend-go = "-m 4096"
QB_MEM:virtclass-mcextend-gnutls = "-m 1536"
+QB_MEM:virtclass-mcextend-zstd = "-m 4096"
TEST_SUITES = "ping ssh parselogs ptest"
diff --git a/meta/recipes-extended/zstd/zstd/run-ptest b/meta/recipes-extended/zstd/zstd/run-ptest
new file mode 100755
index 0000000000..fe503ce8c9
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/run-ptest
@@ -0,0 +1,27 @@
+#!/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
+run_test poolTests ./poolTests
+run_test invalidDictionaries ./invalidDictionaries
+run_test legacy ./legacy
+run_test fuzzer ./fuzzer -v -T200s
+run_test zstreamtest ./zstreamtest -v -T90s
+run_test decodecorpus ./decodecorpus -t -T30
+
+ZSTD_BIN=$(command -v zstd) DATAGEN_BIN=./datagen ZSTDRTTEST= ./playTests.sh
+run_test playTests test $? -eq 0
+
+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
diff --git a/meta/recipes-extended/zstd/zstd_1.5.7.bb b/meta/recipes-extended/zstd/zstd_1.5.7.bb
index 0e872b95aa..66e326f386 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -10,7 +10,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=0822a32f7acdbe013606746641746ee8 \
file://COPYING;md5=39bba7d2cf0ba1036f2a6e2be52fe3f0 \
"
-SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https"
+SRC_URI = "git://github.com/facebook/zstd.git;branch=release;protocol=https \
+ file://run-ptest \
+ "
SRCREV = "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
@@ -42,3 +44,47 @@ PACKAGE_BEFORE_PN = "libzstd"
FILES:libzstd = "${libdir}/libzstd${SOLIBS}"
BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+PTEST_BINARIES = "datagen fullbench poolTests fuzzer zstreamtest \
+ invalidDictionaries legacy decodecorpus"
+
+do_compile_ptest() {
+ oe_runmake -C ${S}/tests ${PTEST_BINARIES} \
+ ZSTD_LEGACY_SUPPORT=${ZSTD_LEGACY_SUPPORT}
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests ${D}${PTEST_PATH}/programs
+
+ # Test binaries and shell script
+ for t in ${PTEST_BINARIES} playTests.sh; do
+ install -m 0755 ${S}/tests/$t ${D}${PTEST_PATH}/tests/
+ done
+
+ # Test data and cli-tests
+ for d in golden-decompression golden-decompression-errors \
+ golden-compression golden-dictionaries dict-files cli-tests; do
+ cp -r ${S}/tests/$d ${D}${PTEST_PATH}/tests/
+ done
+
+ # Source files used as dictionary training corpus
+ install -m 0644 ${S}/tests/*.c ${D}${PTEST_PATH}/tests/
+ install -m 0644 ${S}/programs/*.c ${S}/programs/*.h ${D}${PTEST_PATH}/programs/
+ install -m 0755 ${S}/programs/zstdgrep ${S}/programs/zstdless ${D}${PTEST_PATH}/programs/
+
+ # Remove tests incompatible with ptest environment:
+ # levels.sh: --ultra/--max levels require >8GB RAM for allocation
+ 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 coreutils python3-core python3-io"
--
2.34.1
next prev parent reply other threads:[~2026-05-19 9:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 8:34 [OE-core][PATCH v1] zstd: add ptest support Pratik Farkase
2026-05-19 8:34 ` Antonin Godard
2026-05-19 9:09 ` Pratik Farkase
2026-05-19 9:08 ` Pratik Farkase [this message]
2026-06-08 14:05 ` [OE-core] [PATCH v2] " Ross Burton
2026-08-26 8:29 ` Pratik Farkase
2026-08-26 8:27 ` [OE-core][PATCH v3] " Pratik Farkase
2026-08-27 10:09 ` Alexander Kanavin
2026-08-27 11:22 ` Pratik Farkase
2026-08-27 11:52 ` Alexander Kanavin
2026-08-31 6:24 ` [OE-core][PATCH v4] " Pratik Farkase
2026-08-31 7:58 ` Mathieu Dubois-Briand
2026-08-31 8:21 ` [OE-core][PATCH v5] " Pratik Farkase
2026-09-02 7:16 ` [OE-core][PATCH v6] " Pratik Farkase
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260519090816.17783-1-pratik.farkase@est.tech \
--to=pratik.farkase@est.tech \
--cc=openembedded-core@lists.openembedded.org \
--cc=pratik.farkase@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.