Skip to content

Commit

Permalink
Auto merge of rust-lang#3825 - RalfJung:epoll-miri, r=RalfJung
Browse files Browse the repository at this point in the history
epoll test_socketpair_read: explicitly check real and Miri behavior
  • Loading branch information
bors committed Aug 18, 2024
2 parents aea3cfd + e614d7d commit 8f2768b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,17 @@ fn test_socketpair_read() {
assert_eq!(res, 3);
assert_eq!(buf, "abc".as_bytes());

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

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

0 comments on commit 8f2768b

Please sign in to comment.