summaryrefslogtreecommitdiff
path: root/sh/sh_binary.go
diff options
context:
space:
mode:
author Jason Wu <juu@google.com> 2023-10-11 01:11:15 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2023-10-11 01:11:15 +0000
commit5a2a94ebf07a85f9814c951fcbbae258af36a86c (patch)
treef5dc1b569435af3343237e61be4a67da63a7631a /sh/sh_binary.go
parent1b052b00783cf2f6270a5da1d4ffc6b734e0b764 (diff)
parent25c69eec4530a1f1423173a6724a84bd470dbf77 (diff)
Merge "Update sh_test conversion to handle data_bins and test_configs properly" into main
Diffstat (limited to 'sh/sh_binary.go')
-rw-r--r--sh/sh_binary.go46
1 files changed, 30 insertions, 16 deletions
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 79a885fa9..2e869f447 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -575,12 +575,12 @@ type bazelShBinaryAttributes struct {
}
type bazelShTestAttributes struct {
- Srcs bazel.LabelListAttribute
- Data bazel.LabelListAttribute
- Tags bazel.StringListAttribute
- Test_config *string
- Test_config_template *string
- Auto_gen_config *bool
+ Srcs bazel.LabelListAttribute
+ Data bazel.LabelListAttribute
+ Data_bins bazel.LabelListAttribute
+ Tags bazel.StringListAttribute
+ Runs_on bazel.StringListAttribute
+ tradefed.TestConfigAttributes
}
func (m *ShBinary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
@@ -615,28 +615,42 @@ func (m *ShTest) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
srcs := bazel.MakeLabelListAttribute(
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
- combinedData := append(m.testProperties.Data, m.testProperties.Data_bins...)
- combinedData = append(combinedData, m.testProperties.Data_libs...)
+ dataBins := bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, m.testProperties.Data_bins))
- data := bazel.MakeLabelListAttribute(
- android.BazelLabelForModuleSrc(ctx, combinedData))
+ var combinedData bazel.LabelList
+ combinedData.Append(android.BazelLabelForModuleSrc(ctx, m.testProperties.Data))
+ combinedData.Append(android.BazelLabelForModuleDeps(ctx, m.testProperties.Data_bins))
+ combinedData.Append(android.BazelLabelForModuleDeps(ctx, m.testProperties.Data_libs))
+ data := bazel.MakeLabelListAttribute(combinedData)
tags := bazel.MakeStringListAttribute(
m.testProperties.Test_options.Tags)
- test_config := m.testProperties.Test_config
+ testConfigAttributes := tradefed.GetTestConfigAttributes(
+ ctx,
+ m.testProperties.Test_config,
+ []string{},
+ m.testProperties.Auto_gen_config,
+ m.testProperties.Test_suites,
+ m.testProperties.Test_config_template,
+ nil,
+ nil,
+ )
- test_config_template := m.testProperties.Test_config_template
+ unitTest := m.testProperties.Test_options.Unit_test
- auto_gen_config := m.testProperties.Auto_gen_config
+ runs_on := bazel.MakeStringListAttribute(android.RunsOn(
+ m.ModuleBase.HostSupported(),
+ m.ModuleBase.DeviceSupported(),
+ (unitTest != nil && *unitTest)))
attrs := &bazelShTestAttributes{
Srcs: srcs,
Data: data,
+ Data_bins: dataBins,
Tags: tags,
- Test_config: test_config,
- Test_config_template: test_config_template,
- Auto_gen_config: auto_gen_config,
+ Runs_on: runs_on,
+ TestConfigAttributes: testConfigAttributes,
}
props := bazel.BazelTargetModuleProperties{