diff options
| author | Frank Rehwinkel <frankrehwinkel@gmail.com> | 2024-10-03 12:35:53 -0400 |
|---|---|---|
| committer | Frank Rehwinkel <frankrehwinkel@gmail.com> | 2024-10-09 15:34:33 -0400 |
| commit | f04d1f64e27dd16c773c0ff353cc825e08f3a8a2 (patch) | |
| tree | 587956e3f76b29e8078d48e8ca90c8fcf96757ec | |
| parent | 5cdee0781fb5d2b3dd4064a101402dad575fa773 (diff) | |
| download | rust-f04d1f64e27dd16c773c0ff353cc825e08f3a8a2.tar.gz rust-f04d1f64e27dd16c773c0ff353cc825e08f3a8a2.zip | |
syscall/eventfd2: add failing test
The shim syscall logic doesn't support ID 290, SYS_eventfd2.
| -rw-r--r-- | src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs | 14 | ||||
| -rw-r--r-- | src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr | 15 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs new file mode 100644 index 00000000000..fc5a6b37cc0 --- /dev/null +++ b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.rs @@ -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. +} diff --git a/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr new file mode 100644 index 00000000000..d39cea564d6 --- /dev/null +++ b/src/tools/miri/tests/fail-dep/libc/libc_syscall_eventfd2.stderr @@ -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 + |
