about summary refs log tree commit diff
path: root/src/tools/miri/tests
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-16 16:55:45 +0200
committerRalf Jung <post@ralfj.de>2024-08-16 16:55:57 +0200
commitedd1efb136f93d8e29bf15610f6bca2f919d4ad7 (patch)
treeb7e5364cfd17c13b4a98ef9074a419329093fb89 /src/tools/miri/tests
parentb4ab820e5e20dfca8f3242ac2547f8abf169e30e (diff)
downloadrust-edd1efb136f93d8e29bf15610f6bca2f919d4ad7.tar.gz
rust-edd1efb136f93d8e29bf15610f6bca2f919d4ad7.zip
comment and test regarding notifications on writes that dont change readiness
Diffstat (limited to 'src/tools/miri/tests')
-rw-r--r--src/tools/miri/tests/pass-dep/libc/libc-epoll.rs12
1 files changed, 12 insertions, 0 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 364a784574a..c27a6a83a05 100644
--- a/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
+++ b/src/tools/miri/tests/pass-dep/libc/libc-epoll.rs
@@ -83,6 +83,18 @@ fn test_epoll_socketpair() {
     let expected_value = u64::try_from(fds[1]).unwrap();
     assert!(check_epoll_wait::<8>(epfd, vec![(expected_event, expected_value)]));
 
+    // Check that this is indeed using "ET" (edge-trigger) semantics: a second epoll should return nothing.
+    assert!(check_epoll_wait::<8>(epfd, vec![]));
+
+    // Write some more to fd[0].
+    let data = "abcde".as_bytes().as_ptr();
+    let res = unsafe { libc::write(fds[0], data as *const libc::c_void, 5) };
+    assert_eq!(res, 5);
+
+    // This did not change the readiness of fd[1]. And yet, we're seeing the event reported
+    // again by the kernel, so Miri does the same.
+    assert!(check_epoll_wait::<8>(epfd, vec![(expected_event, expected_value)]));
+
     // Close the peer socketpair.
     let res = unsafe { libc::close(fds[0]) };
     assert_eq!(res, 0);