move reallocarray test into libc-misc
This commit is contained in:
parent
6985431923
commit
70cc639580
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user