From 8483629f66b9b5836ba512fa4a73fac6d3de6fdc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 16 Nov 2023 19:35:13 +0100 Subject: [PATCH] move reallocarray test into libc-misc --- ci.sh | 2 +- tests/pass-dep/shims/libc-misc.rs | 17 +++++++++++++++++ tests/pass-dep/shims/libc-reallocarray.rs | 16 ---------------- 3 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 tests/pass-dep/shims/libc-reallocarray.rs diff --git a/ci.sh b/ci.sh index 2bb151c346..dbfb4eca3f 100755 --- a/ci.sh +++ b/ci.sh @@ -108,7 +108,7 @@ case $HOST_TARGET in MIRI_TEST_TARGET=aarch64-unknown-linux-gnu run_tests MIRI_TEST_TARGET=aarch64-apple-darwin run_tests MIRI_TEST_TARGET=i686-pc-windows-gnu run_tests - 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 + 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 MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm diff --git a/tests/pass-dep/shims/libc-misc.rs b/tests/pass-dep/shims/libc-misc.rs index 0374158ea5..de1acb13cb 100644 --- a/tests/pass-dep/shims/libc-misc.rs +++ b/tests/pass-dep/shims/libc-misc.rs @@ -390,6 +390,19 @@ fn test_dlsym() { assert_eq!(errno, libc::EBADF); } +#[cfg(not(target_os = "macos"))] +fn test_reallocarray() { + unsafe { + let mut p = libc::reallocarray(std::ptr::null_mut(), 4096, 2); + assert!(!p.is_null()); + libc::free(p); + p = libc::malloc(16); + let r = libc::reallocarray(p, 2, 32); + assert!(!r.is_null()); + libc::free(r); + } +} + fn main() { test_posix_gettimeofday(); @@ -412,6 +425,10 @@ fn main() { test_memcpy(); test_strcpy(); + #[cfg(not(target_os = "macos"))] // reallocarray does not exist on macOS + test_reallocarray(); + + // These are Linux-specific #[cfg(target_os = "linux")] { test_posix_fadvise(); diff --git a/tests/pass-dep/shims/libc-reallocarray.rs b/tests/pass-dep/shims/libc-reallocarray.rs deleted file mode 100644 index 29a3a59085..0000000000 --- a/tests/pass-dep/shims/libc-reallocarray.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ignore-target-windows: no libc -//@ignore-target-apple: no support (yet) - -use core::ptr; - -fn main() { - unsafe { - let mut p = libc::reallocarray(ptr::null_mut(), 4096, 2); - assert!(!p.is_null()); - libc::free(p); - p = libc::malloc(16); - let r = libc::reallocarray(p, 2, 32); - assert!(!r.is_null()); - libc::free(r); - } -}