From 10c9e7594ed9a3936a18ad9cb7c75efe713eb2ed Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 12 Nov 2023 17:12:53 +0100 Subject: [PATCH] more consistent naming for TLS tests --- ..._const_drop_panic.rs => tls_macro_const_drop_panic.rs} | 0 ...rop_panic.stderr => tls_macro_const_drop_panic.stderr} | 2 +- ...thread_local_drop_panic.rs => tls_macro_drop_panic.rs} | 0 ...ocal_drop_panic.stderr => tls_macro_drop_panic.stderr} | 2 +- .../tls_static_dealloc.rs} | 0 .../tls_static_dealloc.stderr} | 4 ++-- .../tests/fail/{leak_in_lib_tls.rs => tls_macro_leak.rs} | 0 .../{leak_in_lib_tls.stderr => tls_macro_leak.stderr} | 8 ++++---- .../fail/{leak_in_static_tls.rs => tls_static_leak.rs} | 0 .../{leak_in_static_tls.stderr => tls_static_leak.stderr} | 2 +- .../{concurrency => tls}/tls_leak_main_thread_allowed.rs | 2 ++ .../tls_lib_drop.rs => tls/tls_macro_drop.rs} | 0 .../tls_macro_drop.stack.stdout} | 0 .../tls_macro_drop.tree.stdout} | 0 .../tls_macro_drop_single_thread.rs} | 3 ++- .../tls_macro_drop_single_thread.stderr} | 0 .../{concurrency/thread_locals.rs => tls/tls_static.rs} | 0 17 files changed, 13 insertions(+), 10 deletions(-) rename src/tools/miri/tests/fail/panic/{thread_local_const_drop_panic.rs => tls_macro_const_drop_panic.rs} (100%) rename src/tools/miri/tests/fail/panic/{thread_local_const_drop_panic.stderr => tls_macro_const_drop_panic.stderr} (68%) rename src/tools/miri/tests/fail/panic/{thread_local_drop_panic.rs => tls_macro_drop_panic.rs} (100%) rename src/tools/miri/tests/fail/panic/{thread_local_drop_panic.stderr => tls_macro_drop_panic.stderr} (70%) rename src/tools/miri/tests/fail/{concurrency/thread_local_static_dealloc.rs => tls/tls_static_dealloc.rs} (100%) rename src/tools/miri/tests/fail/{concurrency/thread_local_static_dealloc.stderr => tls/tls_static_dealloc.stderr} (84%) rename src/tools/miri/tests/fail/{leak_in_lib_tls.rs => tls_macro_leak.rs} (100%) rename src/tools/miri/tests/fail/{leak_in_lib_tls.stderr => tls_macro_leak.stderr} (81%) rename src/tools/miri/tests/fail/{leak_in_static_tls.rs => tls_static_leak.rs} (100%) rename src/tools/miri/tests/fail/{leak_in_static_tls.stderr => tls_static_leak.stderr} (96%) rename src/tools/miri/tests/pass/{concurrency => tls}/tls_leak_main_thread_allowed.rs (91%) rename src/tools/miri/tests/pass/{concurrency/tls_lib_drop.rs => tls/tls_macro_drop.rs} (100%) rename src/tools/miri/tests/pass/{concurrency/tls_lib_drop.stack.stdout => tls/tls_macro_drop.stack.stdout} (100%) rename src/tools/miri/tests/pass/{concurrency/tls_lib_drop.tree.stdout => tls/tls_macro_drop.tree.stdout} (100%) rename src/tools/miri/tests/pass/{concurrency/tls_lib_drop_single_thread.rs => tls/tls_macro_drop_single_thread.rs} (89%) rename src/tools/miri/tests/pass/{concurrency/tls_lib_drop_single_thread.stderr => tls/tls_macro_drop_single_thread.stderr} (100%) rename src/tools/miri/tests/pass/{concurrency/thread_locals.rs => tls/tls_static.rs} (100%) diff --git a/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs b/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.rs similarity index 100% rename from src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.rs rename to src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.rs diff --git a/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr b/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr similarity index 68% rename from src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr rename to src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr index 550d009607d..17e92fec6fd 100644 --- a/src/tools/miri/tests/fail/panic/thread_local_const_drop_panic.stderr +++ b/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr @@ -1,4 +1,4 @@ -thread $NAME panicked at $DIR/thread_local_const_drop_panic.rs:LL:CC: +thread $NAME panicked at $DIR/tls_macro_const_drop_panic.rs:LL:CC: ow fatal runtime error: thread local panicked on drop error: abnormal termination: the program aborted execution diff --git a/src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs similarity index 100% rename from src/tools/miri/tests/fail/panic/thread_local_drop_panic.rs rename to src/tools/miri/tests/fail/panic/tls_macro_drop_panic.rs diff --git a/src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr similarity index 70% rename from src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr rename to src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr index 3d6c41faabc..b1a384bbb52 100644 --- a/src/tools/miri/tests/fail/panic/thread_local_drop_panic.stderr +++ b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr @@ -1,4 +1,4 @@ -thread $NAME panicked at $DIR/thread_local_drop_panic.rs:LL:CC: +thread $NAME panicked at $DIR/tls_macro_drop_panic.rs:LL:CC: ow fatal runtime error: thread local panicked on drop error: abnormal termination: the program aborted execution diff --git a/src/tools/miri/tests/fail/concurrency/thread_local_static_dealloc.rs b/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs similarity index 100% rename from src/tools/miri/tests/fail/concurrency/thread_local_static_dealloc.rs rename to src/tools/miri/tests/fail/tls/tls_static_dealloc.rs diff --git a/src/tools/miri/tests/fail/concurrency/thread_local_static_dealloc.stderr b/src/tools/miri/tests/fail/tls/tls_static_dealloc.stderr similarity index 84% rename from src/tools/miri/tests/fail/concurrency/thread_local_static_dealloc.stderr rename to src/tools/miri/tests/fail/tls/tls_static_dealloc.stderr index 7069e8cccfe..ae8a421ca40 100644 --- a/src/tools/miri/tests/fail/concurrency/thread_local_static_dealloc.stderr +++ b/src/tools/miri/tests/fail/tls/tls_static_dealloc.stderr @@ -1,5 +1,5 @@ error: Undefined Behavior: memory access failed: ALLOC has been freed, so this pointer is dangling - --> $DIR/thread_local_static_dealloc.rs:LL:CC + --> $DIR/tls_static_dealloc.rs:LL:CC | LL | let _val = *dangling_ptr.0; | ^^^^^^^^^^^^^^^ memory access failed: ALLOC has been freed, so this pointer is dangling @@ -7,7 +7,7 @@ LL | let _val = *dangling_ptr.0; = 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: BACKTRACE: - = note: inside `main` at $DIR/thread_local_static_dealloc.rs:LL:CC + = note: inside `main` at $DIR/tls_static_dealloc.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/leak_in_lib_tls.rs b/src/tools/miri/tests/fail/tls_macro_leak.rs similarity index 100% rename from src/tools/miri/tests/fail/leak_in_lib_tls.rs rename to src/tools/miri/tests/fail/tls_macro_leak.rs diff --git a/src/tools/miri/tests/fail/leak_in_lib_tls.stderr b/src/tools/miri/tests/fail/tls_macro_leak.stderr similarity index 81% rename from src/tools/miri/tests/fail/leak_in_lib_tls.stderr rename to src/tools/miri/tests/fail/tls_macro_leak.stderr index e3c99710f8b..e9daa78543c 100644 --- a/src/tools/miri/tests/fail/leak_in_lib_tls.stderr +++ b/src/tools/miri/tests/fail/tls_macro_leak.stderr @@ -10,14 +10,14 @@ LL | __rust_alloc(layout.size(), layout.align()) = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::boxed::Box::::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC note: inside closure - --> $DIR/leak_in_lib_tls.rs:LL:CC + --> $DIR/tls_macro_leak.rs:LL:CC | LL | cell.set(Some(Box::leak(Box::new(123)))); | ^^^^^^^^^^^^^ - = note: inside `std::thread::LocalKey::>>::try_with::<{closure@$DIR/leak_in_lib_tls.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC - = note: inside `std::thread::LocalKey::>>::with::<{closure@$DIR/leak_in_lib_tls.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC + = note: inside `std::thread::LocalKey::>>::try_with::<{closure@$DIR/tls_macro_leak.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC + = note: inside `std::thread::LocalKey::>>::with::<{closure@$DIR/tls_macro_leak.rs:LL:CC}, ()>` at RUSTLIB/std/src/thread/local.rs:LL:CC note: inside closure - --> $DIR/leak_in_lib_tls.rs:LL:CC + --> $DIR/tls_macro_leak.rs:LL:CC | LL | / TLS.with(|cell| { LL | | cell.set(Some(Box::leak(Box::new(123)))); diff --git a/src/tools/miri/tests/fail/leak_in_static_tls.rs b/src/tools/miri/tests/fail/tls_static_leak.rs similarity index 100% rename from src/tools/miri/tests/fail/leak_in_static_tls.rs rename to src/tools/miri/tests/fail/tls_static_leak.rs diff --git a/src/tools/miri/tests/fail/leak_in_static_tls.stderr b/src/tools/miri/tests/fail/tls_static_leak.stderr similarity index 96% rename from src/tools/miri/tests/fail/leak_in_static_tls.stderr rename to src/tools/miri/tests/fail/tls_static_leak.stderr index 7ef25a52c17..bcfaf80229a 100644 --- a/src/tools/miri/tests/fail/leak_in_static_tls.stderr +++ b/src/tools/miri/tests/fail/tls_static_leak.stderr @@ -10,7 +10,7 @@ LL | __rust_alloc(layout.size(), layout.align()) = note: inside `alloc::alloc::exchange_malloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::boxed::Box::::new` at RUSTLIB/alloc/src/boxed.rs:LL:CC note: inside closure - --> $DIR/leak_in_static_tls.rs:LL:CC + --> $DIR/tls_static_leak.rs:LL:CC | LL | TLS.set(Some(Box::leak(Box::new(123)))); | ^^^^^^^^^^^^^ diff --git a/src/tools/miri/tests/pass/concurrency/tls_leak_main_thread_allowed.rs b/src/tools/miri/tests/pass/tls/tls_leak_main_thread_allowed.rs similarity index 91% rename from src/tools/miri/tests/pass/concurrency/tls_leak_main_thread_allowed.rs rename to src/tools/miri/tests/pass/tls/tls_leak_main_thread_allowed.rs index 500b7a80892..7732e3f9217 100644 --- a/src/tools/miri/tests/pass/concurrency/tls_leak_main_thread_allowed.rs +++ b/src/tools/miri/tests/pass/tls/tls_leak_main_thread_allowed.rs @@ -5,6 +5,8 @@ use std::cell::Cell; // Thread-local variables in the main thread are basically like `static` (they live // as long as the program does), so make sure we treat them the same for leak purposes. +// +// The test covers both TLS statics and the TLS macro. pub fn main() { thread_local! { static TLS_KEY: Cell> = Cell::new(None); diff --git a/src/tools/miri/tests/pass/concurrency/tls_lib_drop.rs b/src/tools/miri/tests/pass/tls/tls_macro_drop.rs similarity index 100% rename from src/tools/miri/tests/pass/concurrency/tls_lib_drop.rs rename to src/tools/miri/tests/pass/tls/tls_macro_drop.rs diff --git a/src/tools/miri/tests/pass/concurrency/tls_lib_drop.stack.stdout b/src/tools/miri/tests/pass/tls/tls_macro_drop.stack.stdout similarity index 100% rename from src/tools/miri/tests/pass/concurrency/tls_lib_drop.stack.stdout rename to src/tools/miri/tests/pass/tls/tls_macro_drop.stack.stdout diff --git a/src/tools/miri/tests/pass/concurrency/tls_lib_drop.tree.stdout b/src/tools/miri/tests/pass/tls/tls_macro_drop.tree.stdout similarity index 100% rename from src/tools/miri/tests/pass/concurrency/tls_lib_drop.tree.stdout rename to src/tools/miri/tests/pass/tls/tls_macro_drop.tree.stdout diff --git a/src/tools/miri/tests/pass/concurrency/tls_lib_drop_single_thread.rs b/src/tools/miri/tests/pass/tls/tls_macro_drop_single_thread.rs similarity index 89% rename from src/tools/miri/tests/pass/concurrency/tls_lib_drop_single_thread.rs rename to src/tools/miri/tests/pass/tls/tls_macro_drop_single_thread.rs index 2766ba36d12..f36c460ae53 100644 --- a/src/tools/miri/tests/pass/concurrency/tls_lib_drop_single_thread.rs +++ b/src/tools/miri/tests/pass/tls/tls_macro_drop_single_thread.rs @@ -1,4 +1,5 @@ -//! Check that destructors of the thread locals are executed on all OSes. +//! Check that destructors of the thread locals are executed on all OSes +//! (even when we do not support concurrency, and cannot run the other test). use std::cell::RefCell; diff --git a/src/tools/miri/tests/pass/concurrency/tls_lib_drop_single_thread.stderr b/src/tools/miri/tests/pass/tls/tls_macro_drop_single_thread.stderr similarity index 100% rename from src/tools/miri/tests/pass/concurrency/tls_lib_drop_single_thread.stderr rename to src/tools/miri/tests/pass/tls/tls_macro_drop_single_thread.stderr diff --git a/src/tools/miri/tests/pass/concurrency/thread_locals.rs b/src/tools/miri/tests/pass/tls/tls_static.rs similarity index 100% rename from src/tools/miri/tests/pass/concurrency/thread_locals.rs rename to src/tools/miri/tests/pass/tls/tls_static.rs