Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8caa06a authored by Colin Cross's avatar Colin Cross
Browse files

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
parent cfb0f5e1
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -95,6 +95,7 @@ type Deps struct {


	// Used for data dependencies adjacent to tests
	// Used for data dependencies adjacent to tests
	DataLibs []string
	DataLibs []string
	DataBins []string


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


	actx.AddVariationDependencies(nil, dataBinDepTag, deps.DataBins...)

	actx.AddVariationDependencies([]blueprint.Variation{
	actx.AddVariationDependencies([]blueprint.Variation{
		{Mutator: "link", Variation: "shared"},
		{Mutator: "link", Variation: "shared"},
	}, runtimeDepTag, deps.RuntimeLibs...)
	}, runtimeDepTag, deps.RuntimeLibs...)
+16 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,9 @@ type TestBinaryProperties struct {
	// list of shared library modules that should be installed alongside the test
	// list of shared library modules that should be installed alongside the test
	Data_libs []string `android:"arch_variant"`
	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
	// list of compatibility suites (for example "cts", "vts") that the module should be
	// installed into.
	// installed into.
	Test_suites []string `android:"arch_variant"`
	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.testDecorator.linkerDeps(ctx, deps)
	deps = test.binaryDecorator.linkerDeps(ctx, deps)
	deps = test.binaryDecorator.linkerDeps(ctx, deps)
	deps.DataLibs = append(deps.DataLibs, test.Properties.Data_libs...)
	deps.DataLibs = append(deps.DataLibs, test.Properties.Data_libs...)
	deps.DataBins = append(deps.DataBins, test.Properties.Data_bins...)
	return deps
	return deps
}
}


@@ -389,6 +393,18 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
					RelativeInstallPath: ccModule.installer.relativeInstallPath()})
					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
	var configs []tradefed.Config
	for _, module := range test.Properties.Test_mainline_modules {
	for _, module := range test.Properties.Test_mainline_modules {