From 137903671305d30ede80586388cd4db535aa92be Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Sun, 5 Jun 2022 10:37:40 +0100 Subject: [PATCH] Simplify known C++20 inconsistency test --- .../cpp20_rwc_syncs.rs | 11 +++++---- tests/fail/should-pass/cpp20_rwc_syncs.stderr | 3 +++ tests/fail/weak_memory/cpp20_rwc_syncs.stderr | 23 ------------------- 3 files changed, 9 insertions(+), 28 deletions(-) rename tests/fail/{weak_memory => should-pass}/cpp20_rwc_syncs.rs (83%) create mode 100644 tests/fail/should-pass/cpp20_rwc_syncs.stderr delete mode 100644 tests/fail/weak_memory/cpp20_rwc_syncs.stderr diff --git a/tests/fail/weak_memory/cpp20_rwc_syncs.rs b/tests/fail/should-pass/cpp20_rwc_syncs.rs similarity index 83% rename from tests/fail/weak_memory/cpp20_rwc_syncs.rs rename to tests/fail/should-pass/cpp20_rwc_syncs.rs index 7fe24d638346..e5192cd0d670 100644 --- a/tests/fail/weak_memory/cpp20_rwc_syncs.rs +++ b/tests/fail/should-pass/cpp20_rwc_syncs.rs @@ -1,5 +1,6 @@ // ignore-windows: Concurrency on Windows is not supported yet. // compile-flags: -Zmiri-ignore-leaks +// error-pattern: // https://plv.mpi-sws.org/scfix/paper.pdf // 2.2 Second Problem: SC Fences are Too Weak @@ -70,12 +71,12 @@ fn test_cpp20_rwc_syncs() { let b = j2.join().unwrap(); let c = j3.join().unwrap(); + // We cannot write assert_ne!() since ui_test's fail + // tests expect exit status 1, whereas panics produce 101. + // Our ui_test does not yet support overriding failure status codes. if (b, c) == (0, 0) { - // FIXME: the standalone compiletest-rs needs to support - // failure-status header to allow us to write assert_ne!((b, c), (0, 0)) - // https://rustc-dev-guide.rust-lang.org/tests/headers.html#miscellaneous-headers - // because panic exits with 101 but compile-rs expects 1 - let _ = unsafe { std::mem::MaybeUninit::<*const u32>::uninit().assume_init() }; //~ ERROR uninitialized + // This *should* be unreachable, but Miri will reach it. + std::process::exit(1); } } diff --git a/tests/fail/should-pass/cpp20_rwc_syncs.stderr b/tests/fail/should-pass/cpp20_rwc_syncs.stderr new file mode 100644 index 000000000000..9fe6daa778c1 --- /dev/null +++ b/tests/fail/should-pass/cpp20_rwc_syncs.stderr @@ -0,0 +1,3 @@ +warning: thread support is experimental: the scheduler is not preemptive, and can get stuck in spin loops. + (see https://github.com/rust-lang/miri/issues/1388) + diff --git a/tests/fail/weak_memory/cpp20_rwc_syncs.stderr b/tests/fail/weak_memory/cpp20_rwc_syncs.stderr deleted file mode 100644 index f4f467120e8a..000000000000 --- a/tests/fail/weak_memory/cpp20_rwc_syncs.stderr +++ /dev/null @@ -1,23 +0,0 @@ -warning: thread support is experimental: the scheduler is not preemptive, and can get stuck in spin loops. - (see https://github.com/rust-lang/miri/issues/1388) - -error: Undefined Behavior: type validation failed at .value: encountered uninitialized raw pointer - --> $DIR/cpp20_rwc_syncs.rs:LL:CC - | -LL | let _ = unsafe { std::mem::MaybeUninit::<*const u32>::uninit().assume_init() }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at .value: encountered uninitialized raw pointer - | - = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior - = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - - = note: inside `test_cpp20_rwc_syncs` at $DIR/cpp20_rwc_syncs.rs:LL:CC -note: inside `main` at $DIR/cpp20_rwc_syncs.rs:LL:CC - --> $DIR/cpp20_rwc_syncs.rs:LL:CC - | -LL | test_cpp20_rwc_syncs(); - | ^^^^^^^^^^^^^^^^^^^^^^ - -note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace - -error: aborting due to previous error; 1 warning emitted -