netplay: 8 MiB test-stack budget for Device-constructing unit tests (issue #23) #24

Merged
pbwraith merged 1 commits from issue-23 into main 2026-08-26 13:23:29 +02:00

1 Commits

Author SHA1 Message Date
Hermes CI
d400b53886 gopher64-netplay#23: give Device-constructing unit tests an 8 MiB test-stack budget
Some checks failed
Rust / build-linux (linux-x86_64, X64, ubuntu-24.04, x86_64-unknown-linux-gnu) (pull_request) Failing after 11s
Rust / build-android (29.0.14206865, ubuntu-24.04, 33) (pull_request) Failing after 4s
Rust-lint / lint-linux (pull_request) Failing after 25s
Rust / build-linux (linux-aarch64, ARM64, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (pull_request) Has been cancelled
Rust / build-windows (windows-aarch64, woa64, windows-11-arm, aarch64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-windows (windows-x86_64, win64, windows-2025, x86_64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-macos (macos-aarch64, ARM64, aarch64-apple-darwin) (pull_request) Has been cancelled
Rust / Collect release artifacts (pull_request) Has been cancelled
libtest runs each test on a thread with the default 2 MiB stack. In a debug
build, Device::new() materialises ~301 KiB of struct literals on the stack,
and postcard::from_bytes::<Device> rebuilds the whole value on the stack, so
any Device-constructing unit test (netplay savestate round trips etc.) peaks
at several times that and aborts the ENTIRE test binary with a stack
overflow, taking every other test down with it.

Fix, both layers:
- src/test_util.rs: with_big_stack() runs a test body on an explicitly sized
  8 MiB thread (the budget the project already standardises on in
  .cargo/config.toml). Regression test: a device serialise/restore/clone
  round trip measured to overflow the 2 MiB libtest thread (SIGABRT) and
  pass at 8 MiB, plus a size_of::<Device>() < 700 KiB tripwire.
- scripts/gate.sh: export RUST_MIN_STACK=8388608 around step 3 so the
  documented gate also covers Device-constructing tests that are not yet
  wrapped (the netplay cluster's !15/!18 tests land after this fix).

Verified: cargo test --lib bare (no env) -> 1 passed; full gate -> GATE_OK
with step 3 reporting 1 passed (was 0 on main).
2026-08-26 02:47:29 -05:00