tests: read the KISS configuration frames while the driver starts

This commit is contained in:
DeFiDude committed 2026-11-10 01:13:35 -07:00
1 parent d208b61265
commit 8e69959b28
1 file changed
+5 -4
+5 -4
View File
@@ -426,14 +426,15 @@ mod tests {
config.flow_control = true;
// macOS pseudo terminals cannot accept the hardware baud ioctl;
// inject the already-open pair into the same production driver.
let driver = spawn_kiss_with_port(config, 1, inbound, Box::new(slave))
.await
.unwrap();
driver.owner.mark_registered();
// A macOS pty slave drains only as the master reads, so read the
// configuration frames while the driver is still starting.
let spawning = tokio::spawn(spawn_kiss_with_port(config, 1, inbound, Box::new(slave)));
let init = build_kiss_init(None, None, None, None);
let mut actual_init = vec![0; init.len()];
master.read_exact(&mut actual_init).unwrap();
assert_eq!(actual_init, init);
let driver = spawning.await.unwrap().unwrap();
driver.owner.mark_registered();
// The initial permit goes to the first packet; later ones wait for READY.
driver.tx.send(Bytes::from_static(b"first")).await.unwrap();
let expected = kiss::frame(b"first");