Skip to content

Commit 6b087d2

Browse files
committed
Add test
1 parent 56a9a28 commit 6b087d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/run-pass/linux-getrandom.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// only-linux: Uses Linux-only APIs
2+
3+
#![feature(rustc_private)]
4+
extern crate libc;
5+
6+
fn main() {
7+
let mut buf = [0u8; 5];
8+
unsafe {
9+
assert_eq!(libc::syscall(libc::SYS_getrandom, 0 as *mut libc::c_void, 0 as libc::size_t, 0 as libc::c_uint), 0);
10+
assert_eq!(libc::syscall(libc::SYS_getrandom, buf.as_mut_ptr() as *mut libc::c_void, 5 as libc::size_t, 0 as libc::c_uint), 5);
11+
}
12+
}

0 commit comments

Comments
 (0)