about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-18 09:09:58 +0000
committerbors <bors@rust-lang.org>2024-08-18 09:09:58 +0000
commit8f2768b5076921b85bfbbb875bff801ef0453bbf (patch)
tree527eddae14a2893a34c7bee93263f6fd482dd4d2
parentaea3cfd8672e0a5516a4c07ac161b23baa67bc3a (diff)
parente614d7d51b4f5a8fe65d0fb7ea2e2b7950507aff (diff)
downloadrust-8f2768b5076921b85bfbbb875bff801ef0453bbf.tar.gz
rust-8f2768b5076921b85bfbbb875bff801ef0453bbf.zip
Auto merge of #3825 - RalfJung:epoll-miri, r=RalfJung
epoll test_socketpair_read: explicitly check real and Miri behavior
-rw-r--r--src/tools/miri/tests/pass-dep/libc/libc-epoll.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs b/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
index 773204c4947..3cbf653838e 100644
--- a/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
+++ b/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
@@ -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];