Skip to content

Commit e614d7d

Browse files
committed
epoll test_socketpair_read: explicitly check real and Miri behavior
1 parent 8821108 commit e614d7d

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
@@ -478,11 +478,17 @@ fn test_socketpair_read() {
478478
assert_eq!(res, 3);
479479
assert_eq!(buf, "abc".as_bytes());
480480

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

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

0 commit comments

Comments
 (0)