From e4db4282c30aeedc8e2a44e87715ffb8d9a7336a 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 ++++---- tests/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 tests/fail/panic/{thread_local_const_drop_panic.rs => tls_macro_const_drop_panic.rs} (100%) rename tests/fail/panic/{thread_local_const_drop_panic.stderr => tls_macro_const_drop_panic.stderr} (68%) rename tests/fail/panic/{thread_local_drop_panic.rs => tls_macro_drop_panic.rs} (100%) rename tests/fail/panic/{thread_local_drop_panic.stderr => tls_macro_drop_panic.stderr} (70%) rename tests/fail/{concurrency/thread_local_static_dealloc.rs => tls/tls_static_dealloc.rs} (100%) rename tests/fail/{concurrency/thread_local_static_dealloc.stderr => tls/tls_static_dealloc.stderr} (84%) rename tests/fail/{leak_in_lib_tls.rs => tls_macro_leak.rs} (100%) rename tests/fail/{leak_in_lib_tls.stderr => tls_macro_leak.stderr} (81%) rename tests/fail/{leak_in_static_tls.rs => tls_static_leak.rs} (100%) rename tests/fail/{leak_in_static_tls.stderr => tls_static_leak.stderr} (96%) rename tests/pass/{concurrency => tls}/tls_leak_main_thread_allowed.rs (91%) rename tests/pass/{concurrency/tls_lib_drop.rs => tls/tls_macro_drop.rs} (100%) rename tests/pass/{concurrency/tls_lib_drop.stack.stdout => tls/tls_macro_drop.stack.stdout} (100%) rename tests/pass/{concurrency/tls_lib_drop.tree.stdout => tls/tls_macro_drop.tree.stdout} (100%) rename tests/pass/{concurrency/tls_lib_drop_single_thread.rs => tls/tls_macro_drop_single_thread.rs} (89%) rename tests/pass/{concurrency/tls_lib_drop_single_thread.stderr => tls/tls_macro_drop_single_thread.stderr} (100%) rename tests/pass/{concurrency/thread_locals.rs => tls/tls_static.rs} (100%) diff --git a/tests/fail/panic/thread_local_const_drop_panic.rs b/tests/fail/panic/tls_macro_const_drop_panic.rs similarity index 100% rename from tests/fail/panic/thread_local_const_drop_panic.rs rename to tests/fail/panic/tls_macro_const_drop_panic.rs diff --git a/tests/fail/panic/thread_local_const_drop_panic.stderr b/tests/fail/panic/tls_macro_const_drop_panic.stderr similarity index 68% rename from tests/fail/panic/thread_local_const_drop_panic.stderr rename to tests/fail/panic/tls_macro_const_drop_panic.stderr index 550d009607..17e92fec6f 100644 --- a/tests/fail/panic/thread_local_const_drop_panic.stderr +++ b/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/tests/fail/panic/thread_local_drop_panic.rs b/tests/fail/panic/tls_macro_drop_panic.rs similarity index 100% rename from tests/fail/panic/thread_local_drop_panic.rs rename to tests/fail/panic/tls_macro_drop_panic.rs diff --git a/tests/fail/panic/thread_local_drop_panic.stderr b/tests/fail/panic/tls_macro_drop_panic.stderr similarity index 70% rename from tests/fail/panic/thread_local_drop_panic.stderr rename to tests/fail/panic/tls_macro_drop_panic.stderr index 3d6c41faab..b1a384bbb5 100644 --- a/tests/fail/panic/thread_local_drop_panic.stderr +++ b/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/tests/fail/concurrency/thread_local_static_dealloc.rs b/tests/fail/tls/tls_static_dealloc.rs similarity index 100% rename from tests/fail/concurrency/thread_local_static_dealloc.rs rename to tests/fail/tls/tls_static_dealloc.rs diff --git a/tests/fail/concurrency/thread_local_static_dealloc.stderr b/tests/fail/tls/tls_static_dealloc.stderr similarity index 84% rename from tests/fail/concurrency/thread_local_static_dealloc.stderr rename to tests/fail/tls/tls_static_dealloc.stderr index 7069e8cccf..ae8a421ca4 100644 --- a/tests/fail/concurrency/thread_local_static_dealloc.stderr +++ b/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/tests/fail/leak_in_lib_tls.rs b/tests/fail/tls_macro_leak.rs similarity index 100% rename from tests/fail/leak_in_lib_tls.rs rename to tests/fail/tls_macro_leak.rs diff --git a/tests/fail/leak_in_lib_tls.stderr b/tests/fail/tls_macro_leak.stderr similarity index 81% rename from tests/fail/leak_in_lib_tls.stderr rename to tests/fail/tls_macro_leak.stderr index e3c99710f8..e9daa78543 100644 --- a/tests/fail/leak_in_lib_tls.stderr +++ b/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/tests/fail/leak_in_static_tls.rs b/tests/fail/tls_static_leak.rs similarity index 100% rename from tests/fail/leak_in_static_tls.rs rename to tests/fail/tls_static_leak.rs diff --git a/tests/fail/leak_in_static_tls.stderr b/tests/fail/tls_static_leak.stderr similarity index 96% rename from tests/fail/leak_in_static_tls.stderr rename to tests/fail/tls_static_leak.stderr index 7ef25a52c1..bcfaf80229 100644 --- a/tests/fail/leak_in_static_tls.stderr +++ b/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/tests/pass/concurrency/tls_leak_main_thread_allowed.rs b/tests/pass/tls/tls_leak_main_thread_allowed.rs similarity index 91% rename from tests/pass/concurrency/tls_leak_main_thread_allowed.rs rename to tests/pass/tls/tls_leak_main_thread_allowed.rs index 500b7a8089..7732e3f921 100644 --- a/tests/pass/concurrency/tls_leak_main_thread_allowed.rs +++ b/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/tests/pass/concurrency/tls_lib_drop.rs b/tests/pass/tls/tls_macro_drop.rs similarity index 100% rename from tests/pass/concurrency/tls_lib_drop.rs rename to tests/pass/tls/tls_macro_drop.rs diff --git a/tests/pass/concurrency/tls_lib_drop.stack.stdout b/tests/pass/tls/tls_macro_drop.stack.stdout similarity index 100% rename from tests/pass/concurrency/tls_lib_drop.stack.stdout rename to tests/pass/tls/tls_macro_drop.stack.stdout diff --git a/tests/pass/concurrency/tls_lib_drop.tree.stdout b/tests/pass/tls/tls_macro_drop.tree.stdout similarity index 100% rename from tests/pass/concurrency/tls_lib_drop.tree.stdout rename to tests/pass/tls/tls_macro_drop.tree.stdout diff --git a/tests/pass/concurrency/tls_lib_drop_single_thread.rs b/tests/pass/tls/tls_macro_drop_single_thread.rs similarity index 89% rename from tests/pass/concurrency/tls_lib_drop_single_thread.rs rename to tests/pass/tls/tls_macro_drop_single_thread.rs index 2766ba36d1..f36c460ae5 100644 --- a/tests/pass/concurrency/tls_lib_drop_single_thread.rs +++ b/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/tests/pass/concurrency/tls_lib_drop_single_thread.stderr b/tests/pass/tls/tls_macro_drop_single_thread.stderr similarity index 100% rename from tests/pass/concurrency/tls_lib_drop_single_thread.stderr rename to tests/pass/tls/tls_macro_drop_single_thread.stderr diff --git a/tests/pass/concurrency/thread_locals.rs b/tests/pass/tls/tls_static.rs similarity index 100% rename from tests/pass/concurrency/thread_locals.rs rename to tests/pass/tls/tls_static.rs