From becb5beb1eb8bb9bf8a7320eb449b20dae8a5821 Mon Sep 17 00:00:00 2001 From: Mark Vitale Date: Thu, 23 Jan 2025 19:36:05 -0800 Subject: [PATCH] Gate test subtarget name behind cfg!(fbcode_build) 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 --- app/buck2_test/src/translations.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/buck2_test/src/translations.rs b/app/buck2_test/src/translations.rs index 0de2ccd79c18..7e4e81ee3a5e 100644 --- a/app/buck2_test/src/translations.rs +++ b/app/buck2_test/src/translations.rs @@ -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())