Skip to content

Commit dc54105

Browse files
committed
try tests
1 parent 4f377a5 commit dc54105

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ 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+
return unsafe { libc::pthread_set_name_np(libc::pthread_self(), name.as_ptr().cast()) };
140142
#[cfg(target_os = "macos")]
141143
return unsafe { libc::pthread_setname_np(name.as_ptr().cast()) };
142144
}
@@ -147,9 +149,14 @@ fn test_named_thread_truncation() {
147149

148150
// But the system is limited -- make sure we successfully set a truncation.
149151
let mut buf = vec![0u8; long_name.len() + 1];
152+
#[cfg(not(target_os = "freebsd"))]
150153
unsafe {
151154
libc::pthread_getname_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
152155
};
156+
#[cfg(target_os = "freebsd")]
157+
unsafe {
158+
libc::pthread_get_name_np(libc::pthread_self(), buf.as_mut_ptr().cast(), buf.len())
159+
};
153160
let cstr = CStr::from_bytes_until_nul(&buf).unwrap();
154161
assert!(cstr.to_bytes().len() >= 15); // POSIX seems to promise at least 15 chars
155162
assert!(long_name.as_bytes().starts_with(cstr.to_bytes()));

0 commit comments

Comments
 (0)