Skip to content

Commit

Permalink
move reallocarray test into libc-misc
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 16, 2023
1 parent 7151eb1 commit 8483629
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions tests/pass-dep/shims/libc-misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();
Expand Down
16 changes: 0 additions & 16 deletions tests/pass-dep/shims/libc-reallocarray.rs

This file was deleted.

0 comments on commit 8483629

Please sign in to comment.