Skip to content

Commit 30608ff

Browse files
committed
Fixed tests
1 parent b895d63 commit 30608ff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/pass-dep/libc/threadname.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,14 @@ fn main() {
7575

7676
// Also test directly calling pthread_setname to check its return value.
7777
assert_eq!(set_thread_name(&cstr), 0);
78-
// But with a too long name it should fail except:
79-
// * on FreeBSD where the function has no return, hence cannot indicate failure,
80-
// * on Android where prctl silently truncates the string.
81-
#[cfg(not(any(target_os = "freebsd", target_os = "android")))]
82-
assert_ne!(set_thread_name(&std::ffi::CString::new(name).unwrap()), 0);
78+
79+
if name.len() >= 15 {
80+
// But with a too long name it should fail except:
81+
// * on FreeBSD where the function has no return, hence cannot indicate failure,
82+
// * on Android where prctl silently truncates the string.
83+
#[cfg(not(all(target_os = "freebsd", target_os = "android")))]
84+
assert_ne!(set_thread_name(&std::ffi::CString::new(name).unwrap()), 0);
85+
}
8386
});
8487
result.unwrap().join().unwrap();
8588
}

0 commit comments

Comments
 (0)