Skip to content

Commit

Permalink
syscall/eventfd2: add failing test
Browse files Browse the repository at this point in the history
The shim syscall logic doesn't support ID 290, SYS_eventfd2.
  • Loading branch information
FrankReh committed Oct 9, 2024
1 parent 5cdee07 commit f04d1f6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@only-target: linux

// This is a test for calling eventfd2 through a syscall.
// But we do not support this.
fn main() {
let initval = 0 as libc::c_uint;
let flags = (libc::EFD_CLOEXEC | libc::EFD_NONBLOCK) as libc::c_int;

let result = unsafe {
libc::syscall(libc::SYS_eventfd2, initval, flags) //~ERROR: unsupported operation
};

assert_eq!(result, 3); // The first FD provided would be 3.
}
15 changes: 15 additions & 0 deletions src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: unsupported operation: can't execute syscall with ID 290
--> tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC
|
LL | libc::syscall(libc::SYS_eventfd2, initval, flags)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't execute syscall with ID 290
|
= help: if this is a basic API commonly used on this target, please report an issue with Miri
= help: however, note that Miri does not aim to support every FFI function out there; for instance, we will not support APIs for things such as GUIs, scripting languages, or databases
= note: BACKTRACE:
= note: inside `main` at tests/fail-dep/libc/libc_syscall_eventfd2.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

0 comments on commit f04d1f6

Please sign in to comment.