Skip to content

Commit d2952c9

Browse files
committed
Fix test
1 parent 9c34c63 commit d2952c9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/fail-dep/libc/libc_eventfd_write_block.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ fn main() {
77
let flags = libc::EFD_CLOEXEC;
88
let fd = unsafe { libc::eventfd(0, flags) };
99
let mut sized_8_data: [u8; 8];
10+
11+
// Write u64 - 1.
1012
if cfg!(target_endian = "big") {
1113
// Adjust the data based on the endianness of host system.
1214
sized_8_data = [255, 255, 255, 255, 255, 255, 255, 254];
1315
} else {
1416
sized_8_data = [254, 255, 255, 255, 255, 255, 255, 255];
1517
}
16-
// Write u64 - 1.
17-
let _res: i64 = unsafe {
18+
let res: i64 = unsafe {
1819
libc::write(fd, sized_8_data.as_ptr() as *const libc::c_void, 8).try_into().unwrap()
1920
};
20-
// Write u64 - 1.
21-
let _res: i64 = unsafe {
22-
libc::write(fd, sized_8_data.as_ptr() as *const libc::c_void, 8).try_into().unwrap() //~ERROR: blocking is unsupported
23-
};
21+
assert_eq!(res, 8);
22+
23+
// Write 1.
2424
if cfg!(target_endian = "big") {
2525
// Adjust the data based on the endianess of host system.
2626
sized_8_data = [0, 0, 0, 0, 0, 0, 0, 1];
@@ -29,6 +29,6 @@ fn main() {
2929
}
3030
// Write 1 to the counter.
3131
let _res: i64 = unsafe {
32-
libc::write(fd, sized_8_data.as_ptr() as *const libc::c_void, 8).try_into().unwrap()
32+
libc::write(fd, sized_8_data.as_ptr() as *const libc::c_void, 8).try_into().unwrap() //~ERROR: blocking is unsupported
3333
};
3434
}

0 commit comments

Comments
 (0)