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: [OE-core][PATCH v6] zstd: add ptest support
Date: Wed, 2 Sep 2026 09:16:13 +0200 [thread overview]
Message-ID: <20260902071613.9813-1-pratik.farkase@est.tech> (raw)
In-Reply-To: <20260831062453.8048-1-pratik.farkase@est.tech>
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
prev parent reply other threads:[~2026-09-02 7:16 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 ` [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 ` Pratik Farkase [this message]
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=20260902071613.9813-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox