diff options
| -rw-r--r-- | cc/cc_test.go | 2 | ||||
| -rw-r--r-- | cc/test.go | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/cc/cc_test.go b/cc/cc_test.go index 7534db222..d95ed3f3e 100644 --- a/cc/cc_test.go +++ b/cc/cc_test.go @@ -3261,7 +3261,7 @@ func TestLibDepAndroidMkExportInMixedBuilds(t *testing.T) { }, }, LabelToCcBinary: map[string]cquery.CcUnstrippedInfo{ - "//:test": cquery.CcUnstrippedInfo{ + "//:test__tf_internal": cquery.CcUnstrippedInfo{ CcAndroidMkInfo: tc.androidMkInfo, }, "//:binary": cquery.CcUnstrippedInfo{ diff --git a/cc/test.go b/cc/test.go index 3f5f71007..af1b366dd 100644 --- a/cc/test.go +++ b/cc/test.go @@ -641,14 +641,27 @@ type ccTestBazelHandler struct { var _ BazelHandler = (*ccTestBazelHandler)(nil) +// The top level target named $label is a test_suite target, +// not the internal cc_test executable target. +// +// This is to ensure `b test //$label` runs the test_suite target directly, +// which depends on tradefed_test targets, instead of the internal cc_test +// target, which doesn't have tradefed integrations. +// +// However, for cquery, we want the internal cc_test executable target, which +// has the suffix "__tf_internal". +func mixedBuildsTestLabel(label string) string { + return label + "__tf_internal" +} + func (handler *ccTestBazelHandler) QueueBazelCall(ctx android.BaseModuleContext, label string) { bazelCtx := ctx.Config().BazelContext - bazelCtx.QueueBazelRequest(label, cquery.GetCcUnstrippedInfo, android.GetConfigKey(ctx)) + bazelCtx.QueueBazelRequest(mixedBuildsTestLabel(label), cquery.GetCcUnstrippedInfo, android.GetConfigKey(ctx)) } func (handler *ccTestBazelHandler) ProcessBazelQueryResponse(ctx android.ModuleContext, label string) { bazelCtx := ctx.Config().BazelContext - info, err := bazelCtx.GetCcUnstrippedInfo(label, android.GetConfigKey(ctx)) + info, err := bazelCtx.GetCcUnstrippedInfo(mixedBuildsTestLabel(label), android.GetConfigKey(ctx)) if err != nil { ctx.ModuleErrorf(err.Error()) return |