Skip to content

Commit 70cc639

Browse files
committed
move reallocarray test into libc-misc
1 parent 6985431 commit 70cc639

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

src/tools/miri/ci.sh

+1-1
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 pthreads-threadname libc-getentropy libc-getrandom libc-reallocarray libc-misc atomic env/var
111+
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthreads-threadname libc-getentropy libc-getrandom libc-misc 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/tools/miri/tests/pass-dep/shims/libc-misc.rs

+17
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,19 @@ fn test_dlsym() {
390390
assert_eq!(errno, libc::EBADF);
391391
}
392392

393+
#[cfg(not(target_os = "macos"))]
394+
fn test_reallocarray() {
395+
unsafe {
396+
let mut p = libc::reallocarray(std::ptr::null_mut(), 4096, 2);
397+
assert!(!p.is_null());
398+
libc::free(p);
399+
p = libc::malloc(16);
400+
let r = libc::reallocarray(p, 2, 32);
401+
assert!(!r.is_null());
402+
libc::free(r);
403+
}
404+
}
405+
393406
fn main() {
394407
test_posix_gettimeofday();
395408

@@ -412,6 +425,10 @@ fn main() {
412425
test_memcpy();
413426
test_strcpy();
414427

428+
#[cfg(not(target_os = "macos"))] // reallocarray does not exist on macOS
429+
test_reallocarray();
430+
431+
// These are Linux-specific
415432
#[cfg(target_os = "linux")]
416433
{
417434
test_posix_fadvise();

src/tools/miri/tests/pass-dep/shims/libc-reallocarray.rs

-16
This file was deleted.

0 commit comments

Comments
 (0)