Skip to content

Commit

Permalink
Add subtarget information to a test target name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbarrete committed Jan 12, 2025
1 parent 2b3b02d commit c44303b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/buck2_test/src/translations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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())
Expand Down

0 comments on commit c44303b

Please sign in to comment.