From 56aecf2594607cc2523fd3b8d6e5a79c0bcd2fc3 Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Sat, 11 Jul 2026 12:16:23 +0100 Subject: [PATCH] test/others: Run compression benchmark in CI The benchmark and its five data generators otherwise remain standalone tooling, so normal CI would not notice broken integrity checks, statistics accounting, or compression configuration. Add a bounded smoke run for zero, mixed, pseudorandom, text, and ELF-derived mappings. Compare uncompressed, per-page LZ4, and 64 KiB region images with one warmup and one measured iteration, print the results, and fail on checksum, accounting, or configuration errors. Run the helper tests first, then build the pycriu bindings needed by the live benchmark. Leave the host page cache untouched and enforce a five-minute timeout. Gate the run on compression support. Assisted-by: Codex:GPT-5 Signed-off-by: Radostin Stoyanov --- scripts/ci/run-ci-tests.sh | 9 ++++++++ test/others/compression/benchmark/Makefile | 5 ++++- test/others/compression/benchmark/run.sh | 25 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 test/others/compression/benchmark/run.sh diff --git a/scripts/ci/run-ci-tests.sh b/scripts/ci/run-ci-tests.sh index 262326047..65996e3ff 100755 --- a/scripts/ci/run-ci-tests.sh +++ b/scripts/ci/run-ci-tests.sh @@ -349,6 +349,15 @@ run_non_shardable_tests() { echo "Skipping memory compression ZDTM tests" fi + # Run a small checksum-verified compression benchmark. The full benchmark + # remains available under contrib/compression-benchmark for performance + # runs; this CI wrapper avoids dropping the host page cache. + if criu/criu check --feature compress; then + make -C test/others/compression/benchmark run + else + echo "Skipping compression benchmark test" + fi + if criu/criu check --feature compress; then # Hugetlb mappings are not premapped. Their blocks must remain # self-contained raw/zero fallbacks for PIE restore. diff --git a/test/others/compression/benchmark/Makefile b/test/others/compression/benchmark/Makefile index c27c9256b..c753f06d7 100644 --- a/test/others/compression/benchmark/Makefile +++ b/test/others/compression/benchmark/Makefile @@ -1,3 +1,6 @@ unit: python3 ./test_config.py -.PHONY: unit + +run: unit + ./run.sh +.PHONY: run unit diff --git a/test/others/compression/benchmark/run.sh b/test/others/compression/benchmark/run.sh new file mode 100755 index 000000000..fbe8be265 --- /dev/null +++ b/test/others/compression/benchmark/run.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +root=$(cd -- "$(dirname -- "$0")/../../../.." && pwd) + +if [ "$(id -u)" -ne 0 ]; then + echo "compression/benchmark: must run as root" >&2 + exit 1 +fi + +# main.py reads CRIU's generated statistics protobufs through pycriu. +make -C "$root" lib + +timeout --foreground --kill-after=30s 300s \ + python3 "$root/contrib/compression-benchmark/main.py" \ + --criu "$root/criu/criu" \ + --iterations 1 \ + --size 256 \ + --data-pattern zero mixed random text elf \ + --modes uncompressed lz4-page lz4-region \ + --region-sizes 65536 \ + --decompress-threads 4 \ + --no-drop-caches \ + --no-progress-bar