feat(cli): move benchmark bridge into Rust

Move benchmark parameter normalization and dispatch into the Rust CLI archive while retaining the stable C launcher entry point. Keep compact CLI variants benchmark-free and add an explicit helpers feature for the C test generators.

Test Plan:

- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features benchmark

- cargo test --manifest-path rust/cli/Cargo.toml --no-default-features --features helpers

- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features cli,compression,decompression,benchmark

- cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets --no-default-features --features helpers

- make -B -C programs -j2 zstd zstd-small zstd-frugal

- make -B -C tests -j2 test-cli-tests

- programs/zstd -b1i1 -q
This commit is contained in:
2026-07-18 03:18:58 +02:00
parent 3a10d86c76
commit 96c7f3b900
6 changed files with 185 additions and 86 deletions
+6 -1
View File
@@ -7,13 +7,18 @@ edition = "2021"
crate-type = ["staticlib"]
[features]
default = ["cli", "compression", "decompression"]
default = ["cli", "compression", "decompression", "benchmark"]
# The command-line parser and dispatch layer, which requires the C fileio
# backend at link time. Program archives enable it; C test binaries link a
# helpers-only archive (timefn) built without it.
cli = []
compression = []
decompression = []
helpers = []
# The integrated benchmark archive is optional so zstd-small and zstd-frugal
# can omit every benchmark implementation and its timing/data-generator
# dependencies.
benchmark = ["compression"]
[dependencies]
libc = "0.2"
+4 -1
View File
@@ -1,8 +1,10 @@
#[cfg(any(feature = "benchmark", feature = "helpers"))]
#[path = "../../src/benchfn.rs"]
mod benchfn;
#[cfg(feature = "cli")]
#[cfg(all(feature = "cli", feature = "benchmark"))]
#[path = "../../src/benchzstd.rs"]
mod benchzstd;
#[cfg(any(feature = "benchmark", feature = "helpers"))]
#[path = "../../src/datagen.rs"]
mod datagen;
#[cfg(feature = "cli")]
@@ -11,6 +13,7 @@ mod dibio;
#[cfg(feature = "cli")]
#[path = "../../src/fileio_prefs.rs"]
mod fileio_prefs;
#[cfg(any(feature = "benchmark", feature = "helpers"))]
#[path = "../../src/lorem.rs"]
mod lorem;
#[path = "../../src/timefn.rs"]