Files
rustfs/scripts/check_uring_lane_lib_only.sh
T
Zhengchao An 3f4f31129e ci: narrow the io_uring lane and make the sampler attributable (#5540)
Two independent changes to the Test and Lint area.

The io_uring lane compiled 7 integration binaries to run none of their tests.
Job log 91309868055 shows the lib target reporting "18 passed; 3453 filtered
out" while every binary under crates/ecstore/tests/ reported "running 0 tests".
Adding --lib drops them from the build without changing the selected set.

The `uring_` filter itself must not be touched. libtest matches on substring, so
it also selects names containing `during_` — 6 of the 18 selected tests are such
incidental matches, and narrowing the filter to `io_uring` would silently drop
them. scripts/check_uring_lane_lib_only.sh asserts the precondition --lib
depends on: no test function whose name contains `uring_` may live under
crates/ecstore/tests/. A count floor would not do, because the dangerous case —
someone adding a matching test there — leaves the lib count unchanged and CI
green.

The resource sampler was measuring the wrong machine. The runners are ARC pods,
so /proc/loadavg, /proc/pressure/*, `free` and `df` are node-level and include
every other runner pod on the same Kubernetes node: one sample reported loadavg
6.67 with 832 threads node-wide while `ps` inside the pod showed about 10
processes. Judging a CARGO_BUILD_JOBS change on those numbers cannot work.

The sampler moves to scripts/ci/resource_sampler.sh and now records
/sys/fs/cgroup cpu.max, memory.max, memory.peak and the cpu/io/memory pressure
files, which are this pod's own. The node-level readings stay — co-tenancy is a
real cause of stalls, and a 9m57s plain `git checkout` was traced to it — but
are labelled NODE-LEVEL so nobody reads them as this job's load. Phase markers
are written on start, and clippy is now sampled too: it is the natural control
arm for a CARGO_BUILD_JOBS experiment, since --all-targets is check-only for
workspace members and never links the ~100 test binaries the limit throttles.

No numbers are changed in this commit. CARGO_BUILD_JOBS stays at 2 until there
is attributable data to change it on.

Refs: rustfs/backlog#1598, rustfs/backlog#1601
2026-08-01 11:32:00 +08:00

42 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# The io_uring CI lane runs `cargo test -p rustfs-ecstore --lib uring_`.
#
# `--lib` is there to avoid compiling and linking the 7 integration binaries
# under crates/ecstore/tests/, which selected zero tests for this filter. That is
# only safe while it stays true: add a matching test under tests/ and `--lib`
# would skip it silently, with CI staying green — the failure mode is invisible,
# so it is asserted here instead.
#
# The pattern must use the same `uring_` substring semantics as libtest, which
# also matches names containing `during_`. Narrowing it to `io_uring` would make
# this guard disagree with the filter it is protecting.
#
# Usage: scripts/check_uring_lane_lib_only.sh
set -euo pipefail
cd "$(dirname "$0")/.."
TESTS_DIR="crates/ecstore/tests"
if [ ! -d "$TESTS_DIR" ]; then
echo "OK: $TESTS_DIR does not exist; nothing for --lib to miss"
exit 0
fi
hits="$(grep -rEn '^[[:space:]]*(pub[[:space:]]+)?(async[[:space:]]+)?fn[[:space:]]+[A-Za-z0-9_]*uring_' \
"$TESTS_DIR" || true)"
if [ -n "$hits" ]; then
echo "ERROR: test functions matching the 'uring_' substring found under $TESTS_DIR:" >&2
printf '%s\n' "$hits" | sed 's/^/ /' >&2
echo "" >&2
echo "The io_uring lane in .github/workflows/ci.yml uses --lib, so these would" >&2
echo "never run and CI would stay green. Pick one:" >&2
echo " - move them into a #[cfg(test)] mod under crates/ecstore/src, or" >&2
echo " - drop --lib from that step (and pay the link cost for all 7 binaries), or" >&2
echo " - add an explicit --test <name> for the binary and update this script." >&2
exit 1
fi
echo "OK: no 'uring_'-matching test functions under $TESTS_DIR; --lib is safe"