Skip to content

Commit de41d01

Browse files
committed
Run all run(-dep) tests natively, too
1 parent d28fb80 commit de41d01

Some content is hidden

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

56 files changed

+235
-50
lines changed

tests/pass-dep/libc/libc-mem.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@only-miri: testing specific alignment shenanigans
12
#![feature(strict_provenance, pointer_is_aligned_to)]
23
use std::{mem, ptr, slice};
34

tests/pass-dep/num_cpus.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-disable-isolation
2+
//@only-miri: fake cpu number
23

34
fn main() {
45
assert_eq!(num_cpus::get(), 1);

tests/pass-dep/page_size_override.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-force-page-size=8
2+
//@only-miri: fake page size
23

34
fn main() {
45
let page_size = page_size::get();

tests/pass/adjacent-allocs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-permissive-provenance
2+
//@only-miri: CI found nonadjacent stack variables
23

34
fn ensure_allocs_can_be_adjacent() {
45
for _ in 0..512 {

tests/pass/atomic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
33
//@compile-flags: -Zmiri-strict-provenance
4+
//@only-miri: testing weak memory behaviour
45

56
#![feature(strict_provenance, strict_provenance_atomic_ptr)]
67
// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint

tests/pass/backtrace/backtrace-api-v0.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@normalize-stderr-test: "::<.*>" -> ""
2+
//@only-miri: backtraces differ too much
23

34
#[inline(never)]
45
fn func_a() -> Box<[*mut ()]> {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/pass/backtrace/backtrace-api-v0.rs:24:14 (func_d)
2-
tests/pass/backtrace/backtrace-api-v0.rs:14:9 (func_c)
3-
tests/pass/backtrace/backtrace-api-v0.rs:9:5 (func_b::<u8>)
4-
tests/pass/backtrace/backtrace-api-v0.rs:5:5 (func_a)
5-
tests/pass/backtrace/backtrace-api-v0.rs:29:18 (main)
1+
tests/pass/backtrace/backtrace-api-v0.rs:25:14 (func_d)
2+
tests/pass/backtrace/backtrace-api-v0.rs:15:9 (func_c)
3+
tests/pass/backtrace/backtrace-api-v0.rs:10:5 (func_b::<u8>)
4+
tests/pass/backtrace/backtrace-api-v0.rs:6:5 (func_a)
5+
tests/pass/backtrace/backtrace-api-v0.rs:30:18 (main)

tests/pass/backtrace/backtrace-api-v1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@normalize-stderr-test: "::<.*>" -> ""
2+
//@only-miri: backtraces differ too much
23

34
#[inline(never)]
45
fn func_a() -> Box<[*mut ()]> {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/pass/backtrace/backtrace-api-v1.rs:27:9 (func_d)
2-
tests/pass/backtrace/backtrace-api-v1.rs:14:9 (func_c)
3-
tests/pass/backtrace/backtrace-api-v1.rs:9:5 (func_b::<u8>)
4-
tests/pass/backtrace/backtrace-api-v1.rs:5:5 (func_a)
5-
tests/pass/backtrace/backtrace-api-v1.rs:34:18 (main)
1+
tests/pass/backtrace/backtrace-api-v1.rs:28:9 (func_d)
2+
tests/pass/backtrace/backtrace-api-v1.rs:15:9 (func_c)
3+
tests/pass/backtrace/backtrace-api-v1.rs:10:5 (func_b::<u8>)
4+
tests/pass/backtrace/backtrace-api-v1.rs:6:5 (func_a)
5+
tests/pass/backtrace/backtrace-api-v1.rs:35:18 (main)

tests/pass/backtrace/backtrace-global-alloc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@compile-flags: -Zmiri-disable-isolation
22
//@rustc-env: RUST_BACKTRACE=1
3+
//@only-miri: backtraces differ too much
34

45
use std::alloc::System;
56
use std::backtrace::Backtrace;

tests/pass/backtrace/backtrace-std.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@compile-flags: -Zmiri-disable-isolation
22
//@rustc-env: RUST_BACKTRACE=1
3+
//@only-miri: backtraces differ too much
34

45
use std::backtrace::Backtrace;
56

tests/pass/cfg_miri.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: cfg miri test
2+
13
fn main() {
24
assert!(cfg!(miri));
35
}

tests/pass/concurrency/thread_park_isolated.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ignore-target: apple # park_timeout on macOS uses the system clock
2+
//@only-miri: runtime has nondeterministic execution and may be slower than 210ms
23
use std::thread;
34
use std::time::{Duration, Instant};
45

tests/pass/const-addrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// stack frame, breaking this test.
99
//@compile-flags: -Zinline-mir=no
1010
#![feature(strict_provenance)]
11+
//@only-miri: expecting that pointer addresses have specific behaviour
1112

1213
const EVALS: usize = 256;
1314

tests/pass/dyn-traits.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: expecting that vtables are not deduplicated
2+
13
fn ref_box_dyn() {
24
struct Struct(i32);
35

tests/pass/extern_types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
3+
//@[stack]only-miri: miri specific warning
34
#![feature(extern_types, strict_provenance)]
45

56
use std::ptr;

tests/pass/float.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#![allow(arithmetic_overflow)]
77
#![allow(internal_features)]
88

9+
//@only-miri: FIXME: linker errors due to some missing libc float functions
10+
911
use std::any::type_name;
1012
use std::cmp::min;
1113
use std::fmt::{Debug, Display, LowerHex};

tests/pass/float_nan.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: FIXME: did not get value that should be possible: 0x7fc00000 (NaN: Pos, Quiet, payload = 0x0)
2+
13
#![feature(float_gamma, portable_simd, core_intrinsics)]
24
use std::collections::HashSet;
35
use std::fmt;

tests/pass/function_pointers.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: testing that function pointers are inequal
2+
13
use std::mem;
24

35
trait Answer {

tests/pass/getpid.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@revisions: with_isolation without_isolation
22
//@[without_isolation] compile-flags: -Zmiri-disable-isolation
3+
//@only-miri: miri isolation mode test
34

45
fn getpid() -> u32 {
56
std::process::id()

tests/pass/hide_stdout.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-mute-stdout-stderr
2+
//@only-miri: miri flag test
23

34
fn main() {
45
println!("print to stdout");

tests/pass/intptrcast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-permissive-provenance
2+
//@only-miri: FIXME: CI found a miscompile: `assert_eq!(2, 2)` failed in `should_be_ub`
23

34
use std::mem;
45

tests/pass/intrinsics/intrinsics.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,23 @@ fn main() {
3333
assert_eq!(intrinsics::likely(false), false);
3434
assert_eq!(intrinsics::unlikely(true), true);
3535

36-
let mut saw_true = false;
37-
let mut saw_false = false;
36+
#[cfg(miri)]
37+
{
38+
let mut saw_true = false;
39+
let mut saw_false = false;
3840

39-
for _ in 0..50 {
40-
if intrinsics::is_val_statically_known(0) {
41-
saw_true = true;
42-
} else {
43-
saw_false = true;
41+
for _ in 0..50 {
42+
if intrinsics::is_val_statically_known(0) {
43+
saw_true = true;
44+
} else {
45+
saw_false = true;
46+
}
4447
}
48+
assert!(
49+
saw_true && saw_false,
50+
"`is_val_statically_known` failed to return both true and false. Congrats, you won the lottery!"
51+
);
4552
}
46-
assert!(
47-
saw_true && saw_false,
48-
"`is_val_statically_known` failed to return both true and false. Congrats, you won the lottery!"
49-
);
5053

5154
intrinsics::forget(Bomb);
5255

tests/pass/miri_start.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Cpanic=abort
2+
//@only-miri: using miri internal apis
23
#![no_main]
34
#![no_std]
45

tests/pass/no_std.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Cpanic=abort
2+
//@only-miri: using miri internal apis
23
#![feature(start)]
34
#![no_std]
45

tests/pass/path.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-disable-isolation
2+
//@only-miri: using miri internal apis
23
use std::path::{Path, PathBuf, absolute};
34

45
#[path = "../utils/mod.rs"]

tests/pass/protector-gc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// allocation is still live. If the provenance GC only knows about the BorTag that is protected,
33
// we can ICE. This test checks that we don't.
44
// See https://github.com/rust-lang/miri/issues/3228
5+
//@only-miri: using miri internal apis
56

67
#[path = "../utils/mod.rs"]
78
mod utils;

tests/pass/provenance.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
3+
//@only-miri: FIXME compiler panic: assertion failed: matches!(scalar, Scalar::Int(..))
34
#![feature(strict_provenance)]
45
use std::{mem, ptr};
56

tests/pass/ptr_int_casts.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Tree Borrows doesn't support int2ptr casts, but let's make sure we don't immediately crash either.
33
//@[tree]compile-flags: -Zmiri-tree-borrows
44
//@[stack]compile-flags: -Zmiri-permissive-provenance
5+
//@[tree]only-miri: miri specific warnings
56
use std::{mem, ptr};
67

78
fn eq_ref<T>(x: &T, y: &T) -> bool {

tests/pass/ptr_int_from_exposed.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Tree Borrows doesn't support int2ptr casts, but let's make sure we don't immediately crash either.
33
//@[tree]compile-flags: -Zmiri-tree-borrows
44
//@[stack]compile-flags: -Zmiri-permissive-provenance
5+
//@[tree]only-miri: miri specific warnings
56
#![feature(strict_provenance, exposed_provenance)]
67

78
use std::ptr;

tests/pass/shims/available-parallelism-miri-num-cpus.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-num-cpus=1024
2+
//@only-miri: download more cores
23

34
use std::num::NonZero;
45
use std::thread::available_parallelism;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
3+
//@only-miri: real system can have different number of cores
34
fn main() {
45
assert_eq!(std::thread::available_parallelism().unwrap().get(), 1);
56
}

tests/pass/shims/env/args.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: the actual command changes between platforms with rustc
2+
13
fn main() {
24
for arg in std::env::args() {
35
println!("{}", arg);

tests/pass/shims/env/current_dir_with_isolation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@compile-flags: -Zmiri-isolation-error=warn-nobacktrace
22
//@normalize-stderr-test: "(getcwd|GetCurrentDirectoryW)" -> "$$GETCWD"
33
//@normalize-stderr-test: "(chdir|SetCurrentDirectoryW)" -> "$$SETCWD"
4+
//@only-miri: testing miri specific warnings
45

56
use std::env;
67
use std::io::ErrorKind;

tests/pass/shims/time-with-isolation.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::time::{Duration, Instant};
2+
//@only-miri: sleeps for one hour
23

34
fn test_sleep() {
45
// We sleep a *long* time here -- but the clock is virtual so the test should still pass quickly.

tests/pass/shims/time.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@compile-flags: -Zmiri-disable-isolation
2+
//@only-miri: runs under 1ms on a real system
23

34
use std::time::{Duration, Instant, SystemTime};
45

tests/pass/shims/x86/intrinsics-x86-aes-vaes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+aes,+vaes,+avx512f
4+
//@only-miri: FIXME: stability warnings only with rustc and some assert failures
45

56
#![feature(avx512_target_feature, stdarch_x86_avx512)]
67

tests/pass/shims/x86/intrinsics-x86-avx.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+avx
4+
//@only-miri: FIXME: some assert failures with rustc
45

56
#[cfg(target_arch = "x86")]
67
use std::arch::x86::*;

tests/pass/shims/x86/intrinsics-x86-avx2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+avx2
4+
//@only-miri: FIXME: some assert failures with rustc
45

56
#[cfg(target_arch = "x86")]
67
use std::arch::x86::*;

tests/pass/shims/x86/intrinsics-x86-avx512.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bitalg,+avx512vpopcntdq
4+
//@only-miri: FIXME: stability warnings only with rustc and some assert failures
45

56
#![feature(avx512_target_feature)]
67
#![feature(stdarch_x86_avx512)]

tests/pass/shims/x86/intrinsics-x86-gfni.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=+gfni,+avx512f
4+
//@only-miri: FIXME: returns weird exit code
45

56
// The constants in the tests below are just bit patterns. They should not
67
// be interpreted as integers; signedness does not make sense for them, but

tests/pass/shims/x86/intrinsics-x86-pause-without-sse2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We're testing x86 target specific features
22
//@only-target: x86_64 i686
33
//@compile-flags: -C target-feature=-sse2
4+
//@only-miri: FIXME: some assert failures with rustc
45

56
#[cfg(target_arch = "x86")]
67
use std::arch::x86::*;

tests/pass/stacked-borrows/issue-miri-2389.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@only-miri: emits miri-specific warnings
2+
13
use std::cell::Cell;
24

35
fn main() {

tests/pass/stacked-borrows/stack-printing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We disable the GC for this test because it would change what is printed. We are testing the
22
// printing, not how it interacts with the GC.
33
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-provenance-gc=0
4+
//@only-miri: using miri internal apis
45

56
#![feature(strict_provenance)]
67
use std::alloc::{self, Layout};

tests/pass/tail_call.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(incomplete_features)]
22
#![feature(explicit_tail_calls)]
3+
//@only-miri: FIXME: tail calls not supported by llvm backend yet
34

45
fn main() {
56
assert_eq!(factorial(10), 3_628_800);

tests/pass/tls/tls_macro_drop.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@revisions: stack tree
22
//@[tree]compile-flags: -Zmiri-tree-borrows
3+
//@only-miri: FIXME: gets stuck somewhere on windows at least
34

45
use std::cell::RefCell;
56
use std::thread;

tests/pass/tls/win_tls_callback.rs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// that's not what this test is about.
66
//@compile-flags: -Zmiri-ignore-leaks
77

8+
//@only-miri: FIXME: fatal runtime error: thread::set_current should only be called once per thread
9+
810
#[link_section = ".CRT$XLB"]
911
#[used] // Miri only considers explicitly `#[used]` statics for `lookup_link_section`
1012
pub static CALLBACK: unsafe extern "system" fn(*const (), u32, *const ()) = tls_callback;

tests/pass/tree_borrows/cell-alternate-writes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We disable the GC for this test because it would change what is printed.
22
//@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0
3+
//@only-miri: uses miri internal APIs
34
#[path = "../../utils/mod.rs"]
45
#[macro_use]
56
mod utils;

tests/pass/tree_borrows/end-of-protector.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We disable the GC for this test because it would change what is printed.
22
//@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0
3+
//@only-miri: uses miri internals
34

45
// Check that a protector goes back to normal behavior when the function
56
// returns.

tests/pass/tree_borrows/formatting.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We disable the GC for this test because it would change what is printed.
22
//@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0
3+
//@only-miri: uses miri internals
34

45
#[path = "../../utils/mod.rs"]
56
#[macro_use]

tests/pass/tree_borrows/reborrow-is-read.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We disable the GC for this test because it would change what is printed.
22
//@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0
3+
//@only-miri: uses miri internal APIs
34

45
#[path = "../../utils/mod.rs"]
56
#[macro_use]

tests/pass/tree_borrows/reserved.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// We disable the GC for this test because it would change what is printed.
22
//@compile-flags: -Zmiri-tree-borrows -Zmiri-provenance-gc=0
3+
//@only-miri: uses miri internals
34

45
#[path = "../../utils/mod.rs"]
56
#[macro_use]

0 commit comments

Comments
 (0)