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 <[email protected]>
---
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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244365):
https://lists.openembedded.org/g/openembedded-core/message/244365
Mute This Topic: https://lists.openembedded.org/mt/120933962/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-