Skip to content

Commit 64c0f83

Browse files
committed
Update test
1 parent d45e143 commit 64c0f83

1 file changed

Lines changed: 48 additions & 6 deletions

File tree

tests/unit/out/unsafe/unistd.rs

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,58 @@ pub unsafe fn test_ftruncate_5() {
219219
assert!(((((libc::fclose(fp)) == (0)) as i32) != 0));
220220
libc::unlink(path as *const i8);
221221
}
222-
pub unsafe fn test_isatty_6() {
222+
pub unsafe fn test_open_6() {
223+
let mut fd: i32 = (unsafe {
224+
libc::open(
225+
(b"/dev/null\0".as_ptr().cast_mut()).cast_const() as *const i8,
226+
0 as i32,
227+
(420),
228+
)
229+
});
230+
assert!(((((fd) >= (-1_i32)) as i32) != 0));
231+
if ((((fd) >= (0)) as i32) != 0) {
232+
libc::close(fd);
233+
}
234+
fd = (unsafe {
235+
libc::open(
236+
(b"/dev/null\0".as_ptr().cast_mut()).cast_const() as *const i8,
237+
0 as i32,
238+
)
239+
});
240+
assert!(((((fd) >= (-1_i32)) as i32) != 0));
241+
if ((((fd) >= (0)) as i32) != 0) {
242+
libc::close(fd);
243+
}
244+
}
245+
pub unsafe fn test_fcntl_7() {
246+
assert!(((((unsafe { libc::fcntl(0 as i32, 1 as i32,) }) >= (-1_i32)) as i32) != 0));
247+
let mut duped: i32 = (unsafe { libc::fcntl(0 as i32, 0 as i32, (100)) });
248+
assert!(((((duped) >= (-1_i32)) as i32) != 0));
249+
if ((((duped) >= (0)) as i32) != 0) {
250+
libc::close(duped);
251+
}
252+
}
253+
pub unsafe fn test_ioctl_8() {
254+
let mut arg: i32 = 0;
255+
assert!(
256+
((((unsafe { libc::ioctl(0 as i32, 0_u64 as u64, (&mut arg as *mut i32),) }) >= (-1_i32))
257+
as i32)
258+
!= 0)
259+
);
260+
}
261+
pub unsafe fn test_isatty_9() {
223262
printf(
224263
(b"%d\n\0".as_ptr().cast_mut()).cast_const() as *const i8,
225264
libc::isatty(0),
226265
);
227266
}
228-
pub unsafe fn test_geteuid_7() {
267+
pub unsafe fn test_geteuid_10() {
229268
printf(
230269
(b"%u\n\0".as_ptr().cast_mut()).cast_const() as *const i8,
231270
libc::geteuid(),
232271
);
233272
}
234-
pub unsafe fn test_gethostname_8() {
273+
pub unsafe fn test_gethostname_11() {
235274
let mut name: [u8; 256] = [0_u8; 256];
236275
assert!(
237276
((((libc::gethostname(
@@ -257,8 +296,11 @@ unsafe fn main_0() -> i32 {
257296
(unsafe { test_unlink_3() });
258297
(unsafe { test_pipe_4() });
259298
(unsafe { test_ftruncate_5() });
260-
(unsafe { test_isatty_6() });
261-
(unsafe { test_geteuid_7() });
262-
(unsafe { test_gethostname_8() });
299+
(unsafe { test_open_6() });
300+
(unsafe { test_fcntl_7() });
301+
(unsafe { test_ioctl_8() });
302+
(unsafe { test_isatty_9() });
303+
(unsafe { test_geteuid_10() });
304+
(unsafe { test_gethostname_11() });
263305
return 0;
264306
}

0 commit comments

Comments
 (0)