* [OE-core][PATCH v1] zstd: add ptest support
@ 2026-05-08 8:34 Pratik Farkase
2026-05-19 8:34 ` Antonin Godard
2026-05-19 9:08 ` [PATCH v2] " Pratik Farkase
0 siblings, 2 replies; 5+ messages in thread
From: Pratik Farkase @ 2026-05-08 8:34 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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 0918507ce5..ccac8e3bb3 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -151,6 +151,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 166b4ded63..1c82a9042f 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -44,6 +44,7 @@ QB_MEM:virtclass-mcextend-python3-cryptography = "-m 5100"
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-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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [OE-core][PATCH v1] zstd: add ptest support
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 ` [PATCH v2] " Pratik Farkase
1 sibling, 1 reply; 5+ messages in thread
From: Antonin Godard @ 2026-05-19 8:34 UTC (permalink / raw)
To: Pratik Farkase, openembedded-core; +Cc: pratik.farkase
Hi,
Sorry, this patch no longer applies on master, due to conflicts with the QB_MEM
assignment. Could you rebase and resend?
Antonin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core][PATCH v1] zstd: add ptest support
2026-05-19 8:34 ` Antonin Godard
@ 2026-05-19 9:09 ` Pratik Farkase
0 siblings, 0 replies; 5+ messages in thread
From: Pratik Farkase @ 2026-05-19 9:09 UTC (permalink / raw)
To: Antonin Godard, openembedded-core@lists.openembedded.org
Cc: pratik.farkase@ericsson.com
Hi Antonin,
Rebased on current master in v2. No functional changes.
Best Regards,
Pratik
________________________________________
From: Antonin Godard <antonin.godard@bootlin.com>
Sent: Tuesday, May 19, 2026 10:34 AM
To: Pratik Farkase; openembedded-core@lists.openembedded.org
Cc: pratik.farkase@ericsson.com
Subject: Re: [OE-core][PATCH v1] zstd: add ptest support
Hi,
Sorry, this patch no longer applies on master, due to conflicts with the QB_MEM
assignment. Could you rebase and resend?
Antonin
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] zstd: add ptest support
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:08 ` Pratik Farkase
2026-06-08 14:05 ` [OE-core] " Ross Burton
1 sibling, 1 reply; 5+ messages in thread
From: Pratik Farkase @ 2026-05-19 9:08 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [OE-core] [PATCH v2] zstd: add ptest support
2026-05-19 9:08 ` [PATCH v2] " Pratik Farkase
@ 2026-06-08 14:05 ` Ross Burton
0 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2026-06-08 14:05 UTC (permalink / raw)
To: pratik.farkase@est.tech
Cc: openembedded-core@lists.openembedded.org,
pratik.farkase@ericsson.com
On 19 May 2026, at 10:08, Pratik Farkase via lists.openembedded.org <pratik.farkase=est.tech@lists.openembedded.org> wrote:
>
> 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
The primary goal of the ptests is integration testing so if we’re having to manually install and run the tests then it’s entirely reasonable if not desirable to pick a subset of the tests.
In this case, we don’t need to run the fuzzer tests and so on. I’d suggest maybe just fullbench and cli-tests would be sufficient here, less to install and faster execution.
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-08 14:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2] " Pratik Farkase
2026-06-08 14:05 ` [OE-core] " Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox