diff --git a/tests/src/config.rs b/tests/src/config.rs index fa96adbc1d..62d3e56091 100644 --- a/tests/src/config.rs +++ b/tests/src/config.rs @@ -1,4 +1,4 @@ -use std::{future::Future, pin::Pin, sync::Arc}; +use std::{future::Future, panic::Location, pin::Pin, sync::Arc}; use crate::{TestParameters, TestingContext}; @@ -26,14 +26,17 @@ cfg_if::cfg_if! { #[derive(Clone)] pub struct GpuTestConfiguration { pub(crate) name: String, + pub(crate) location: &'static Location<'static>, pub(crate) params: TestParameters, pub(crate) test: Option, } impl GpuTestConfiguration { + #[track_caller] pub fn new() -> Self { Self { name: String::new(), + location: Location::caller(), params: TestParameters::default(), test: None, } diff --git a/tests/src/run.rs b/tests/src/run.rs index f56651b574..82ddb93399 100644 --- a/tests/src/run.rs +++ b/tests/src/run.rs @@ -116,7 +116,10 @@ pub async fn execute_test( // The call to matches_failure will log. if expectations_match_failures(&test_info.failures, failures) == ExpectationMatchResult::Panic { - panic!(); + panic!( + "{}: test {:?} did not behave as expected", + config.location, config.name + ); } // Print the name of the test. log::info!("TEST FINISHED: {}", config.name);