Add data_bins property

data_bins is similar to data_libs but copies helper binaries alongside
the test.

Bug: 200872604
Test: atest CtsBionicTestCases
Change-Id: I4f9df5f82816cfd30a0a19808fda220cf77c50a7
This commit is contained in:
Colin Cross
2021-09-24 16:50:14 -07:00
parent cfb0f5e102
commit c8caa06a36
2 changed files with 20 additions and 0 deletions

View File

@@ -95,6 +95,7 @@ type Deps struct {
// Used for data dependencies adjacent to tests
DataLibs []string
DataBins []string
// Used by DepsMutator to pass system_shared_libs information to check_elf_file.py.
SystemSharedLibs []string
@@ -718,6 +719,7 @@ var (
staticVariantTag = dependencyTag{name: "static variant"}
vndkExtDepTag = dependencyTag{name: "vndk extends"}
dataLibDepTag = dependencyTag{name: "data lib"}
dataBinDepTag = dependencyTag{name: "data bin"}
runtimeDepTag = installDependencyTag{name: "runtime lib"}
testPerSrcDepTag = dependencyTag{name: "test_per_src"}
stubImplDepTag = dependencyTag{name: "stub_impl"}
@@ -2274,6 +2276,8 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
{Mutator: "link", Variation: "shared"},
}, dataLibDepTag, deps.DataLibs...)
actx.AddVariationDependencies(nil, dataBinDepTag, deps.DataBins...)
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "shared"},
}, runtimeDepTag, deps.RuntimeLibs...)

View File

@@ -80,6 +80,9 @@ type TestBinaryProperties struct {
// list of shared library modules that should be installed alongside the test
Data_libs []string `android:"arch_variant"`
// list of binary modules that should be installed alongside the test
Data_bins []string `android:"arch_variant"`
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
Test_suites []string `android:"arch_variant"`
@@ -350,6 +353,7 @@ func (test *testBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps = test.testDecorator.linkerDeps(ctx, deps)
deps = test.binaryDecorator.linkerDeps(ctx, deps)
deps.DataLibs = append(deps.DataLibs, test.Properties.Data_libs...)
deps.DataBins = append(deps.DataBins, test.Properties.Data_bins...)
return deps
}
@@ -389,6 +393,18 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
RelativeInstallPath: ccModule.installer.relativeInstallPath()})
}
})
ctx.VisitDirectDepsWithTag(dataBinDepTag, func(dep android.Module) {
depName := ctx.OtherModuleName(dep)
ccModule, ok := dep.(*Module)
if !ok {
ctx.ModuleErrorf("data_bin %q is not a cc module", depName)
}
if ccModule.OutputFile().Valid() {
test.data = append(test.data,
android.DataPath{SrcPath: ccModule.OutputFile().Path(),
RelativeInstallPath: ccModule.installer.relativeInstallPath()})
}
})
var configs []tradefed.Config
for _, module := range test.Properties.Test_mainline_modules {