From 325af11a21e5c771bf32feb653be6399c734286a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 6 May 2024 11:15:07 +0200 Subject: [PATCH] organize libc tests into a proper folder, and run some of them on Windows --- ci/ci.sh | 8 +- .../libc_pthread_cond_double_destroy.rs | 2 +- .../libc_pthread_cond_double_destroy.stderr | 0 .../libc_pthread_condattr_double_destroy.rs | 2 +- ...ibc_pthread_condattr_double_destroy.stderr | 0 .../libc_pthread_create_main_terminate.rs | 2 +- .../libc_pthread_create_too_few_args.rs | 2 +- .../libc_pthread_create_too_many_args.rs | 2 +- .../concurrency/libc_pthread_join_detached.rs | 2 +- .../concurrency/libc_pthread_join_joined.rs | 2 +- .../concurrency/libc_pthread_join_main.rs | 2 +- .../concurrency/libc_pthread_join_multiple.rs | 2 +- .../concurrency/libc_pthread_join_self.rs | 2 +- .../libc_pthread_mutex_NULL_deadlock.rs | 2 +- .../libc_pthread_mutex_NULL_deadlock.stderr | 0 .../libc_pthread_mutex_deadlock.rs | 2 +- .../libc_pthread_mutex_deadlock.stderr | 0 .../libc_pthread_mutex_default_deadlock.rs | 2 +- ...libc_pthread_mutex_default_deadlock.stderr | 0 .../libc_pthread_mutex_destroy_locked.rs | 2 +- .../libc_pthread_mutex_destroy_locked.stderr | 0 .../libc_pthread_mutex_double_destroy.rs | 2 +- .../libc_pthread_mutex_double_destroy.stderr | 0 .../libc_pthread_mutex_normal_deadlock.rs | 2 +- .../libc_pthread_mutex_normal_deadlock.stderr | 0 ...bc_pthread_mutex_normal_unlock_unlocked.rs | 2 +- ...thread_mutex_normal_unlock_unlocked.stderr | 0 .../libc_pthread_mutex_wrong_owner.rs | 2 +- .../libc_pthread_mutex_wrong_owner.stderr | 0 .../libc_pthread_mutexattr_double_destroy.rs | 2 +- ...bc_pthread_mutexattr_double_destroy.stderr | 0 ...libc_pthread_rwlock_destroy_read_locked.rs | 2 +- ..._pthread_rwlock_destroy_read_locked.stderr | 0 ...ibc_pthread_rwlock_destroy_write_locked.rs | 2 +- ...pthread_rwlock_destroy_write_locked.stderr | 0 .../libc_pthread_rwlock_double_destroy.rs | 2 +- .../libc_pthread_rwlock_double_destroy.stderr | 0 ...wlock_read_write_deadlock_single_thread.rs | 2 +- ...k_read_write_deadlock_single_thread.stderr | 0 .../libc_pthread_rwlock_read_wrong_owner.rs | 2 +- ...ibc_pthread_rwlock_read_wrong_owner.stderr | 0 .../libc_pthread_rwlock_unlock_unlocked.rs | 2 +- ...libc_pthread_rwlock_unlock_unlocked.stderr | 0 ...libc_pthread_rwlock_write_read_deadlock.rs | 2 +- ..._pthread_rwlock_write_read_deadlock.stderr | 0 ...wlock_write_read_deadlock_single_thread.rs | 2 +- ...k_write_read_deadlock_single_thread.stderr | 0 ...ibc_pthread_rwlock_write_write_deadlock.rs | 2 +- ...pthread_rwlock_write_write_deadlock.stderr | 0 ...lock_write_write_deadlock_single_thread.rs | 2 +- ..._write_write_deadlock_single_thread.stderr | 0 .../libc_pthread_rwlock_write_wrong_owner.rs | 2 +- ...bc_pthread_rwlock_write_wrong_owner.stderr | 0 .../{shims => libc}/env-set_var-data-race.rs | 2 +- .../env-set_var-data-race.stderr | 0 .../{shims => libc}/fs/close_stdout.rs | 2 +- .../{shims => libc}/fs/close_stdout.stderr | 0 .../{shims => libc}/fs/isolated_stdin.rs | 2 +- .../{shims => libc}/fs/isolated_stdin.stderr | 0 .../fs/mkstemp_immutable_arg.rs | 2 +- .../fs/mkstemp_immutable_arg.stderr | 0 .../{shims => libc}/fs/read_from_stdout.rs | 2 +- .../fs/read_from_stdout.stderr | 0 .../fs/unix_open_missing_required_mode.rs | 2 +- .../fs/unix_open_missing_required_mode.stderr | 0 .../{shims => libc}/fs/write_to_stdin.rs | 2 +- .../{shims => libc}/fs/write_to_stdin.stderr | 0 tests/fail-dep/{shims => libc}/memchr_null.rs | 2 - .../{shims => libc}/memchr_null.stderr | 0 tests/fail-dep/{shims => libc}/memcmp_null.rs | 2 - .../{shims => libc}/memcmp_null.stderr | 0 tests/fail-dep/{shims => libc}/memcmp_zero.rs | 1 - .../{shims => libc}/memcmp_zero.stderr | 0 tests/fail-dep/{shims => libc}/memcpy_zero.rs | 1 - .../{shims => libc}/memcpy_zero.stderr | 0 .../fail-dep/{shims => libc}/memrchr_null.rs | 2 +- .../{shims => libc}/memrchr_null.stderr | 0 .../{shims => libc}/mmap_invalid_dealloc.rs | 2 +- .../mmap_invalid_dealloc.stderr | 0 .../{shims => libc}/mmap_use_after_munmap.rs | 2 +- .../mmap_use_after_munmap.stderr | 0 .../{shims => libc}/munmap_partial.rs | 2 +- .../{shims => libc}/munmap_partial.stderr | 0 tests/fail-dep/{ => libc}/realloc-zero.rs | 2 - tests/fail-dep/{ => libc}/realloc-zero.stderr | 0 .../unsupported_incomplete_function.rs | 2 +- .../unsupported_incomplete_function.stderr | 0 tests/panic/unsupported_syscall.rs | 2 +- tests/pass-dep/calloc.rs | 22 --- .../env-cleanup-data-race.rs | 2 +- .../libc_pthread_cond_timedwait.rs | 2 +- .../libc_pthread_cond_timedwait_isolated.rs | 2 +- .../concurrency/tls_pthread_drop_order.rs | 2 +- tests/pass-dep/extra_fn_ptr_gc.rs | 2 +- .../fcntl_f-fullfsync_apple.rs | 0 .../fcntl_f-fullfsync_apple.stderr | 0 .../{shims => libc}/libc-fs-with-isolation.rs | 0 .../libc-fs-with-isolation.stderr | 0 tests/pass-dep/{shims => libc}/libc-fs.rs | 0 tests/pass-dep/{shims => libc}/libc-fs.stderr | 0 tests/pass-dep/{shims => libc}/libc-fs.stdout | 0 .../{shims/libc-misc.rs => libc/libc-mem.rs} | 163 ++++++++++-------- tests/pass-dep/libc/libc-misc.rs | 68 ++++++++ tests/pass-dep/{shims => libc}/libc-random.rs | 0 tests/pass-dep/{shims => libc}/libc-time.rs | 0 tests/pass-dep/{shims => libc}/mmap.rs | 2 +- .../pass-dep/{shims => libc}/pthread-sync.rs | 2 +- .../{shims => libc}/pthread-threadname.rs | 2 +- tests/pass-dep/malloc.rs | 48 ------ 109 files changed, 211 insertions(+), 208 deletions(-) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_cond_double_destroy.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_cond_double_destroy.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_condattr_double_destroy.rs (92%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_condattr_double_destroy.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_NULL_deadlock.rs (90%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_NULL_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_deadlock.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_default_deadlock.rs (91%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_default_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_destroy_locked.rs (92%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_destroy_locked.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_double_destroy.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_double_destroy.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_normal_deadlock.rs (92%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_normal_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_normal_unlock_unlocked.rs (92%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_normal_unlock_unlocked.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_wrong_owner.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutex_wrong_owner.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutexattr_double_destroy.rs (91%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_mutexattr_double_destroy.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_destroy_read_locked.rs (83%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_destroy_read_locked.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_destroy_write_locked.rs (83%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_destroy_write_locked.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_double_destroy.rs (89%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_double_destroy.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_read_write_deadlock_single_thread.rs (82%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_read_wrong_owner.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_read_wrong_owner.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_unlock_unlocked.rs (78%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_unlock_unlocked.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_read_deadlock.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_read_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_read_deadlock_single_thread.rs (82%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_write_deadlock.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_write_deadlock.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_write_deadlock_single_thread.rs (82%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr (100%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_wrong_owner.rs (93%) rename tests/fail-dep/{shims/sync => concurrency}/libc_pthread_rwlock_write_wrong_owner.stderr (100%) rename tests/fail-dep/{shims => libc}/env-set_var-data-race.rs (90%) rename tests/fail-dep/{shims => libc}/env-set_var-data-race.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/close_stdout.rs (82%) rename tests/fail-dep/{shims => libc}/fs/close_stdout.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/isolated_stdin.rs (83%) rename tests/fail-dep/{shims => libc}/fs/isolated_stdin.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/mkstemp_immutable_arg.rs (86%) rename tests/fail-dep/{shims => libc}/fs/mkstemp_immutable_arg.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/read_from_stdout.rs (83%) rename tests/fail-dep/{shims => libc}/fs/read_from_stdout.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/unix_open_missing_required_mode.rs (89%) rename tests/fail-dep/{shims => libc}/fs/unix_open_missing_required_mode.stderr (100%) rename tests/fail-dep/{shims => libc}/fs/write_to_stdin.rs (80%) rename tests/fail-dep/{shims => libc}/fs/write_to_stdin.stderr (100%) rename tests/fail-dep/{shims => libc}/memchr_null.rs (77%) rename tests/fail-dep/{shims => libc}/memchr_null.stderr (100%) rename tests/fail-dep/{shims => libc}/memcmp_null.rs (78%) rename tests/fail-dep/{shims => libc}/memcmp_null.stderr (100%) rename tests/fail-dep/{shims => libc}/memcmp_zero.rs (90%) rename tests/fail-dep/{shims => libc}/memcmp_zero.stderr (100%) rename tests/fail-dep/{shims => libc}/memcpy_zero.rs (88%) rename tests/fail-dep/{shims => libc}/memcpy_zero.stderr (100%) rename tests/fail-dep/{shims => libc}/memrchr_null.rs (81%) rename tests/fail-dep/{shims => libc}/memrchr_null.stderr (100%) rename tests/fail-dep/{shims => libc}/mmap_invalid_dealloc.rs (90%) rename tests/fail-dep/{shims => libc}/mmap_invalid_dealloc.stderr (100%) rename tests/fail-dep/{shims => libc}/mmap_use_after_munmap.rs (90%) rename tests/fail-dep/{shims => libc}/mmap_use_after_munmap.stderr (100%) rename tests/fail-dep/{shims => libc}/munmap_partial.rs (94%) rename tests/fail-dep/{shims => libc}/munmap_partial.stderr (100%) rename tests/fail-dep/{ => libc}/realloc-zero.rs (81%) rename tests/fail-dep/{ => libc}/realloc-zero.stderr (100%) rename tests/fail-dep/{ => libc}/unsupported_incomplete_function.rs (87%) rename tests/fail-dep/{ => libc}/unsupported_incomplete_function.stderr (100%) delete mode 100644 tests/pass-dep/calloc.rs rename tests/pass-dep/{shims => concurrency}/env-cleanup-data-race.rs (93%) rename tests/pass-dep/{shims => libc}/fcntl_f-fullfsync_apple.rs (100%) rename tests/pass-dep/{shims => libc}/fcntl_f-fullfsync_apple.stderr (100%) rename tests/pass-dep/{shims => libc}/libc-fs-with-isolation.rs (100%) rename tests/pass-dep/{shims => libc}/libc-fs-with-isolation.stderr (100%) rename tests/pass-dep/{shims => libc}/libc-fs.rs (100%) rename tests/pass-dep/{shims => libc}/libc-fs.stderr (100%) rename tests/pass-dep/{shims => libc}/libc-fs.stdout (100%) rename tests/pass-dep/{shims/libc-misc.rs => libc/libc-mem.rs} (72%) create mode 100644 tests/pass-dep/libc/libc-misc.rs rename tests/pass-dep/{shims => libc}/libc-random.rs (100%) rename tests/pass-dep/{shims => libc}/libc-time.rs (100%) rename tests/pass-dep/{shims => libc}/mmap.rs (99%) rename tests/pass-dep/{shims => libc}/pthread-sync.rs (99%) rename tests/pass-dep/{shims => libc}/pthread-threadname.rs (97%) delete mode 100644 tests/pass-dep/malloc.rs diff --git a/ci/ci.sh b/ci/ci.sh index d1dcacdfdf..c28a6f183b 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -143,10 +143,10 @@ case $HOST_TARGET in # Partially supported targets (tier 2) VERY_BASIC="integer vec string btreemap" # common things we test on all of them (if they have std), requires no target-specific shims BASIC="$VERY_BASIC hello hashmap alloc align" # ensures we have the shims for stdout and basic data structures - MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-misc libc-random libc-time fs env num_cpus - MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-misc libc-random libc-time fs env num_cpus - MIRI_TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-misc libc-random - MIRI_TEST_TARGET=x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-misc libc-random + MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus + MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-mem libc-misc libc-random libc-time fs env num_cpus + MIRI_TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random + MIRI_TEST_TARGET=x86_64-pc-solaris run_tests_minimal $VERY_BASIC hello panic/panic concurrency/simple pthread-sync libc-mem libc-misc libc-random MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal $VERY_BASIC wasm MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm diff --git a/tests/fail-dep/shims/sync/libc_pthread_cond_double_destroy.rs b/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_cond_double_destroy.rs rename to tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs index 94ca3496ed..f22f17be0d 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_cond_double_destroy.rs +++ b/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows /// Test that destroying a pthread_cond twice fails, even without a check for number validity diff --git a/tests/fail-dep/shims/sync/libc_pthread_cond_double_destroy.stderr b/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_cond_double_destroy.stderr rename to tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_condattr_double_destroy.rs b/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs similarity index 92% rename from tests/fail-dep/shims/sync/libc_pthread_condattr_double_destroy.rs rename to tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs index b5427d55eb..d0ccab4de5 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_condattr_double_destroy.rs +++ b/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@ignore-target-apple: Our macOS condattr don't have any fields so we do not notice this. /// Test that destroying a pthread_condattr twice fails, even without a check for number validity diff --git a/tests/fail-dep/shims/sync/libc_pthread_condattr_double_destroy.stderr b/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_condattr_double_destroy.stderr rename to tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.stderr diff --git a/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs b/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs index 7e6f490bb3..9cd0a35d36 100644 --- a/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs +++ b/tests/fail-dep/concurrency/libc_pthread_create_main_terminate.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@error-in-other-file: the main thread terminated without waiting for all remaining threads // Check that we terminate the program when the main thread terminates. diff --git a/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs b/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs index e1d3704af7..96dd99e884 100644 --- a/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs +++ b/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //! The thread function must have exactly one argument. diff --git a/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs b/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs index 7408634db5..d8fbc68d34 100644 --- a/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs +++ b/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //! The thread function must have exactly one argument. diff --git a/tests/fail-dep/concurrency/libc_pthread_join_detached.rs b/tests/fail-dep/concurrency/libc_pthread_join_detached.rs index 0b810dc8c7..e89d7a9f02 100644 --- a/tests/fail-dep/concurrency/libc_pthread_join_detached.rs +++ b/tests/fail-dep/concurrency/libc_pthread_join_detached.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // Joining a detached thread is undefined behavior. diff --git a/tests/fail-dep/concurrency/libc_pthread_join_joined.rs b/tests/fail-dep/concurrency/libc_pthread_join_joined.rs index 04ca4bbb3f..cbad743ca5 100644 --- a/tests/fail-dep/concurrency/libc_pthread_join_joined.rs +++ b/tests/fail-dep/concurrency/libc_pthread_join_joined.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // Joining an already joined thread is undefined behavior. diff --git a/tests/fail-dep/concurrency/libc_pthread_join_main.rs b/tests/fail-dep/concurrency/libc_pthread_join_main.rs index 7576518216..002498e6c8 100644 --- a/tests/fail-dep/concurrency/libc_pthread_join_main.rs +++ b/tests/fail-dep/concurrency/libc_pthread_join_main.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // Joining the main thread is undefined behavior. diff --git a/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs b/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs index 966f416eea..f5b687a623 100644 --- a/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs +++ b/tests/fail-dep/concurrency/libc_pthread_join_multiple.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // Joining the same thread from multiple threads is undefined behavior. diff --git a/tests/fail-dep/concurrency/libc_pthread_join_self.rs b/tests/fail-dep/concurrency/libc_pthread_join_self.rs index 0c25c690f3..4bc1c82a25 100644 --- a/tests/fail-dep/concurrency/libc_pthread_join_self.rs +++ b/tests/fail-dep/concurrency/libc_pthread_join_self.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // We are making scheduler assumptions here. //@compile-flags: -Zmiri-preemption-rate=0 diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_NULL_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_deadlock.rs similarity index 90% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_NULL_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_NULL_deadlock.rs index 8b25107338..0a494c53b4 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_NULL_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // // Check that if we pass NULL attribute, then we get the default mutex type. diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_NULL_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_NULL_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_NULL_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs index 60d56d41fd..0328115c63 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@error-in-other-file: deadlock use std::cell::UnsafeCell; diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_default_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_default_deadlock.rs similarity index 91% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_default_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_default_deadlock.rs index f443768819..1038b8988f 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_default_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_default_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // // Check that if we do not set the mutex type, it is the default. diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_default_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_default_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_default_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_default_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_destroy_locked.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs similarity index 92% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_destroy_locked.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs index ec3965c757..e474712cfd 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_destroy_locked.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { unsafe { diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_destroy_locked.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_destroy_locked.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_double_destroy.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_double_destroy.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs index 622c3eaeae..46f0c5f8d7 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_double_destroy.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows /// Test that destroying a pthread_mutex twice fails, even without a check for number validity diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_double_destroy.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_double_destroy.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_deadlock.rs similarity index 92% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_normal_deadlock.rs index 5ea09fa5aa..f311934e28 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { unsafe { diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_normal_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.rs similarity index 92% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.rs index 8ce7542edb..2b5886dc16 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { unsafe { diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_normal_unlock_unlocked.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.rs b/tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.rs rename to tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.rs index b56775252e..686a394f7c 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows use std::cell::UnsafeCell; use std::sync::Arc; diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr b/tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutex_wrong_owner.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutexattr_double_destroy.rs b/tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs similarity index 91% rename from tests/fail-dep/shims/sync/libc_pthread_mutexattr_double_destroy.rs rename to tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs index 474a277516..51f00d62b7 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_mutexattr_double_destroy.rs +++ b/tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows /// Test that destroying a pthread_mutexattr twice fails, even without a check for number validity diff --git a/tests/fail-dep/shims/sync/libc_pthread_mutexattr_double_destroy.stderr b/tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_mutexattr_double_destroy.stderr rename to tests/fail-dep/concurrency/libc_pthread_mutexattr_double_destroy.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_read_locked.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.rs similarity index 83% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_read_locked.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.rs index 603580ff58..fa4575bc1d 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_read_locked.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_read_locked.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_read_locked.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_read_locked.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_write_locked.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.rs similarity index 83% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_write_locked.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.rs index ae44f22d14..e734a62bca 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_write_locked.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_write_locked.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_destroy_write_locked.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_destroy_write_locked.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_double_destroy.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs similarity index 89% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_double_destroy.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs index 800986f750..e96f7fc680 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_double_destroy.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows /// Test that destroying a pthread_rwlock twice fails, even without a check for number validity diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_double_destroy.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_double_destroy.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_double_destroy.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.rs similarity index 82% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.rs index 782c95b6d2..dffeee2b79 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.rs index 1b498ad8fc..328372b22e 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows use std::cell::UnsafeCell; use std::sync::Arc; diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_read_wrong_owner.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_unlock_unlocked.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.rs similarity index 78% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_unlock_unlocked.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.rs index 05f7e7a06c..ced6b7a4f6 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_unlock_unlocked.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_unlock_unlocked.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_unlock_unlocked.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_unlock_unlocked.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.rs index 0f02c3231a..4174751926 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@error-in-other-file: deadlock use std::cell::UnsafeCell; diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.rs similarity index 82% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.rs index 538f14ef89..099b8dcd10 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.rs index 10be5b3375..43b3ab09bb 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@error-in-other-file: deadlock use std::cell::UnsafeCell; diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.rs similarity index 82% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.rs index 2c963d3651..2704ff1544 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.rs b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.rs similarity index 93% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.rs rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.rs index dd099474d8..9a2cd09f08 100644 --- a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.rs +++ b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows use std::cell::UnsafeCell; use std::sync::Arc; diff --git a/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr b/tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.stderr similarity index 100% rename from tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr rename to tests/fail-dep/concurrency/libc_pthread_rwlock_write_wrong_owner.stderr diff --git a/tests/fail-dep/shims/env-set_var-data-race.rs b/tests/fail-dep/libc/env-set_var-data-race.rs similarity index 90% rename from tests/fail-dep/shims/env-set_var-data-race.rs rename to tests/fail-dep/libc/env-set_var-data-race.rs index 2b9e7a34d6..a1895feb95 100644 --- a/tests/fail-dep/shims/env-set_var-data-race.rs +++ b/tests/fail-dep/libc/env-set_var-data-race.rs @@ -1,5 +1,5 @@ //@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0 -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc env support on Windows use std::env; use std::thread; diff --git a/tests/fail-dep/shims/env-set_var-data-race.stderr b/tests/fail-dep/libc/env-set_var-data-race.stderr similarity index 100% rename from tests/fail-dep/shims/env-set_var-data-race.stderr rename to tests/fail-dep/libc/env-set_var-data-race.stderr diff --git a/tests/fail-dep/shims/fs/close_stdout.rs b/tests/fail-dep/libc/fs/close_stdout.rs similarity index 82% rename from tests/fail-dep/shims/fs/close_stdout.rs rename to tests/fail-dep/libc/fs/close_stdout.rs index 09da8509af..42b7e2b783 100644 --- a/tests/fail-dep/shims/fs/close_stdout.rs +++ b/tests/fail-dep/libc/fs/close_stdout.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc IO on Windows //@compile-flags: -Zmiri-disable-isolation // FIXME: standard handles cannot be closed (https://github.com/rust-lang/rust/issues/40032) diff --git a/tests/fail-dep/shims/fs/close_stdout.stderr b/tests/fail-dep/libc/fs/close_stdout.stderr similarity index 100% rename from tests/fail-dep/shims/fs/close_stdout.stderr rename to tests/fail-dep/libc/fs/close_stdout.stderr diff --git a/tests/fail-dep/shims/fs/isolated_stdin.rs b/tests/fail-dep/libc/fs/isolated_stdin.rs similarity index 83% rename from tests/fail-dep/shims/fs/isolated_stdin.rs rename to tests/fail-dep/libc/fs/isolated_stdin.rs index a45f805696..3c62015a05 100644 --- a/tests/fail-dep/shims/fs/isolated_stdin.rs +++ b/tests/fail-dep/libc/fs/isolated_stdin.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc IO on Windows fn main() -> std::io::Result<()> { let mut bytes = [0u8; 512]; diff --git a/tests/fail-dep/shims/fs/isolated_stdin.stderr b/tests/fail-dep/libc/fs/isolated_stdin.stderr similarity index 100% rename from tests/fail-dep/shims/fs/isolated_stdin.stderr rename to tests/fail-dep/libc/fs/isolated_stdin.stderr diff --git a/tests/fail-dep/shims/fs/mkstemp_immutable_arg.rs b/tests/fail-dep/libc/fs/mkstemp_immutable_arg.rs similarity index 86% rename from tests/fail-dep/shims/fs/mkstemp_immutable_arg.rs rename to tests/fail-dep/libc/fs/mkstemp_immutable_arg.rs index ba9f404d7c..6d951a3a7b 100644 --- a/tests/fail-dep/shims/fs/mkstemp_immutable_arg.rs +++ b/tests/fail-dep/libc/fs/mkstemp_immutable_arg.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No mkstemp on Windows //@compile-flags: -Zmiri-disable-isolation fn main() { diff --git a/tests/fail-dep/shims/fs/mkstemp_immutable_arg.stderr b/tests/fail-dep/libc/fs/mkstemp_immutable_arg.stderr similarity index 100% rename from tests/fail-dep/shims/fs/mkstemp_immutable_arg.stderr rename to tests/fail-dep/libc/fs/mkstemp_immutable_arg.stderr diff --git a/tests/fail-dep/shims/fs/read_from_stdout.rs b/tests/fail-dep/libc/fs/read_from_stdout.rs similarity index 83% rename from tests/fail-dep/shims/fs/read_from_stdout.rs rename to tests/fail-dep/libc/fs/read_from_stdout.rs index 073fca4712..624f584a0c 100644 --- a/tests/fail-dep/shims/fs/read_from_stdout.rs +++ b/tests/fail-dep/libc/fs/read_from_stdout.rs @@ -1,5 +1,5 @@ //@compile-flags: -Zmiri-disable-isolation -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc IO on Windows fn main() -> std::io::Result<()> { let mut bytes = [0u8; 512]; diff --git a/tests/fail-dep/shims/fs/read_from_stdout.stderr b/tests/fail-dep/libc/fs/read_from_stdout.stderr similarity index 100% rename from tests/fail-dep/shims/fs/read_from_stdout.stderr rename to tests/fail-dep/libc/fs/read_from_stdout.stderr diff --git a/tests/fail-dep/shims/fs/unix_open_missing_required_mode.rs b/tests/fail-dep/libc/fs/unix_open_missing_required_mode.rs similarity index 89% rename from tests/fail-dep/shims/fs/unix_open_missing_required_mode.rs rename to tests/fail-dep/libc/fs/unix_open_missing_required_mode.rs index ae231d4be6..d783967f95 100644 --- a/tests/fail-dep/shims/fs/unix_open_missing_required_mode.rs +++ b/tests/fail-dep/libc/fs/unix_open_missing_required_mode.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc IO on Windows //@compile-flags: -Zmiri-disable-isolation fn main() { diff --git a/tests/fail-dep/shims/fs/unix_open_missing_required_mode.stderr b/tests/fail-dep/libc/fs/unix_open_missing_required_mode.stderr similarity index 100% rename from tests/fail-dep/shims/fs/unix_open_missing_required_mode.stderr rename to tests/fail-dep/libc/fs/unix_open_missing_required_mode.stderr diff --git a/tests/fail-dep/shims/fs/write_to_stdin.rs b/tests/fail-dep/libc/fs/write_to_stdin.rs similarity index 80% rename from tests/fail-dep/shims/fs/write_to_stdin.rs rename to tests/fail-dep/libc/fs/write_to_stdin.rs index d039ad718d..683c55e90e 100644 --- a/tests/fail-dep/shims/fs/write_to_stdin.rs +++ b/tests/fail-dep/libc/fs/write_to_stdin.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc IO on Windows fn main() -> std::io::Result<()> { let bytes = b"hello"; diff --git a/tests/fail-dep/shims/fs/write_to_stdin.stderr b/tests/fail-dep/libc/fs/write_to_stdin.stderr similarity index 100% rename from tests/fail-dep/shims/fs/write_to_stdin.stderr rename to tests/fail-dep/libc/fs/write_to_stdin.stderr diff --git a/tests/fail-dep/shims/memchr_null.rs b/tests/fail-dep/libc/memchr_null.rs similarity index 77% rename from tests/fail-dep/shims/memchr_null.rs rename to tests/fail-dep/libc/memchr_null.rs index 6bc7af7e6b..672cc10cd6 100644 --- a/tests/fail-dep/shims/memchr_null.rs +++ b/tests/fail-dep/libc/memchr_null.rs @@ -1,5 +1,3 @@ -//@ignore-target-windows: No libc on Windows - use std::ptr; // null is explicitly called out as UB in the C docs. diff --git a/tests/fail-dep/shims/memchr_null.stderr b/tests/fail-dep/libc/memchr_null.stderr similarity index 100% rename from tests/fail-dep/shims/memchr_null.stderr rename to tests/fail-dep/libc/memchr_null.stderr diff --git a/tests/fail-dep/shims/memcmp_null.rs b/tests/fail-dep/libc/memcmp_null.rs similarity index 78% rename from tests/fail-dep/shims/memcmp_null.rs rename to tests/fail-dep/libc/memcmp_null.rs index a4e0034c40..066af4a8ae 100644 --- a/tests/fail-dep/shims/memcmp_null.rs +++ b/tests/fail-dep/libc/memcmp_null.rs @@ -1,5 +1,3 @@ -//@ignore-target-windows: No libc on Windows - use std::ptr; // null is explicitly called out as UB in the C docs. diff --git a/tests/fail-dep/shims/memcmp_null.stderr b/tests/fail-dep/libc/memcmp_null.stderr similarity index 100% rename from tests/fail-dep/shims/memcmp_null.stderr rename to tests/fail-dep/libc/memcmp_null.stderr diff --git a/tests/fail-dep/shims/memcmp_zero.rs b/tests/fail-dep/libc/memcmp_zero.rs similarity index 90% rename from tests/fail-dep/shims/memcmp_zero.rs rename to tests/fail-dep/libc/memcmp_zero.rs index f2ddc20056..e28aa26270 100644 --- a/tests/fail-dep/shims/memcmp_zero.rs +++ b/tests/fail-dep/libc/memcmp_zero.rs @@ -1,4 +1,3 @@ -//@ignore-target-windows: No libc on Windows //@compile-flags: -Zmiri-permissive-provenance // C says that passing "invalid" pointers is UB for all string functions. diff --git a/tests/fail-dep/shims/memcmp_zero.stderr b/tests/fail-dep/libc/memcmp_zero.stderr similarity index 100% rename from tests/fail-dep/shims/memcmp_zero.stderr rename to tests/fail-dep/libc/memcmp_zero.stderr diff --git a/tests/fail-dep/shims/memcpy_zero.rs b/tests/fail-dep/libc/memcpy_zero.rs similarity index 88% rename from tests/fail-dep/shims/memcpy_zero.rs rename to tests/fail-dep/libc/memcpy_zero.rs index 5283fea4cb..b37ed7df74 100644 --- a/tests/fail-dep/shims/memcpy_zero.rs +++ b/tests/fail-dep/libc/memcpy_zero.rs @@ -1,4 +1,3 @@ -//@ignore-target-windows: No libc on Windows //@compile-flags: -Zmiri-permissive-provenance // C's memcpy is 0 bytes is UB for some pointers that are allowed in Rust's `copy_nonoverlapping`. diff --git a/tests/fail-dep/shims/memcpy_zero.stderr b/tests/fail-dep/libc/memcpy_zero.stderr similarity index 100% rename from tests/fail-dep/shims/memcpy_zero.stderr rename to tests/fail-dep/libc/memcpy_zero.stderr diff --git a/tests/fail-dep/shims/memrchr_null.rs b/tests/fail-dep/libc/memrchr_null.rs similarity index 81% rename from tests/fail-dep/shims/memrchr_null.rs rename to tests/fail-dep/libc/memrchr_null.rs index b6707d558d..f06336b129 100644 --- a/tests/fail-dep/shims/memrchr_null.rs +++ b/tests/fail-dep/libc/memrchr_null.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No `memrchr` on Windows //@ignore-target-apple: No `memrchr` on some apple targets use std::ptr; diff --git a/tests/fail-dep/shims/memrchr_null.stderr b/tests/fail-dep/libc/memrchr_null.stderr similarity index 100% rename from tests/fail-dep/shims/memrchr_null.stderr rename to tests/fail-dep/libc/memrchr_null.stderr diff --git a/tests/fail-dep/shims/mmap_invalid_dealloc.rs b/tests/fail-dep/libc/mmap_invalid_dealloc.rs similarity index 90% rename from tests/fail-dep/shims/mmap_invalid_dealloc.rs rename to tests/fail-dep/libc/mmap_invalid_dealloc.rs index 70f7a6a7ce..9d55a49355 100644 --- a/tests/fail-dep/shims/mmap_invalid_dealloc.rs +++ b/tests/fail-dep/libc/mmap_invalid_dealloc.rs @@ -1,5 +1,5 @@ //@compile-flags: -Zmiri-disable-isolation -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No mmap on Windows #![feature(rustc_private)] diff --git a/tests/fail-dep/shims/mmap_invalid_dealloc.stderr b/tests/fail-dep/libc/mmap_invalid_dealloc.stderr similarity index 100% rename from tests/fail-dep/shims/mmap_invalid_dealloc.stderr rename to tests/fail-dep/libc/mmap_invalid_dealloc.stderr diff --git a/tests/fail-dep/shims/mmap_use_after_munmap.rs b/tests/fail-dep/libc/mmap_use_after_munmap.rs similarity index 90% rename from tests/fail-dep/shims/mmap_use_after_munmap.rs rename to tests/fail-dep/libc/mmap_use_after_munmap.rs index c97b013ba5..05ac232f5d 100644 --- a/tests/fail-dep/shims/mmap_use_after_munmap.rs +++ b/tests/fail-dep/libc/mmap_use_after_munmap.rs @@ -1,5 +1,5 @@ //@compile-flags: -Zmiri-disable-isolation -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No mmap on Windows #![feature(rustc_private)] diff --git a/tests/fail-dep/shims/mmap_use_after_munmap.stderr b/tests/fail-dep/libc/mmap_use_after_munmap.stderr similarity index 100% rename from tests/fail-dep/shims/mmap_use_after_munmap.stderr rename to tests/fail-dep/libc/mmap_use_after_munmap.stderr diff --git a/tests/fail-dep/shims/munmap_partial.rs b/tests/fail-dep/libc/munmap_partial.rs similarity index 94% rename from tests/fail-dep/shims/munmap_partial.rs rename to tests/fail-dep/libc/munmap_partial.rs index d7aef47235..4386dc71af 100644 --- a/tests/fail-dep/shims/munmap_partial.rs +++ b/tests/fail-dep/libc/munmap_partial.rs @@ -1,7 +1,7 @@ //! The man pages for mmap/munmap suggest that it is possible to partly unmap a previously-mapped //! region of address space, but to LLVM that would be partial deallocation, which LLVM does not //! support. So even though the man pages say this sort of use is possible, we must report UB. -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No mmap on Windows //@normalize-stderr-test: "size [0-9]+ and alignment" -> "size SIZE and alignment" fn main() { diff --git a/tests/fail-dep/shims/munmap_partial.stderr b/tests/fail-dep/libc/munmap_partial.stderr similarity index 100% rename from tests/fail-dep/shims/munmap_partial.stderr rename to tests/fail-dep/libc/munmap_partial.stderr diff --git a/tests/fail-dep/realloc-zero.rs b/tests/fail-dep/libc/realloc-zero.rs similarity index 81% rename from tests/fail-dep/realloc-zero.rs rename to tests/fail-dep/libc/realloc-zero.rs index 1482798e90..0e210f3135 100644 --- a/tests/fail-dep/realloc-zero.rs +++ b/tests/fail-dep/libc/realloc-zero.rs @@ -1,5 +1,3 @@ -//@ignore-target-windows: No libc on Windows - fn main() { unsafe { let p1 = libc::malloc(20); diff --git a/tests/fail-dep/realloc-zero.stderr b/tests/fail-dep/libc/realloc-zero.stderr similarity index 100% rename from tests/fail-dep/realloc-zero.stderr rename to tests/fail-dep/libc/realloc-zero.stderr diff --git a/tests/fail-dep/unsupported_incomplete_function.rs b/tests/fail-dep/libc/unsupported_incomplete_function.rs similarity index 87% rename from tests/fail-dep/unsupported_incomplete_function.rs rename to tests/fail-dep/libc/unsupported_incomplete_function.rs index 6ef842c9cc..cd8422f4af 100644 --- a/tests/fail-dep/unsupported_incomplete_function.rs +++ b/tests/fail-dep/libc/unsupported_incomplete_function.rs @@ -1,6 +1,6 @@ //! `signal()` is special on Linux and macOS that it's only supported within libstd. //! The implementation is not complete enough to permit user code to call it. -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No `libc::signal` on Windows //@normalize-stderr-test: "OS `.*`" -> "$$OS" fn main() { diff --git a/tests/fail-dep/unsupported_incomplete_function.stderr b/tests/fail-dep/libc/unsupported_incomplete_function.stderr similarity index 100% rename from tests/fail-dep/unsupported_incomplete_function.stderr rename to tests/fail-dep/libc/unsupported_incomplete_function.stderr diff --git a/tests/panic/unsupported_syscall.rs b/tests/panic/unsupported_syscall.rs index 31d666e1d9..30f9da5f80 100644 --- a/tests/panic/unsupported_syscall.rs +++ b/tests/panic/unsupported_syscall.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: no `syscall` on Windows //@ignore-target-apple: `syscall` is not supported on macOS //@compile-flags: -Zmiri-panic-on-unsupported diff --git a/tests/pass-dep/calloc.rs b/tests/pass-dep/calloc.rs deleted file mode 100644 index 62ab63c5fc..0000000000 --- a/tests/pass-dep/calloc.rs +++ /dev/null @@ -1,22 +0,0 @@ -//@ignore-target-windows: No libc on Windows - -use core::slice; - -fn main() { - unsafe { - let p1 = libc::calloc(0, 0); - assert!(p1.is_null()); - - let p2 = libc::calloc(20, 0); - assert!(p2.is_null()); - - let p3 = libc::calloc(0, 20); - assert!(p3.is_null()); - - let p4 = libc::calloc(4, 8); - assert!(!p4.is_null()); - let slice = slice::from_raw_parts(p4 as *const u8, 4 * 8); - assert_eq!(&slice, &[0_u8; 4 * 8]); - libc::free(p4); - } -} diff --git a/tests/pass-dep/shims/env-cleanup-data-race.rs b/tests/pass-dep/concurrency/env-cleanup-data-race.rs similarity index 93% rename from tests/pass-dep/shims/env-cleanup-data-race.rs rename to tests/pass-dep/concurrency/env-cleanup-data-race.rs index 5c29a1b15a..86a47ba365 100644 --- a/tests/pass-dep/shims/env-cleanup-data-race.rs +++ b/tests/pass-dep/concurrency/env-cleanup-data-race.rs @@ -1,5 +1,5 @@ //@compile-flags: -Zmiri-disable-isolation -Zmiri-preemption-rate=0 -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No libc env support on Windows use std::ffi::CStr; use std::thread; diff --git a/tests/pass-dep/concurrency/libc_pthread_cond_timedwait.rs b/tests/pass-dep/concurrency/libc_pthread_cond_timedwait.rs index f362caa11d..d758168c7c 100644 --- a/tests/pass-dep/concurrency/libc_pthread_cond_timedwait.rs +++ b/tests/pass-dep/concurrency/libc_pthread_cond_timedwait.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@ignore-target-apple: pthread_condattr_setclock is not supported on MacOS. //@compile-flags: -Zmiri-disable-isolation diff --git a/tests/pass-dep/concurrency/libc_pthread_cond_timedwait_isolated.rs b/tests/pass-dep/concurrency/libc_pthread_cond_timedwait_isolated.rs index 66c0895a5d..f1a3c5dc10 100644 --- a/tests/pass-dep/concurrency/libc_pthread_cond_timedwait_isolated.rs +++ b/tests/pass-dep/concurrency/libc_pthread_cond_timedwait_isolated.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //@ignore-target-apple: pthread_condattr_setclock is not supported on MacOS. /// Test that conditional variable timeouts are working properly diff --git a/tests/pass-dep/concurrency/tls_pthread_drop_order.rs b/tests/pass-dep/concurrency/tls_pthread_drop_order.rs index ae874740f2..0eaab96764 100644 --- a/tests/pass-dep/concurrency/tls_pthread_drop_order.rs +++ b/tests/pass-dep/concurrency/tls_pthread_drop_order.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows //! Test that pthread_key destructors are run in the right order. //! Note that these are *not* used by actual `thread_local!` on Linux! Those use //! `thread_local_dtor::register_dtor` from the stdlib instead. In Miri this hits the fallback path diff --git a/tests/pass-dep/extra_fn_ptr_gc.rs b/tests/pass-dep/extra_fn_ptr_gc.rs index 716119a0fc..1198168795 100644 --- a/tests/pass-dep/extra_fn_ptr_gc.rs +++ b/tests/pass-dep/extra_fn_ptr_gc.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No `dlsym` on Windows //@compile-flags: -Zmiri-permissive-provenance #[path = "../utils/mod.rs"] diff --git a/tests/pass-dep/shims/fcntl_f-fullfsync_apple.rs b/tests/pass-dep/libc/fcntl_f-fullfsync_apple.rs similarity index 100% rename from tests/pass-dep/shims/fcntl_f-fullfsync_apple.rs rename to tests/pass-dep/libc/fcntl_f-fullfsync_apple.rs diff --git a/tests/pass-dep/shims/fcntl_f-fullfsync_apple.stderr b/tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr similarity index 100% rename from tests/pass-dep/shims/fcntl_f-fullfsync_apple.stderr rename to tests/pass-dep/libc/fcntl_f-fullfsync_apple.stderr diff --git a/tests/pass-dep/shims/libc-fs-with-isolation.rs b/tests/pass-dep/libc/libc-fs-with-isolation.rs similarity index 100% rename from tests/pass-dep/shims/libc-fs-with-isolation.rs rename to tests/pass-dep/libc/libc-fs-with-isolation.rs diff --git a/tests/pass-dep/shims/libc-fs-with-isolation.stderr b/tests/pass-dep/libc/libc-fs-with-isolation.stderr similarity index 100% rename from tests/pass-dep/shims/libc-fs-with-isolation.stderr rename to tests/pass-dep/libc/libc-fs-with-isolation.stderr diff --git a/tests/pass-dep/shims/libc-fs.rs b/tests/pass-dep/libc/libc-fs.rs similarity index 100% rename from tests/pass-dep/shims/libc-fs.rs rename to tests/pass-dep/libc/libc-fs.rs diff --git a/tests/pass-dep/shims/libc-fs.stderr b/tests/pass-dep/libc/libc-fs.stderr similarity index 100% rename from tests/pass-dep/shims/libc-fs.stderr rename to tests/pass-dep/libc/libc-fs.stderr diff --git a/tests/pass-dep/shims/libc-fs.stdout b/tests/pass-dep/libc/libc-fs.stdout similarity index 100% rename from tests/pass-dep/shims/libc-fs.stdout rename to tests/pass-dep/libc/libc-fs.stdout diff --git a/tests/pass-dep/shims/libc-misc.rs b/tests/pass-dep/libc/libc-mem.rs similarity index 72% rename from tests/pass-dep/shims/libc-misc.rs rename to tests/pass-dep/libc/libc-mem.rs index 32898d4959..33cdc18b70 100644 --- a/tests/pass-dep/shims/libc-misc.rs +++ b/tests/pass-dep/libc/libc-mem.rs @@ -1,33 +1,5 @@ -//@ignore-target-windows: No libc on Windows -//@compile-flags: -Zmiri-disable-isolation -#![feature(io_error_more)] -#![feature(pointer_is_aligned_to)] -#![feature(strict_provenance)] - -use std::mem::{self, transmute}; -use std::ptr; - -/// Tests whether each thread has its own `__errno_location`. -fn test_thread_local_errno() { - #[cfg(any(target_os = "illumos", target_os = "solaris"))] - use libc::___errno as __errno_location; - #[cfg(target_os = "linux")] - use libc::__errno_location; - #[cfg(any(target_os = "macos", target_os = "freebsd"))] - use libc::__error as __errno_location; - - unsafe { - *__errno_location() = 0xBEEF; - std::thread::spawn(|| { - assert_eq!(*__errno_location(), 0); - *__errno_location() = 0xBAD1DEA; - assert_eq!(*__errno_location(), 0xBAD1DEA); - }) - .join() - .unwrap(); - assert_eq!(*__errno_location(), 0xBEEF); - } -} +#![feature(strict_provenance, pointer_is_aligned_to)] +use std::{mem, ptr, slice}; fn test_memcpy() { unsafe { @@ -106,49 +78,71 @@ fn test_strcpy() { } } -#[cfg(target_os = "linux")] -fn test_sigrt() { - let min = libc::SIGRTMIN(); - let max = libc::SIGRTMAX(); - - // "The Linux kernel supports a range of 33 different real-time - // signals, numbered 32 to 64" - assert!(min >= 32); - assert!(max >= 32); - assert!(min <= 64); - assert!(max <= 64); - - // "POSIX.1-2001 requires that an implementation support at least - // _POSIX_RTSIG_MAX (8) real-time signals." - assert!(min < max); - assert!(max - min >= 8) -} +fn test_malloc() { + // Test that small allocations sometimes *are* not very aligned. + let saw_unaligned = (0..64).any(|_| unsafe { + let p = libc::malloc(3); + libc::free(p); + (p as usize) % 4 != 0 // find any that this is *not* 4-aligned + }); + assert!(saw_unaligned); + + unsafe { + let p1 = libc::malloc(20); + p1.write_bytes(0u8, 20); -fn test_dlsym() { - let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, b"notasymbol\0".as_ptr().cast()) }; - assert!(addr as usize == 0); + // old size < new size + let p2 = libc::realloc(p1, 40); + let slice = slice::from_raw_parts(p2 as *const u8, 20); + assert_eq!(&slice, &[0_u8; 20]); - let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, b"isatty\0".as_ptr().cast()) }; - assert!(addr as usize != 0); - let isatty: extern "C" fn(i32) -> i32 = unsafe { transmute(addr) }; - assert_eq!(isatty(999), 0); - let errno = std::io::Error::last_os_error().raw_os_error().unwrap(); - assert_eq!(errno, libc::EBADF); + // old size == new size + let p3 = libc::realloc(p2, 40); + let slice = slice::from_raw_parts(p3 as *const u8, 20); + assert_eq!(&slice, &[0_u8; 20]); + + // old size > new size + let p4 = libc::realloc(p3, 10); + let slice = slice::from_raw_parts(p4 as *const u8, 10); + assert_eq!(&slice, &[0_u8; 10]); + + libc::free(p4); + } + + unsafe { + // Realloc with size 0 is okay for the null pointer + let p2 = libc::realloc(ptr::null_mut(), 0); + assert!(p2.is_null()); + } + + unsafe { + let p1 = libc::realloc(ptr::null_mut(), 20); + assert!(!p1.is_null()); + + libc::free(p1); + } } -#[cfg(not(any(target_os = "macos", target_os = "illumos", target_os = "solaris")))] -fn test_reallocarray() { +fn test_calloc() { 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); + let p1 = libc::calloc(0, 0); + assert!(p1.is_null()); + + let p2 = libc::calloc(20, 0); + assert!(p2.is_null()); + + let p3 = libc::calloc(0, 20); + assert!(p3.is_null()); + + let p4 = libc::calloc(4, 8); + assert!(!p4.is_null()); + let slice = slice::from_raw_parts(p4 as *const u8, 4 * 8); + assert_eq!(&slice, &[0_u8; 4 * 8]); + libc::free(p4); } } +#[cfg(not(target_os = "windows"))] fn test_memalign() { // A normal allocation. unsafe { @@ -225,18 +219,37 @@ fn test_memalign() { } } -fn main() { - test_thread_local_errno(); - - test_dlsym(); - - test_memcpy(); - test_strcpy(); +#[cfg(not(any( + target_os = "windows", + target_os = "macos", + target_os = "illumos", + target_os = "solaris" +)))] +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_malloc(); + test_calloc(); + #[cfg(not(target_os = "windows"))] test_memalign(); - #[cfg(not(any(target_os = "macos", target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any( + target_os = "windows", + target_os = "macos", + target_os = "illumos", + target_os = "solaris" + )))] test_reallocarray(); - #[cfg(target_os = "linux")] - test_sigrt(); + test_memcpy(); + test_strcpy(); } diff --git a/tests/pass-dep/libc/libc-misc.rs b/tests/pass-dep/libc/libc-misc.rs new file mode 100644 index 0000000000..736e0bf8eb --- /dev/null +++ b/tests/pass-dep/libc/libc-misc.rs @@ -0,0 +1,68 @@ +//@ignore-target-windows: only very limited libc on Windows +//@compile-flags: -Zmiri-disable-isolation +#![feature(io_error_more)] +#![feature(pointer_is_aligned_to)] +#![feature(strict_provenance)] + +use std::mem::transmute; + +/// Tests whether each thread has its own `__errno_location`. +fn test_thread_local_errno() { + #[cfg(any(target_os = "illumos", target_os = "solaris"))] + use libc::___errno as __errno_location; + #[cfg(target_os = "linux")] + use libc::__errno_location; + #[cfg(any(target_os = "macos", target_os = "freebsd"))] + use libc::__error as __errno_location; + + unsafe { + *__errno_location() = 0xBEEF; + std::thread::spawn(|| { + assert_eq!(*__errno_location(), 0); + *__errno_location() = 0xBAD1DEA; + assert_eq!(*__errno_location(), 0xBAD1DEA); + }) + .join() + .unwrap(); + assert_eq!(*__errno_location(), 0xBEEF); + } +} + +#[cfg(target_os = "linux")] +fn test_sigrt() { + let min = libc::SIGRTMIN(); + let max = libc::SIGRTMAX(); + + // "The Linux kernel supports a range of 33 different real-time + // signals, numbered 32 to 64" + assert!(min >= 32); + assert!(max >= 32); + assert!(min <= 64); + assert!(max <= 64); + + // "POSIX.1-2001 requires that an implementation support at least + // _POSIX_RTSIG_MAX (8) real-time signals." + assert!(min < max); + assert!(max - min >= 8) +} + +fn test_dlsym() { + let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, b"notasymbol\0".as_ptr().cast()) }; + assert!(addr as usize == 0); + + let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, b"isatty\0".as_ptr().cast()) }; + assert!(addr as usize != 0); + let isatty: extern "C" fn(i32) -> i32 = unsafe { transmute(addr) }; + assert_eq!(isatty(999), 0); + let errno = std::io::Error::last_os_error().raw_os_error().unwrap(); + assert_eq!(errno, libc::EBADF); +} + +fn main() { + test_thread_local_errno(); + + test_dlsym(); + + #[cfg(target_os = "linux")] + test_sigrt(); +} diff --git a/tests/pass-dep/shims/libc-random.rs b/tests/pass-dep/libc/libc-random.rs similarity index 100% rename from tests/pass-dep/shims/libc-random.rs rename to tests/pass-dep/libc/libc-random.rs diff --git a/tests/pass-dep/shims/libc-time.rs b/tests/pass-dep/libc/libc-time.rs similarity index 100% rename from tests/pass-dep/shims/libc-time.rs rename to tests/pass-dep/libc/libc-time.rs diff --git a/tests/pass-dep/shims/mmap.rs b/tests/pass-dep/libc/mmap.rs similarity index 99% rename from tests/pass-dep/shims/mmap.rs rename to tests/pass-dep/libc/mmap.rs index 5acdedc67b..a0787c6890 100644 --- a/tests/pass-dep/shims/mmap.rs +++ b/tests/pass-dep/libc/mmap.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No mmap on Windows //@compile-flags: -Zmiri-disable-isolation -Zmiri-permissive-provenance #![feature(strict_provenance)] diff --git a/tests/pass-dep/shims/pthread-sync.rs b/tests/pass-dep/libc/pthread-sync.rs similarity index 99% rename from tests/pass-dep/shims/pthread-sync.rs rename to tests/pass-dep/libc/pthread-sync.rs index 12d3f2b6f1..1427526212 100644 --- a/tests/pass-dep/shims/pthread-sync.rs +++ b/tests/pass-dep/libc/pthread-sync.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows // We use `yield` to test specific interleavings, so disable automatic preemption. //@compile-flags: -Zmiri-preemption-rate=0 #![feature(sync_unsafe_cell)] diff --git a/tests/pass-dep/shims/pthread-threadname.rs b/tests/pass-dep/libc/pthread-threadname.rs similarity index 97% rename from tests/pass-dep/shims/pthread-threadname.rs rename to tests/pass-dep/libc/pthread-threadname.rs index bc782044d4..4c4f542dfd 100644 --- a/tests/pass-dep/shims/pthread-threadname.rs +++ b/tests/pass-dep/libc/pthread-threadname.rs @@ -1,4 +1,4 @@ -//@ignore-target-windows: No libc on Windows +//@ignore-target-windows: No pthreads on Windows use std::ffi::CStr; #[cfg(not(target_os = "freebsd"))] use std::ffi::CString; diff --git a/tests/pass-dep/malloc.rs b/tests/pass-dep/malloc.rs deleted file mode 100644 index 35cd137931..0000000000 --- a/tests/pass-dep/malloc.rs +++ /dev/null @@ -1,48 +0,0 @@ -//@ignore-target-windows: No libc on Windows - -use core::{ptr, slice}; - -fn main() { - // Test that small allocations sometimes *are* not very aligned. - let saw_unaligned = (0..64).any(|_| unsafe { - let p = libc::malloc(3); - libc::free(p); - (p as usize) % 4 != 0 // find any that this is *not* 4-aligned - }); - assert!(saw_unaligned); - - unsafe { - // Use calloc for initialized memory - let p1 = libc::calloc(20, 1); - - // old size < new size - let p2 = libc::realloc(p1, 40); - let slice = slice::from_raw_parts(p2 as *const u8, 20); - assert_eq!(&slice, &[0_u8; 20]); - - // old size == new size - let p3 = libc::realloc(p2, 40); - let slice = slice::from_raw_parts(p3 as *const u8, 20); - assert_eq!(&slice, &[0_u8; 20]); - - // old size > new size - let p4 = libc::realloc(p3, 10); - let slice = slice::from_raw_parts(p4 as *const u8, 10); - assert_eq!(&slice, &[0_u8; 10]); - - libc::free(p4); - } - - unsafe { - // Realloc with size 0 is okay for the null pointer - let p2 = libc::realloc(ptr::null_mut(), 0); - assert!(p2.is_null()); - } - - unsafe { - let p1 = libc::realloc(ptr::null_mut(), 20); - assert!(!p1.is_null()); - - libc::free(p1); - } -}