From 94ea6388e1674a235df841ca5225d400929b2c94 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 13 Jan 2017 09:29:31 -0500 Subject: [PATCH] linux: test that the return code, in the error case, has the right sign --- tests/test.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test.rs b/tests/test.rs index 8ed7c37..ca8859b 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -10,6 +10,17 @@ #[macro_use] extern crate sc; +#[cfg(target_os = "linux")] +#[test] +fn ebadf() { + static MESSAGE: &'static str = "Hello, world!"; + + unsafe { + assert_eq!(syscall!(WRITE, 4, MESSAGE.as_ptr(), MESSAGE.len()) as isize, + -9) + } +} + // getpid() is POSIX but that doesn't guarantee it's a system call. #[cfg(any(target_os = "linux", target_os = "freebsd"))] #[test]