Skip to content

Commit af033ea

Browse files
committed
Auto merge of #2492 - RalfJung:tests, r=RalfJung
organize shim tests into shims folder, and various test suite tweaks
2 parents b8f6178 + ed41f1c commit af033ea

File tree

116 files changed

+128
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+128
-218
lines changed

tests/fail/concurrency/libc_pthread_create_main_terminate.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
// Check that we terminate the program when the main thread terminates.
55

6-
#![feature(rustc_private)]
7-
86
use std::{mem, ptr};
97

108
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {

tests/fail/concurrency/libc_pthread_join_detached.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// Joining a detached thread is undefined behavior.
44

5-
#![feature(rustc_private)]
6-
75
use std::{mem, ptr};
86

97
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {

tests/fail/concurrency/libc_pthread_join_joined.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// Joining an already joined thread is undefined behavior.
44

5-
#![feature(rustc_private)]
6-
75
use std::{mem, ptr};
86

97
extern "C" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {

tests/fail/concurrency/libc_pthread_join_main.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// Joining the main thread is undefined behavior.
44

5-
#![feature(rustc_private)]
6-
75
use std::{ptr, thread};
86

97
fn main() {

tests/fail/concurrency/libc_pthread_join_multiple.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
// Joining the same thread from multiple threads is undefined behavior.
44

5-
#![feature(rustc_private)]
6-
75
use std::thread;
86
use std::{mem, ptr};
97

tests/fail/concurrency/libc_pthread_join_self.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
// Joining itself is undefined behavior.
66

7-
#![feature(rustc_private)]
8-
97
use std::{ptr, thread};
108

119
fn main() {

tests/fail/concurrency/too_few_args.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
//! The thread function must have exactly one argument.
44
5-
#![feature(rustc_private)]
6-
75
use std::{mem, ptr};
86

97
extern "C" fn thread_start() -> *mut libc::c_void {

tests/fail/concurrency/too_many_args.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
//! The thread function must have exactly one argument.
44
5-
#![feature(rustc_private)]
6-
75
use std::{mem, ptr};
86

97
extern "C" fn thread_start(_null: *mut libc::c_void, _x: i32) -> *mut libc::c_void {

tests/fail/concurrency/unwind_top_of_stack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//! Unwinding past the top frame of a stack is Undefined Behavior.
55
6-
#![feature(rustc_private, c_unwind)]
6+
#![feature(c_unwind)]
77

88
use std::{mem, ptr};
99

tests/fail/fs/close_stdout.rs renamed to tests/fail/shims/fs/close_stdout.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
// FIXME: standard handles cannot be closed (https://github.com/rust-lang/rust/issues/40032)
55

6-
#![feature(rustc_private)]
7-
86
fn main() {
97
unsafe {
108
libc::close(1); //~ ERROR: cannot close stdout
File renamed without changes.

tests/fail/fs/isolated_stdin.rs renamed to tests/fail/shims/fs/isolated_stdin.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() -> std::io::Result<()> {
64
let mut bytes = [0u8; 512];
75
unsafe {

tests/fail/fs/mkstemp_immutable_arg.rs renamed to tests/fail/shims/fs/mkstemp_immutable_arg.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ignore-target-windows: No libc on Windows
22
//@compile-flags: -Zmiri-disable-isolation
33

4-
#![feature(rustc_private)]
5-
64
fn main() {
75
test_mkstemp_immutable_arg();
86
}

tests/fail/fs/read_from_stdout.rs renamed to tests/fail/shims/fs/read_from_stdout.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@compile-flags: -Zmiri-disable-isolation
22
//@ignore-target-windows: No libc on Windows
33

4-
#![feature(rustc_private)]
5-
64
fn main() -> std::io::Result<()> {
75
let mut bytes = [0u8; 512];
86
unsafe {

tests/fail/fs/unix_open_missing_required_mode.rs renamed to tests/fail/shims/fs/unix_open_missing_required_mode.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ignore-target-windows: No libc on Windows
22
//@compile-flags: -Zmiri-disable-isolation
33

4-
#![feature(rustc_private)]
5-
64
fn main() {
75
test_file_open_missing_needed_mode();
86
}

tests/fail/fs/write_to_stdin.rs renamed to tests/fail/shims/fs/write_to_stdin.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() -> std::io::Result<()> {
64
let bytes = b"hello";
75
unsafe {
File renamed without changes.

tests/fail/sync/libc_pthread_cond_double_destroy.rs renamed to tests/fail/shims/sync/libc_pthread_cond_double_destroy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ignore-target-windows: No libc on Windows
2-
#![feature(rustc_private)]
32

43
/// Test that destroying a pthread_cond twice fails, even without a check for number validity
54

tests/fail/sync/libc_pthread_condattr_double_destroy.rs renamed to tests/fail/shims/sync/libc_pthread_condattr_double_destroy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ignore-target-windows: No libc on Windows
2-
#![feature(rustc_private)]
32

43
/// Test that destroying a pthread_condattr twice fails, even without a check for number validity
54

tests/fail/sync/libc_pthread_mutex_NULL_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_NULL_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//
33
// Check that if we pass NULL attribute, then we get the default mutex type.
44

5-
#![feature(rustc_private)]
6-
75
fn main() {
86
unsafe {
97
let mut mutex: libc::pthread_mutex_t = std::mem::zeroed();

tests/fail/sync/libc_pthread_mutex_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/sync/libc_pthread_mutex_default_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_default_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//
33
// Check that if we do not set the mutex type, it is the default.
44

5-
#![feature(rustc_private)]
6-
75
fn main() {
86
unsafe {
97
let mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();

tests/fail/sync/libc_pthread_mutex_destroy_locked.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_destroy_locked.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
unsafe {
75
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();

tests/fail/sync/libc_pthread_mutex_double_destroy.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_double_destroy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ignore-target-windows: No libc on Windows
2-
#![feature(rustc_private)]
32

43
/// Test that destroying a pthread_mutex twice fails, even without a check for number validity
54

tests/fail/sync/libc_pthread_mutex_normal_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_normal_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
unsafe {
75
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();

tests/fail/sync/libc_pthread_mutex_normal_unlock_unlocked.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_normal_unlock_unlocked.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
unsafe {
75
let mut mutexattr: libc::pthread_mutexattr_t = std::mem::zeroed();

tests/fail/sync/libc_pthread_mutex_wrong_owner.rs renamed to tests/fail/shims/sync/libc_pthread_mutex_wrong_owner.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/sync/libc_pthread_mutexattr_double_destroy.rs renamed to tests/fail/shims/sync/libc_pthread_mutexattr_double_destroy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ignore-target-windows: No libc on Windows
2-
#![feature(rustc_private)]
32

43
/// Test that destroying a pthread_mutexattr twice fails, even without a check for number validity
54

tests/fail/sync/libc_pthread_rwlock_destroy_read_locked.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_destroy_read_locked.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_destroy_write_locked.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_destroy_write_locked.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_double_destroy.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_double_destroy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ignore-target-windows: No libc on Windows
2-
#![feature(rustc_private)]
32

43
/// Test that destroying a pthread_rwlock twice fails, even without a check for number validity
54

tests/fail/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_read_wrong_owner.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_read_wrong_owner.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/sync/libc_pthread_rwlock_unlock_unlocked.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_unlock_unlocked.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_write_read_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_write_read_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_write_write_deadlock.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_write_write_deadlock.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
fn main() {
64
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
75
unsafe {

tests/fail/sync/libc_pthread_rwlock_write_wrong_owner.rs renamed to tests/fail/shims/sync/libc_pthread_rwlock_write_wrong_owner.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::cell::UnsafeCell;
64
use std::sync::Arc;
75
use std::thread;

tests/fail/unsupported_signal.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! `signal()` is special on Linux and macOS that it's only supported within libstd.
22
//! The implementation is not complete enough to permit user code to call it.
33
//@ignore-target-windows: No libc on Windows
4-
#![feature(rustc_private)]
54

65
fn main() {
76
unsafe {

tests/panic/unsupported_syscall.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ignore-target-windows: No libc on Windows
22
//@ignore-target-apple: `syscall` is not supported on macOS
33
//@compile-flags: -Zmiri-panic-on-unsupported
4-
#![feature(rustc_private)]
54

65
fn main() {
76
unsafe {

tests/pass/calloc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use core::slice;
64

75
fn main() {

tests/pass/concurrency/libc_pthread_cond.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//@ignore-target-apple: pthread_condattr_setclock is not supported on MacOS.
33
//@compile-flags: -Zmiri-disable-isolation
44

5-
#![feature(rustc_private)]
6-
75
/// Test that conditional variable timeouts are working properly with both
86
/// monotonic and system clocks.
97
use std::mem::MaybeUninit;

tests/pass/concurrency/linux-futex.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@only-target-linux
22
//@compile-flags: -Zmiri-disable-isolation
33

4-
#![feature(rustc_private)]
5-
64
use std::mem::MaybeUninit;
75
use std::ptr;
86
use std::sync::atomic::AtomicI32;

tests/pass/concurrency/tls_pthread_drop_order.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use std::mem;
64
use std::ptr;
75

tests/pass/foreign-fn-linkname.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//ignore-windows: Uses POSIX APIs
2-
#![feature(rustc_private)]
3-
41
use std::ffi::CString;
52

63
mod mlibc {

tests/pass/malloc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
22

3-
#![feature(rustc_private)]
4-
53
use core::{ptr, slice};
64

75
fn main() {

tests/pass/regions-mock-trans.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//ignore-windows: Uses POSIX APIs
2-
3-
#![feature(rustc_private)]
4-
51
use std::mem;
62

73
struct Arena(());
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/pass/fs.rs renamed to tests/pass/shims/fs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ignore-target-windows: File handling is not implemented yet
22
//@compile-flags: -Zmiri-disable-isolation
33

4-
#![feature(rustc_private)]
54
#![feature(io_error_more)]
65
#![feature(io_error_uncategorized)]
76

File renamed without changes.
File renamed without changes.

tests/pass/fs_with_isolation.rs renamed to tests/pass/shims/fs_with_isolation.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
//@compile-flags: -Zmiri-isolation-error=warn-nobacktrace
33
//@normalize-stderr-test: "(stat(x)?)" -> "$$STAT"
44

5-
#![feature(rustc_private)]
6-
75
use std::ffi::CString;
86
use std::fs::{self, File};
97
use std::io::{Error, ErrorKind};

0 commit comments

Comments
 (0)