Skip to content

Commit 14c8f09

Browse files
committed
test: Start using automatic test detection
Move the `cmsg` test from `libc-test/test/` to `libc-test/tests/`, which is autodetected. (backport <#4571>) (cherry picked from commit b0de59a)
1 parent 9fa71a8 commit 14c8f09

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

libc-test/Cargo.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ name = "linux-termios"
6565
path = "test/linux_termios.rs"
6666
harness = false
6767

68-
[[test]]
69-
name = "cmsg"
70-
path = "test/cmsg.rs"
71-
harness = true
72-
7368
[[test]]
7469
name = "makedev"
7570
path = "test/makedev.rs"

libc-test/test/cmsg.rs renamed to libc-tests/tests/cmsg.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ mod t {
5555
#[cfg(not(target_arch = "sparc64"))]
5656
#[test]
5757
fn test_cmsg_nxthdr() {
58-
use std::ptr;
5958
// Helps to align the buffer on the stack.
6059
#[repr(align(8))]
6160
struct Align8<T>(T);
@@ -65,7 +64,7 @@ mod t {
6564
let mut mhdr: msghdr = unsafe { mem::zeroed() };
6665
for start_ofs in 0..64 {
6766
let pcmsghdr = buffer.0.as_mut_ptr().cast::<cmsghdr>();
68-
mhdr.msg_control = pcmsghdr as *mut c_void;
67+
mhdr.msg_control = pcmsghdr.cast::<c_void>();
6968
mhdr.msg_controllen = (160 - start_ofs) as _;
7069
for cmsg_len in 0..64 {
7170
// Address must be a multiple of 0x4 for testing on AIX.
@@ -80,7 +79,7 @@ mod t {
8079
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
8180
assert_eq!(libc_next, next);
8281

83-
if libc_next != ptr::null_mut() {
82+
if !libc_next.is_null() {
8483
(*libc_next).cmsg_len = next_cmsg_len;
8584
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
8685
let next = cmsg_nxthdr(&mhdr, pcmsghdr);

0 commit comments

Comments
 (0)