From 08b7e306c5ad751b825c6e60ac1fadeb93bbbef2 Mon Sep 17 00:00:00 2001 From: Cedric Barreteau Date: Mon, 19 Aug 2024 09:51:17 -0400 Subject: [PATCH] Add subtarget information to a test target name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets users know which subtarget failed, which is crucial when testing multiple test subtargets (e.g. when there is one per configuration, generated via transitions). Before: ``` 2 TESTS FAILED ✗ root//:dummy_test ✗ root//:dummy_test ``` After: ``` 2 TESTS FAILED ✗ root//:dummy_test[gcc13-cxx20-debug] ✗ root//:dummy_test[clang18-cxx20-debug] ``` When a default provider is built (no subtargets), the output is unchanged, because `ProviderName`'s `Display` implementation returns an empty string for default providers. --- app/buck2_test/src/translations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/buck2_test/src/translations.rs b/app/buck2_test/src/translations.rs index 5c2e9331030f..49d00fe379a8 100644 --- a/app/buck2_test/src/translations.rs +++ b/app/buck2_test/src/translations.rs @@ -31,7 +31,7 @@ pub(crate) fn build_configured_target_handle( let label = target.target().unconfigured(); let cell = label.pkg().cell_name().to_string(); let package = label.pkg().cell_relative_path().to_string(); - let target_name = label.name().to_string(); + let target_name = label.name().to_string() + &target.name().to_string(); let configuration = target.cfg().to_string(); let package_project_relative_path = cell_resolver .resolve_path(label.pkg().as_cell_path())