Openembedded Core Discussions
 help / color / mirror / Atom feed
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 v3] zstd: add ptest support
Date: Wed, 26 Aug 2026 10:27:16 +0200	[thread overview]
Message-ID: <20260826082716.15560-1-pratik.farkase@est.tech> (raw)
In-Reply-To: <20260519090816.17783-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: 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



  parent reply	other threads:[~2026-08-26  8:27 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   ` Pratik Farkase [this message]
2026-08-27 10:09     ` [OE-core][PATCH v3] " 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=20260826082716.15560-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