check: add ./check stress stage; fix unreachable bench/mount dispatch

- ./check stress spins a fresh cube-server+cubec built from this tree on a
  throwaway socket/store and drives ~150s of real prog/run traffic while
  sampling the per-command latency + per-C telemetry.
- tools/stress.sh: never touches the production daemon; STRESS_SECONDS override.
- Fixed latent control-flow bug: the old '|| exit 0' guards made 'bench' and
  'mount' subcommands unreachable after the gate (they exited early). Now uses
  explicit run_* flags and only exits at the true end.
This commit is contained in:
hermes
2026-08-11 01:46:49 -04:00
parent 4f9cb2e75e
commit bbaa36a32c
2 changed files with 91 additions and 8 deletions
+27 -8
View File
@@ -5,6 +5,8 @@
# ./check quick tests only
# ./check mount full gate + live FUSE mount end-to-end (needs root)
# ./check bench full gate + cube-bench correctness-gated microbenchmarks
# ./check stress full gate + ~150s sustained stress against a real daemon
# (override duration with STRESS_SECONDS=NN)
#
# Exit 0 means the tree on disk is green. This is the single source of truth;
# do not claim verification from an ad-hoc run.
@@ -16,6 +18,9 @@
# Why `bench` is opt-in: it is a release build + timed run of cube-bench, which
# is slow and machine-noise-sensitive; it asserts correctness on every path but
# the numbers are informational, not a pass/fail gate.
# Why `stress` is opt-in: it spins a fresh daemon built from this tree and drives
# it hard for ~150s to exercise the per-command latency + per-C telemetry under
# load; the numbers are informational, and it obviously takes ~150s to run.
set -euo pipefail
cd "$(dirname "$0")"
@@ -41,16 +46,30 @@ cargo test --workspace $FEAT --jobs "$JOBS"
step "3/3 clippy"
cargo clippy --workspace --all-targets $FEAT --jobs "$JOBS" -- -D warnings
[ "${1:-}" = mount ] || { printf '\n\033[32mALL CHECKS PASSED\033[0m (run ./check mount for live FUSE e2e, ./check bench for metrics)\n'; exit 0; }
[ "${1:-}" = mount ] && { run_mount=1; }
[ "${1:-}" = bench ] && { run_bench=1; }
[ "${1:-}" = stress ] && { run_stress=1; }
[ "${1:-}" = bench ] || { printf '\n\033[32mALL CHECKS PASSED\033[0m (run ./check mount for live FUSE e2e, ./check bench for metrics)\n'; exit 0; }
[ -z "${run_mount:-}${run_bench:-}${run_stress:-}" ] && {
printf '\n\033[32mALL CHECKS PASSED\033[0m (run: ./check mount | bench | stress for those stages)\n'
exit 0
}
step "4/4 cube-bench"
# Release build + timed run. Asserts correctness on every path; numbers are
# informational. JOBS kept modest so we don't saturate the box.
cargo run -p cube-bench --release --jobs "$JOBS"
printf '\n\033[32mALL CHECKS PASSED\033[0m (incl. cube-bench)\n'
exit 0
if [ "${run_bench:-}" ]; then
step "4/4 cube-bench"
# Release build + timed run. Asserts correctness on every path; numbers are
# informational. JOBS kept modest so we don't saturate the box.
cargo run -p cube-bench --release --jobs "$JOBS"
printf '\n\033[32mALL CHECKS PASSED\033[0m (incl. cube-bench)\n'
exit 0
fi
if [ "${run_stress:-}" ]; then
step "4/4 sustained stress ($((${STRESS_SECONDS:-150}))s) against a fresh daemon"
STRESS_SECONDS="${STRESS_SECONDS:-150}" ./tools/stress.sh
printf '\n\033[32mALL CHECKS PASSED\033[0m (incl. sustained stress)\n'
exit 0
fi
step "4/4 live FUSE mount"
[ "$(id -u)" -eq 0 ] || { echo "SKIP: live mount needs root" >&2; exit 1; }