Repository navigation
test: transport crate tests stop waiting on real time #8086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7fce76c
f4f126e
c2de4b2
412e3ef
2c0e73c
73dd59d
800aa71
6e59881
2b8b761
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -687,6 +687,20 @@ mod tests { | |
|
|
||
| /// Which member received something, given every send targets exactly one. | ||
| fn receiver(group: &[UdpSocket]) -> Option<usize> { | ||
| use std::os::fd::AsRawFd; | ||
|
|
||
| // Block until a member is readable: the filter runs on the send, but the | ||
| // datagram lands in the member's queue asynchronously. | ||
| let mut fds: Vec<_> = group | ||
| .iter() | ||
| .map(|socket| libc::pollfd { | ||
| fd: socket.as_raw_fd(), | ||
| events: libc::POLLIN, | ||
| revents: 0, | ||
| }) | ||
| .collect(); | ||
| let n = unsafe { libc::poll(fds.as_mut_ptr(), fds.len() as libc::nfds_t, 5_000) }; | ||
| assert!(n >= 0, "poll failed: {}", std::io::Error::last_os_error()); | ||
| let mut buf = [0u8; 64]; | ||
| group.iter().position(|socket| socket.recv_from(&mut buf).is_ok()) | ||
|
Comment on lines
704
to
705
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
@@ -712,14 +726,6 @@ mod tests { | |
| // can be steering this. | ||
| let sender = crate::bind::udp(crate::bind::Udp::new("127.0.0.1:0".parse().unwrap())).unwrap(); | ||
| sender.send_to(packet, addr).unwrap(); | ||
|
|
||
| // The send is local and the filter is synchronous, but the receive | ||
| // still has to be given a moment to land. | ||
| #[expect( | ||
| clippy::disallowed_methods, | ||
| reason = "a sync test with no runtime waits on a real kernel socket" | ||
| )] | ||
| std::thread::sleep(std::time::Duration::from_millis(50)); | ||
| assert_eq!( | ||
| receiver(&sockets), | ||
| Some(index), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: moq-dev/moq
Length of output: 13157
Web query:
Linux man pages poll 2 timeout return 0 EINTR interrupted signal officialResult:
Script executed:
Repository: moq-dev/moq
Length of output: 5313
Report a timeout separately from a routing failure.
If no datagram is available after
polltimes out, the test reports that it landed on the wrong socket. Report the timeout instead so the failure identifies the missing receive.