Skip to content

Commit 8f2768b

Browse files
committed
Auto merge of #3825 - RalfJung:epoll-miri, r=RalfJung
epoll test_socketpair_read: explicitly check real and Miri behavior
2 parents aea3cfd + e614d7d commit 8f2768b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/tools/miri/tests/pass-dep/libc/libc-epoll.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,17 @@ fn test_socketpair_read() {
479479
assert_eq!(res, 3);
480480
assert_eq!(buf, "abc".as_bytes());
481481

482-
// Notification will be provided.
483-
// But in real system, no notification will be provided here.
482+
// Notification will be provided in Miri.
483+
// But in real systems, no notification will be provided here, since Linux prefers to avoid
484+
// wakeups that are likely to lead to only small amounts of data being read/written.
485+
// We make the test work in both cases, thus documenting the difference in behavior.
484486
let expected_event = u32::try_from(libc::EPOLLOUT).unwrap();
485487
let expected_value = fds[1] as u64;
486-
check_epoll_wait::<8>(epfd, &[(expected_event, expected_value)]);
488+
if cfg!(miri) {
489+
check_epoll_wait::<8>(epfd, &[(expected_event, expected_value)]);
490+
} else {
491+
check_epoll_wait::<8>(epfd, &[]);
492+
}
487493

488494
// Read until the buffer is empty.
489495
let mut buf: [u8; 2] = [0; 2];

0 commit comments

Comments
 (0)