Skip to content

Commit 7876db0

Browse files
committed
try tests
1 parent 4f377a5 commit 7876db0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ case $HOST_TARGET in
108108
MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests
109109
MIRI_TEST_TARGET=aarch64-apple-darwin run_tests
110110
MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests
111-
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple atomic env/var
111+
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthreads atomic env/var
112112
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
113113
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm
114114
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm

src/shims/unix/freebsd/foreign_items.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
2626
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
2727
this.write_null(dest)?;
2828
}
29+
// Old vs new name
2930
"pthread_set_name_np" | "pthread_setname_np" => {
3031
let [thread, name] =
3132
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
@@ -37,6 +38,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
3738
)?;
3839
this.write_scalar(res, dest)?;
3940
}
41+
// Old vs new name
4042
"pthread_get_name_np" | "pthread_getname_np" => {
4143
let [thread, name, len] =
4244
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

tests/pass-dep/shims/pthreads.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ fn test_named_thread_truncation() {
137137
fn set_thread_name(name: &CStr) -> i32 {
138138
#[cfg(target_os = "linux")]
139139
return unsafe { libc::pthread_setname_np(libc::pthread_self(), name.as_ptr().cast()) };
140+
#[cfg(target_os = "freebsd")]
141+
unsafe { libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast()) };
142+
#[cfg(target_os = "freebsd")]
143+
0
140144
#[cfg(target_os = "macos")]
141145
return unsafe { libc::pthread_setname_np(name.as_ptr().cast()) };
142146
}
@@ -147,9 +151,14 @@ fn test_named_thread_truncation() {
147151

148152
// But the system is limited -- make sure we successfully set a truncation.
149153
let mut buf = vec![0u8; long_name.len() + 1];
154+
#[cfg(not(target_os = "freebsd"))]
150155
unsafe {
151156
libc::pthread_getname_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
152157
};
158+
#[cfg(target_os = "freebsd")]
159+
unsafe {
160+
libc::pthread_get_name_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
161+
};
153162
let cstr = CStr::from_bytes_until_nul(&buf).unwrap();
154163
assert!(cstr.to_bytes().len() >= 15); // POSIX seems to promise at least 15 chars
155164
assert!(long_name.as_bytes().starts_with(cstr.to_bytes()));

0 commit comments

Comments
 (0)