Skip to content

Commit

Permalink
Gate test subtarget name behind cfg!(fbcode_build)
Browse files Browse the repository at this point in the history
Summary:
Code lens unit test debugging on an iOS On Demand seems to be broken. Looking at the generated buck test commands, it looks like it has to do with a mismatch between the target built tested and the "exact target" being provided.

We generate something similar to this, injecting the `[dwarf-and-dsym]` subtarget to the target being built, but we don't inject the same in the pattern being matched:
```
buck2 test @//fbobjc/mode/buck2/ios-tests "fbsource//fbobjc/Apps/Internal/FocusPlayground/Models:TestFoo[dwarf-and-dsym]" -- --exact 'fbsource//fbobjc/Apps/Internal/FocusPlayground/Models:TestFoo - DummyTests/testFoo' --run-disabled
```

Previously, the test would match even if a subtarget was being built.

See https://fb.workplace.com/groups/410668900045165/permalink/1256220735489973/ for workflows that are being impacted.

This regressed in D66988950, written in opensource, so let's revert it internally to fix our workflows.

Reviewed By: JakobDegen

Differential Revision: D68593198

fbshipit-source-id: c9518260acc8fa4327cf2aaed232def4863577d3
  • Loading branch information
mavitalemeta authored and facebook-github-bot committed Jan 24, 2025
1 parent 7ad903c commit becb5be
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/buck2_test/src/translations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ 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() + &target.name().to_string();
let target_name = if cfg!(fbcode_build) {
label.name().to_string()
} else {
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 becb5be

Please sign in to comment.