* [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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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
` (2 more replies)
1 sibling, 3 replies; 14+ 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] 14+ 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
2026-08-26 8:29 ` Pratik Farkase
2026-08-26 8:27 ` [OE-core][PATCH v3] " Pratik Farkase
2026-08-31 6:24 ` [OE-core][PATCH v4] " Pratik Farkase
2 siblings, 1 reply; 14+ 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] 14+ messages in thread
* Re: [OE-core] [PATCH v2] zstd: add ptest support
2026-06-08 14:05 ` [OE-core] " Ross Burton
@ 2026-08-26 8:29 ` Pratik Farkase
0 siblings, 0 replies; 14+ messages in thread
From: Pratik Farkase @ 2026-08-26 8:29 UTC (permalink / raw)
To: Ross Burton
Cc: openembedded-core@lists.openembedded.org,
pratik.farkase@ericsson.com
Hi Ross,
Thanks for the feedback on v2. Sent an improved v3 with the test scope reduced as you suggested. Now only running fullbench and
cli-tests — no fuzzers or stress tests. The result is a much leaner ptest: 36/36 PASS in ~32 seconds on qemux86-64, no extra
memory requirements.
Best Regards,
Pratik
________________________________________
From: Ross Burton <Ross.Burton@arm.com>
Sent: Monday, June 8, 2026 4:05 PM
To: Pratik Farkase
Cc: openembedded-core@lists.openembedded.org; pratik.farkase@ericsson.com
Subject: Re: [OE-core] [PATCH v2] zstd: add ptest support
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] 14+ messages in thread
* [OE-core][PATCH v3] zstd: add ptest support
2026-05-19 9:08 ` [PATCH v2] " Pratik Farkase
2026-06-08 14:05 ` [OE-core] " Ross Burton
@ 2026-08-26 8:27 ` Pratik Farkase
2026-08-27 10:09 ` Alexander Kanavin
2026-08-31 6:24 ` [OE-core][PATCH v4] " Pratik Farkase
2 siblings, 1 reply; 14+ messages in thread
From: Pratik Farkase @ 2026-08-26 8:27 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index ce6c0a2d76..3f3a38f9e4 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -105,6 +105,7 @@ PTESTS_FAST = "\
wayland \
xz \
zlib \
+ zstd \
"
PTESTS_FAST:remove:mips64 = "qemu"
PTESTS_PROBLEMS:append:mips64 = " qemu"
diff --git a/meta/recipes-extended/zstd/zstd/run-ptest b/meta/recipes-extended/zstd/zstd/run-ptest
new file mode 100644
index 0000000000..5d7ba5c352
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/run-ptest
@@ -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
diff --git a/meta/recipes-extended/zstd/zstd_1.5.7.bb b/meta/recipes-extended/zstd/zstd_1.5.7.bb
index ef0bd54c9c..ae52567c8e 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -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"
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [OE-core][PATCH v3] zstd: add ptest support
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
0 siblings, 1 reply; 14+ messages in thread
From: Alexander Kanavin @ 2026-08-27 10:09 UTC (permalink / raw)
To: pratik.farkase; +Cc: openembedded-core, pratik.farkase
On Wed, 26 Aug 2026 at 10:27, Pratik Farkase via
lists.openembedded.org
<pratik.farkase=est.tech@lists.openembedded.org> wrote:
> + # 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
Earlier versions of the patch adjusted RAM allocation for the image,
and this one removes the tests instead. Why was this changed?
Adjusting RAM is better, and it's standard procedure for ptests.
> + # 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
This as well should not be done: rather run ptests as a regular user,
for example look at meta/recipes-extended/cpio/files/run-ptest.
> + # cltools/: zstdgrep requires GNU grep --label option not available
> + # in BusyBox grep
> + rm -rf ${D}${PTEST_PATH}/tests/cli-tests/cltools
This can addressed by adding GNU grep to ptest's package RDEPENDS.
Alex
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core][PATCH v3] zstd: add ptest support
2026-08-27 10:09 ` Alexander Kanavin
@ 2026-08-27 11:22 ` Pratik Farkase
2026-08-27 11:52 ` Alexander Kanavin
0 siblings, 1 reply; 14+ messages in thread
From: Pratik Farkase @ 2026-08-27 11:22 UTC (permalink / raw)
To: Alexander Kanavin
Cc: openembedded-core@lists.openembedded.org,
pratik.farkase@ericsson.com, Ross Burton
Hi Alex,
Thanks for the review. cli-tests now run as the ptest user, GNU grep and less are added to RDEPENDS, and the QEMU image is given 4GB RAM and with these changes, 40 out of 41 cli-tests pass. The only remaining failure is compression/levels.sh, where zstd --max attempts to allocate ~8.5GB (kernel logs: __vm_enough_memory: bytes: 8597475328) on 64-bit systems. This exceeds what we can reasonably provide in a QEMU ptest environment. Would it be acceptable to exclude this single test, or do you have another suggestion?
Best Regards,
Pratik
________________________________________
From: Alexander Kanavin <alex.kanavin@gmail.com>
Sent: Thursday, August 27, 2026 12:09 PM
To: Pratik Farkase
Cc: openembedded-core@lists.openembedded.org; pratik.farkase@ericsson.com
Subject: Re: [OE-core][PATCH v3] zstd: add ptest support
On Wed, 26 Aug 2026 at 10:27, Pratik Farkase via
lists.openembedded.org
<pratik.farkase=est.tech@lists.openembedded.org> wrote:
> + # 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
Earlier versions of the patch adjusted RAM allocation for the image,
and this one removes the tests instead. Why was this changed?
Adjusting RAM is better, and it's standard procedure for ptests.
> + # 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
This as well should not be done: rather run ptests as a regular user,
for example look at meta/recipes-extended/cpio/files/run-ptest.
> + # cltools/: zstdgrep requires GNU grep --label option not available
> + # in BusyBox grep
> + rm -rf ${D}${PTEST_PATH}/tests/cli-tests/cltools
This can addressed by adding GNU grep to ptest's package RDEPENDS.
Alex
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core][PATCH v3] zstd: add ptest support
2026-08-27 11:22 ` Pratik Farkase
@ 2026-08-27 11:52 ` Alexander Kanavin
0 siblings, 0 replies; 14+ messages in thread
From: Alexander Kanavin @ 2026-08-27 11:52 UTC (permalink / raw)
To: Pratik Farkase
Cc: openembedded-core@lists.openembedded.org,
pratik.farkase@ericsson.com, Ross Burton
On Thu, 27 Aug 2026 at 13:22, Pratik Farkase <pratik.farkase@est.tech> wrote:
> Thanks for the review. cli-tests now run as the ptest user, GNU grep and less are added to RDEPENDS, and the QEMU image is given 4GB RAM and with these changes, 40 out of 41 cli-tests pass. The only remaining failure is compression/levels.sh, where zstd --max attempts to allocate ~8.5GB (kernel logs: __vm_enough_memory: bytes: 8597475328) on 64-bit systems. This exceeds what we can reasonably provide in a QEMU ptest environment. Would it be acceptable to exclude this single test, or do you have another suggestion?
It's not easy to suggest one way or the other. We should certainly be
careful with allocating massive amounts of RAM to qemu processes, as
ptests are run in parallel, and it adds up, and can exhaust the RAM on
the build machine.
Is it possible to adjust the test itself, so that it skips the
memory-intensive max level, but otherwise runs?
Alex
^ permalink raw reply [flat|nested] 14+ messages in thread
* [OE-core][PATCH v4] zstd: add ptest support
2026-05-19 9:08 ` [PATCH v2] " Pratik Farkase
2026-06-08 14:05 ` [OE-core] " Ross Burton
2026-08-26 8:27 ` [OE-core][PATCH v3] " Pratik Farkase
@ 2026-08-31 6:24 ` Pratik Farkase
2026-08-31 7:58 ` Mathieu Dubois-Briand
` (2 more replies)
2 siblings, 3 replies; 14+ messages in thread
From: Pratik Farkase @ 2026-08-31 6:24 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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: 41 shell-based integration tests covering compression,
decompression, dictionaries, file-stat, progress, symlinks,
cltools, and multi-threading
The cli-tests run as the ptest user so that permission-related tests
work correctly. The levels.sh test is patched to skip the --max
compression level on systems with less than 10GB RAM, as it allocates
~8.5GB on 64-bit systems.
Tested on qemux86-64 (4GB RAM) with ptest-runner: fullbench PASS,
cli-tests 41/41 PASS. Runtime is ~41 seconds.
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
Changes in v4:
- Run cli-tests as ptest user for permission tests
- Add GNU grep and less to RDEPENDS for cltools tests
- Install zstdgrep/zstdless scripts for cltools tests
- Patch levels.sh to skip --max level on systems with <10GB RAM
Changes in v3:
- Reduced test scope to fullbench + cli-tests only
- Removed fuzzers and stress tests
- Moved from PTESTS_SLOW to PTESTS_FAST
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-core/images/core-image-ptest.bb | 1 +
...std-max-level-when-memory-is-insuffi.patch | 31 ++++++++++++++
meta/recipes-extended/zstd/zstd/run-ptest | 21 ++++++++++
meta/recipes-extended/zstd/zstd_1.5.7.bb | 40 ++++++++++++++++++-
5 files changed, 93 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
create mode 100644 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 ce6c0a2d76..d8eba9dafa 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -150,6 +150,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/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
new file mode 100644
index 0000000000..5652887e38
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Pratik Farkase <pratik.farkase@est.tech>
+Date: Thu, 27 Aug 2026 12:00:00 +0000
+Subject: [PATCH] cli-tests: skip zstd --max level when memory is insufficient
+
+The --max compression level on 64-bit systems allocates ~8.5GB, which
+exceeds what is available in memory-constrained test environments such
+as QEMU. Extend the existing 32-bit skip logic to also check available
+system memory, using the same fallback (copy level-19 output as max).
+
+Upstream-Status: Submitted [https://github.com/facebook/zstd/issues/4748]
+Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
+---
+ tests/cli-tests/compression/levels.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/cli-tests/compression/levels.sh b/tests/cli-tests/compression/levels.sh
+index b8230f2..7846d3e 100755
+--- a/tests/cli-tests/compression/levels.sh
++++ b/tests/cli-tests/compression/levels.sh
+@@ -16,8 +16,8 @@ zstd --fast=10 file -o file-f10.zst -q
+ zstd --fast=1 file -o file-f1.zst -q
+ zstd -1 file -o file-1.zst -q
+ zstd -19 file -o file-19.zst -q
+-if echo "$version_info" | grep -q '32-bit'; then
+- # skip --max test: not enough address space
++if echo "$version_info" | grep -q '32-bit' || [ "$(awk '/MemTotal/{print $2}' /proc/meminfo)" -lt 10000000 ]; then
++ # skip --max test: not enough address space or memory (<10GB)
+ cp file-19.zst file-max.zst
+ else
+ zstd --max file -o file-max.zst -q
diff --git a/meta/recipes-extended/zstd/zstd/run-ptest b/meta/recipes-extended/zstd/zstd/run-ptest
new file mode 100644
index 0000000000..0949e9187a
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/run-ptest
@@ -0,0 +1,21 @@
+#!/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 needs to write to bin/symlinks and scratch dirs.
+ # Run as ptest user so permission-related tests work correctly.
+ chown -R ptest:ptest .
+ su ptest -s /bin/sh -c "./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 ef0bd54c9c..4c3b377c14 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -12,7 +12,10 @@ 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 \
+ file://0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch \
+ "
SRCREV = "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
@@ -44,3 +47,38 @@ 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
+ install -d ${D}${PTEST_PATH}/programs
+
+ # 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
+
+ # zstdgrep/zstdless scripts needed by cltools tests
+ install -m 0755 ${S}/programs/zstdgrep ${D}${PTEST_PATH}/programs/
+ install -m 0755 ${S}/programs/zstdless ${D}${PTEST_PATH}/programs/
+
+ # The levels.sh expected stderr includes set -v traces that change
+ # after patching the memory check. Remove the exact match file so
+ # the test framework ignores stderr comparison.
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/compression/levels.sh.stderr.exact
+}
+
+RDEPENDS:${PN}-ptest += "bash grep less python3-core python3-modules"
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [OE-core][PATCH v4] zstd: add ptest support
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
2 siblings, 0 replies; 14+ messages in thread
From: Mathieu Dubois-Briand @ 2026-08-31 7:58 UTC (permalink / raw)
To: Pratik Farkase, openembedded-core; +Cc: pratik.farkase
On Mon Aug 31, 2026 at 8:24 AM CEST, Pratik Farkase wrote:
> 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: 41 shell-based integration tests covering compression,
> decompression, dictionaries, file-stat, progress, symlinks,
> cltools, and multi-threading
>
> The cli-tests run as the ptest user so that permission-related tests
> work correctly. The levels.sh test is patched to skip the --max
> compression level on systems with less than 10GB RAM, as it allocates
> ~8.5GB on 64-bit systems.
>
> Tested on qemux86-64 (4GB RAM) with ptest-runner: fullbench PASS,
> cli-tests 41/41 PASS. Runtime is ~41 seconds.
>
> Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
> ---
Hi Pratik,
Thanks for adding tests. It looks like some of these are failing on the
autobuilder:
Failed ptests:
{'zstd': ['compression/window-resize.sh',
'compression/window-resize.sh.check_stdout',
'cli-tests']}
https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/4443
Test outputs can be found here:
https://valkyrie.yocto.io/pub/non-release/20260831-42/testresults/qemux86-64-ptest/core-image-ptest-zstd/
Can you have a look at the issue?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread* [OE-core][PATCH v5] zstd: add ptest support
2026-08-31 6:24 ` [OE-core][PATCH v4] " Pratik Farkase
2026-08-31 7:58 ` Mathieu Dubois-Briand
@ 2026-08-31 8:21 ` Pratik Farkase
2026-09-02 7:16 ` [OE-core][PATCH v6] " Pratik Farkase
2 siblings, 0 replies; 14+ messages in thread
From: Pratik Farkase @ 2026-08-31 8:21 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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: 41 shell-based integration tests covering compression,
decompression, dictionaries, file-stat, progress, symlinks,
cltools, and multi-threading
The cli-tests run as the ptest user so that permission-related tests
work correctly. The levels.sh test is patched to skip the --max
compression level on systems with less than 10GB RAM, as it allocates
~8.5GB on 64-bit systems.
Tested on qemux86-64 (4GB RAM) with ptest-runner: fullbench PASS,
cli-tests 41/41 PASS. Runtime is ~41 seconds.
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
Changes in v5:
- Add IMAGE_ROOTFS_EXTRA_SPACE override for zstd ptest image
(window-resize.sh creates a 1GB file and needs sufficient disk)
Changes in v4:
- Run cli-tests as ptest user for permission tests
- Add GNU grep and less to RDEPENDS for cltools tests
- Install zstdgrep/zstdless scripts for cltools tests
- Patch levels.sh to skip --max level on systems with <10GB RAM
Changes in v3:
- Reduced test scope to fullbench + cli-tests only (per Ross's review)
- Removed fuzzers and stress tests
- Moved from PTESTS_SLOW to PTESTS_FAST
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-core/images/core-image-ptest.bb | 2 +
...std-max-level-when-memory-is-insuffi.patch | 31 ++++++++++++++
meta/recipes-extended/zstd/zstd/run-ptest | 21 ++++++++++
meta/recipes-extended/zstd/zstd_1.5.7.bb | 40 ++++++++++++++++++-
5 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
create mode 100644 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 ce6c0a2d76..d8eba9dafa 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -150,6 +150,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..e466562859 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -45,6 +45,8 @@ 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"
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-zstd = "1524288"
TEST_SUITES = "ping ssh parselogs ptest"
diff --git a/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
new file mode 100644
index 0000000000..5f9d5b85d1
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Pratik Farkase <pratik.farkase@est.tech>
+Date: Thu, 27 Aug 2026 12:00:00 +0000
+Subject: [PATCH] cli-tests: skip zstd --max level when memory is insufficient
+
+The --max compression level on 64-bit systems allocates ~8.5GB, which
+exceeds what is available in memory-constrained test environments such
+as QEMU. Extend the existing 32-bit skip logic to also check available
+system memory, using the same fallback (copy level-19 output as max).
+
+Upstream-Status: Inappropriate [https://github.com/facebook/zstd/issues/4748]
+Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
+---
+ tests/cli-tests/compression/levels.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/cli-tests/compression/levels.sh b/tests/cli-tests/compression/levels.sh
+index b8230f2..7846d3e 100755
+--- a/tests/cli-tests/compression/levels.sh
++++ b/tests/cli-tests/compression/levels.sh
+@@ -16,8 +16,8 @@ zstd --fast=10 file -o file-f10.zst -q
+ zstd --fast=1 file -o file-f1.zst -q
+ zstd -1 file -o file-1.zst -q
+ zstd -19 file -o file-19.zst -q
+-if echo "$version_info" | grep -q '32-bit'; then
+- # skip --max test: not enough address space
++if echo "$version_info" | grep -q '32-bit' || [ "$(awk '/MemTotal/{print $2}' /proc/meminfo)" -lt 10000000 ]; then
++ # skip --max test: not enough address space or memory (<10GB)
+ cp file-19.zst file-max.zst
+ else
+ zstd --max file -o file-max.zst -q
diff --git a/meta/recipes-extended/zstd/zstd/run-ptest b/meta/recipes-extended/zstd/zstd/run-ptest
new file mode 100644
index 0000000000..0949e9187a
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/run-ptest
@@ -0,0 +1,21 @@
+#!/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 needs to write to bin/symlinks and scratch dirs.
+ # Run as ptest user so permission-related tests work correctly.
+ chown -R ptest:ptest .
+ su ptest -s /bin/sh -c "./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 ef0bd54c9c..4c3b377c14 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -12,7 +12,10 @@ 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 \
+ file://0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch \
+ "
SRCREV = "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
@@ -44,3 +47,38 @@ 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
+ install -d ${D}${PTEST_PATH}/programs
+
+ # 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
+
+ # zstdgrep/zstdless scripts needed by cltools tests
+ install -m 0755 ${S}/programs/zstdgrep ${D}${PTEST_PATH}/programs/
+ install -m 0755 ${S}/programs/zstdless ${D}${PTEST_PATH}/programs/
+
+ # The levels.sh expected stderr includes set -v traces that change
+ # after patching the memory check. Remove the exact match file so
+ # the test framework ignores stderr comparison.
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/compression/levels.sh.stderr.exact
+}
+
+RDEPENDS:${PN}-ptest += "bash grep less python3-core python3-modules"
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [OE-core][PATCH v6] zstd: add ptest support
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 ` Pratik Farkase
2 siblings, 0 replies; 14+ messages in thread
From: Pratik Farkase @ 2026-09-02 7:16 UTC (permalink / raw)
To: openembedded-core; +Cc: pratik.farkase, Pratik Farkase
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: 41 shell-based integration tests covering compression,
decompression, dictionaries, file-stat, progress, symlinks,
cltools, and multi-threading
The cli-tests run as the ptest user so that permission-related tests
work correctly. The levels.sh test is patched to skip the --max
compression level on systems with less than 10GB RAM, as it allocates
~8.5GB on 64-bit systems.
Tested on qemux86-64 (4GB RAM) with ptest-runner: fullbench PASS,
cli-tests 41/41 PASS. Runtime is ~41 seconds.
Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
Changes in v6:
- Move IMAGE_ROOTFS_EXTRA_SPACE override next to the other
IMAGE_ROOTFS_EXTRA_SPACE entries for consistency
Changes in v5:
- Add IMAGE_ROOTFS_EXTRA_SPACE override for zstd ptest image
(window-resize.sh creates a 1GB file and needs sufficient disk)
Changes in v4:
- Run cli-tests as ptest user for permission tests
- Add GNU grep and less to RDEPENDS for cltools tests
- Install zstdgrep/zstdless scripts for cltools tests
- Patch levels.sh to skip --max level on systems with <10GB RAM
Changes in v3:
- Reduced test scope to fullbench + cli-tests only (per Ross's review)
- Removed fuzzers and stress tests
- Moved from PTESTS_SLOW to PTESTS_FAST
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-core/images/core-image-ptest.bb | 4 ++
...std-max-level-when-memory-is-insuffi.patch | 31 ++++++++++++++
meta/recipes-extended/zstd/zstd/run-ptest | 21 ++++++++++
meta/recipes-extended/zstd/zstd_1.5.7.bb | 40 ++++++++++++++++++-
5 files changed, 96 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
create mode 100644 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 ce6c0a2d76..d8eba9dafa 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -150,6 +150,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..22bb23c0e7 100644
--- a/meta/recipes-core/images/core-image-ptest.bb
+++ b/meta/recipes-core/images/core-image-ptest.bb
@@ -36,6 +36,9 @@ IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-python3-numpy = "3048576"
# golang go-ptest requires extra space
IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-go = "1524288"
+# zstd cli-tests create large temporary files (e.g. 1GB for window-resize)
+IMAGE_ROOTFS_EXTRA_SPACE:virtclass-mcextend-zstd = "1524288"
+
# ptests need more memory than standard to avoid the OOM killer
QB_MEM = "-m 1024"
QB_MEM:virtclass-mcextend-lttng-tools = "-m 4096"
@@ -45,6 +48,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/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
new file mode 100644
index 0000000000..5f9d5b85d1
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Pratik Farkase <pratik.farkase@est.tech>
+Date: Thu, 27 Aug 2026 12:00:00 +0000
+Subject: [PATCH] cli-tests: skip zstd --max level when memory is insufficient
+
+The --max compression level on 64-bit systems allocates ~8.5GB, which
+exceeds what is available in memory-constrained test environments such
+as QEMU. Extend the existing 32-bit skip logic to also check available
+system memory, using the same fallback (copy level-19 output as max).
+
+Upstream-Status: Inappropriate [https://github.com/facebook/zstd/issues/4748]
+Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
+---
+ tests/cli-tests/compression/levels.sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tests/cli-tests/compression/levels.sh b/tests/cli-tests/compression/levels.sh
+index b8230f2..7846d3e 100755
+--- a/tests/cli-tests/compression/levels.sh
++++ b/tests/cli-tests/compression/levels.sh
+@@ -16,8 +16,8 @@ zstd --fast=10 file -o file-f10.zst -q
+ zstd --fast=1 file -o file-f1.zst -q
+ zstd -1 file -o file-1.zst -q
+ zstd -19 file -o file-19.zst -q
+-if echo "$version_info" | grep -q '32-bit'; then
+- # skip --max test: not enough address space
++if echo "$version_info" | grep -q '32-bit' || [ "$(awk '/MemTotal/{print $2}' /proc/meminfo)" -lt 10000000 ]; then
++ # skip --max test: not enough address space or memory (<10GB)
+ cp file-19.zst file-max.zst
+ else
+ zstd --max file -o file-max.zst -q
diff --git a/meta/recipes-extended/zstd/zstd/run-ptest b/meta/recipes-extended/zstd/zstd/run-ptest
new file mode 100644
index 0000000000..0949e9187a
--- /dev/null
+++ b/meta/recipes-extended/zstd/zstd/run-ptest
@@ -0,0 +1,21 @@
+#!/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 needs to write to bin/symlinks and scratch dirs.
+ # Run as ptest user so permission-related tests work correctly.
+ chown -R ptest:ptest .
+ su ptest -s /bin/sh -c "./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 ef0bd54c9c..4c3b377c14 100644
--- a/meta/recipes-extended/zstd/zstd_1.5.7.bb
+++ b/meta/recipes-extended/zstd/zstd_1.5.7.bb
@@ -12,7 +12,10 @@ 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 \
+ file://0001-cli-tests-skip-zstd-max-level-when-memory-is-insuffi.patch \
+ "
SRCREV = "f8745da6ff1ad1e7bab384bd1f9d742439278e99"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
@@ -44,3 +47,38 @@ 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
+ install -d ${D}${PTEST_PATH}/programs
+
+ # 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
+
+ # zstdgrep/zstdless scripts needed by cltools tests
+ install -m 0755 ${S}/programs/zstdgrep ${D}${PTEST_PATH}/programs/
+ install -m 0755 ${S}/programs/zstdless ${D}${PTEST_PATH}/programs/
+
+ # The levels.sh expected stderr includes set -v traces that change
+ # after patching the memory check. Remove the exact match file so
+ # the test framework ignores stderr comparison.
+ rm -f ${D}${PTEST_PATH}/tests/cli-tests/compression/levels.sh.stderr.exact
+}
+
+RDEPENDS:${PN}-ptest += "bash grep less python3-core python3-modules"
--
2.43.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-09-02 7:16 UTC | newest]
Thread overview: 14+ 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
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
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.