about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-11 23:12:57 +0000
committerbors <bors@rust-lang.org>2023-04-11 23:12:57 +0000
commitdedac2d5e2ec863b65cf4adb34b7804becf140f8 (patch)
treede65e628c99a3cc998781e94e13ee99ea209e1b3 /src
parent93a05753cb866d4a4302fc6ed69ebd09aa86ba95 (diff)
parent9311b4a83c99571d1286e9b6f4e799a020e59aa0 (diff)
downloadrust-dedac2d5e2ec863b65cf4adb34b7804becf140f8.tar.gz
rust-dedac2d5e2ec863b65cf4adb34b7804becf140f8.zip
Auto merge of #2838 - DebugSteven:disable-epoll_wait, r=oli-obk
throw unsupported for `epoll_wait`

This PR throws unsupported to indicate miri doesn't yet return ready events. Previously it always returned 0, indicating no ready events, even if events for the epoll file descriptor may have been ready.
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/shims/unix/linux/fd.rs3
-rw-r--r--src/tools/miri/tests/fail/tokio/sleep.rs (renamed from src/tools/miri/tests/pass-dep/tokio/sleep.rs)2
-rw-r--r--src/tools/miri/tests/fail/tokio/sleep.stderr15
3 files changed, 18 insertions, 2 deletions
diff --git a/src/tools/miri/src/shims/unix/linux/fd.rs b/src/tools/miri/src/shims/unix/linux/fd.rs
index 3c4a678e598..3c263e4df92 100644
--- a/src/tools/miri/src/shims/unix/linux/fd.rs
+++ b/src/tools/miri/src/shims/unix/linux/fd.rs
@@ -152,7 +152,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
         let _maxevents = this.read_scalar(maxevents)?.to_i32()?;
         let _timeout = this.read_scalar(timeout)?.to_i32()?;
 
-        let numevents = 0;
         if let Some(epfd) = this.machine.file_handler.handles.get_mut(&epfd) {
             let _epfd = epfd
                 .as_any_mut()
@@ -160,7 +159,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
                 .ok_or_else(|| err_unsup_format!("non-epoll FD passed to `epoll_wait`"))?;
 
             // FIXME return number of events ready when scheme for marking events ready exists
-            Ok(Scalar::from_i32(numevents))
+            throw_unsup_format!("returning ready events from epoll_wait is not yet implemented");
         } else {
             Ok(Scalar::from_i32(this.handle_not_found()?))
         }
diff --git a/src/tools/miri/tests/pass-dep/tokio/sleep.rs b/src/tools/miri/tests/fail/tokio/sleep.rs
index 00cc68eba3e..6fdfbc9913a 100644
--- a/src/tools/miri/tests/pass-dep/tokio/sleep.rs
+++ b/src/tools/miri/tests/fail/tokio/sleep.rs
@@ -1,5 +1,7 @@
 //@compile-flags: -Zmiri-permissive-provenance -Zmiri-backtrace=full
 //@only-target-x86_64-unknown-linux: support for tokio only on linux and x86
+//@error-pattern: returning ready events from epoll_wait is not yet implemented
+//@normalize-stderr-test: " += note:.*\n" -> ""
 
 use tokio::time::{sleep, Duration, Instant};
 
diff --git a/src/tools/miri/tests/fail/tokio/sleep.stderr b/src/tools/miri/tests/fail/tokio/sleep.stderr
new file mode 100644
index 00000000000..ac2a984ed51
--- /dev/null
+++ b/src/tools/miri/tests/fail/tokio/sleep.stderr
@@ -0,0 +1,15 @@
+error: unsupported operation: returning ready events from epoll_wait is not yet implemented
+  --> CARGO_REGISTRY/.../epoll.rs:LL:CC
+   |
+LL | /         syscall!(epoll_wait(
+LL | |             self.ep,
+LL | |             events.as_mut_ptr(),
+LL | |             events.capacity() as i32,
+LL | |             timeout,
+LL | |         ))
+   | |__________^ returning ready events from epoll_wait is not yet implemented
+   |
+   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
+
+error: aborting due to previous error
+