Skip to content

organize libc tests into a proper folder, and run some of them on Windows #3579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/libc_pthread_join_detached.rs
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/libc_pthread_join_joined.rs
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/libc_pthread_join_main.rs
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/libc_pthread_join_multiple.rs
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/libc_pthread_join_self.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ignore-target-windows: No libc on Windows
//@ignore-target-windows: No pthreads on Windows

fn main() {
unsafe {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ignore-target-windows: No libc on Windows
//@ignore-target-windows: No pthreads on Windows

fn main() {
unsafe {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ignore-target-windows: No libc on Windows
//@ignore-target-windows: No pthreads on Windows

fn main() {
unsafe {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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];
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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`.

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//@ignore-target-windows: No libc on Windows

fn main() {
unsafe {
let p1 = libc::malloc(20);
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tests/panic/unsupported_syscall.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
22 changes: 0 additions & 22 deletions tests/pass-dep/calloc.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/pass-dep/concurrency/libc_pthread_cond_timedwait.rs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/pass-dep/concurrency/tls_pthread_drop_order.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/pass-dep/extra_fn_ptr_gc.rs
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading