diff --git a/quest/m1/README.md b/quest/m1/README.md index df699f8d8ac..ec37a7735f7 100644 --- a/quest/m1/README.md +++ b/quest/m1/README.md @@ -161,7 +161,6 @@ surface and zero-copy texture import, land before the cut. - [HLS takeover leak](/quest/m1/hls-takeover-leak.md) - a replaced instance's recording cursor never yields the replacement's media, and ends or fails instead of stalling - [HLS and DASH segment conformance](/quest/m1/hls-conformance.md) - nightly ffprobe checks that advertised timing, sync flags, and bytes match the media served - [App-limited BBR3 estimate ages](/quest/m1/bbr-app-limited.md) - an app-limited BBR3 estimate falls within seconds after the path drops -- [Seeded BBR3 in tests](/quest/m1/bbr-test-seed.md) - unseeded `Bbr3Config::default()` tests replay the same randomness - [Aborted epoch reads keep their cause](/quest/m1/epoch-abort-cause.md) - an aborted read through an epoch route ends with its own error, not NotFound - [Bindings name every session code](/quest/m1/ffi-malformed-auth-kind.md) - MALFORMED_AUTH_TOKEN and its siblings reach moq-ffi, moq-c, and the wrappers - [A profiling host](/quest/m1/perf-host.md) - condition: a quiet host with `perf_event_paranoid=-1`, recorded in `bench/README.md` diff --git a/quest/m1/bbr-test-seed.md b/quest/m1/bbr-test-seed.md deleted file mode 100644 index b75c4bde4ce..00000000000 --- a/quest/m1/bbr-test-seed.md +++ /dev/null @@ -1,16 +0,0 @@ -# [XS] Seeded BBR3 in tests - -## Goal - -Every moq-congestion test that builds `Bbr3Config::default()` without a seed -replays the same randomness on every run, as it did before -[moq-dev/moq#6602](https://github.com/moq-dev/moq/pull/6602). - -## Plan - -- `Bbr3::new` falls back to `Pcg32::from_rng(&mut rand::rng())` - (`rs/moq-congestion/src/bbr3/mod.rs`, about line 620); before the extraction - it used `crate::entropy::rng()`, which tests seeded per thread. -- Under `cfg(test)`, fall back to a fixed seed (moq-quic already reseeds its - own tests in `rs/moq-quic/src/config/transport.rs`). Production keeps OS - randomness. diff --git a/rs/moq-congestion/src/bbr3/mod.rs b/rs/moq-congestion/src/bbr3/mod.rs index 89836b795ae..ed73ddbf4a8 100644 --- a/rs/moq-congestion/src/bbr3/mod.rs +++ b/rs/moq-congestion/src/bbr3/mod.rs @@ -529,12 +529,18 @@ impl Bbr3 { /// equivalent to BBROnInit fn new(config: Arc, init: Init) -> Self { - let probe_rng: Pcg32; - if let Some(probe_seed) = config.probe_rng_seed { - probe_rng = Pcg32::from_seed(probe_seed); + let probe_rng = if let Some(probe_seed) = config.probe_rng_seed { + Pcg32::from_seed(probe_seed) } else { - probe_rng = Pcg32::from_rng(&mut rand::rng()); - } + #[cfg(test)] + { + Pcg32::from_seed([0; 16]) + } + #[cfg(not(test))] + { + Pcg32::from_rng(&mut rand::rng()) + } + }; let smss = Ord::min( Ord::max(MIN_MAX_DATAGRAM_SIZE, init.mtu) as u64, MAX_DATAGRAM_SIZE, @@ -2317,6 +2323,19 @@ mod test { } } + #[test] + fn default_probe_schedule_replays() { + let mut first = Driver::new(Arc::new(Bbr3Config::default()), 2500); + let mut replay = Driver::new(Arc::new(Bbr3Config::default()), 2500); + for _ in 0..8 { + first.pick_probe_wait(); + replay.pick_probe_wait(); + assert_eq!(first.rounds_since_bw_probe, replay.rounds_since_bw_probe); + assert_eq!(first.bw_probe_wait, replay.bw_probe_wait); + assert_eq!(first.reno_rounds_bound, replay.reno_rounds_bound); + } + } + #[test] fn test_probe_rng() { let seed: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; @@ -6647,10 +6666,9 @@ mod test { // bottleneck serialization time for one MSS-sized packet let btl_service_ns: u64 = (MSS as f64 / BW * 1e9).round() as u64; - // Production default, but pin the probe RNG: once app-limiting lifts at the + // Pin this scenario's probe schedule: once app-limiting lifts at the // PROBE_REFILL -> PROBE_UP edge the flow does genuine PROBE_BW cycling, whose - // phase timing is RNG-driven, and default() seeds from entropy (cf. sibling - // probing tests). + // phase timing is RNG-driven (cf. sibling probing tests). let config = Bbr3Config { probe_rng_seed: Some([6; 16]), ..Bbr3Config::default()