Move test data installation to Soong

To generate module-info.json in Soong for b/309006256 Soong needs to
know the test data paths. Moving test data installation into Soong will
also help later for test suite packaging.

Add ModuleContext.InstallTestData that installs the files listed in a
[]DataPath alongside the test.  The files will also be passed to Make
to allow it to continue packaging them into the test suites for now.

Update the module types that are producing LOCAL_TEST_DATA entries
in their Android.mk files to go through InstallTestData instead.

Bug: 311428265
Test: atest --host toybox-gtests --test-timeout=120000
Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead
This commit is contained in:
Colin Cross
2023-11-15 12:39:40 -08:00
parent 312634eb0f
commit 5c1d5fb21b
17 changed files with 165 additions and 161 deletions

View File

@@ -424,6 +424,8 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
if ctx.Host() && test.gtest() && test.Properties.Test_options.Unit_test == nil {
test.Properties.Test_options.Unit_test = proptools.BoolPtr(true)
}
test.binaryDecorator.baseInstaller.installTestData(ctx, test.data)
test.binaryDecorator.baseInstaller.install(ctx, file)
}
@@ -584,7 +586,7 @@ type BenchmarkProperties struct {
type benchmarkDecorator struct {
*binaryDecorator
Properties BenchmarkProperties
data android.Paths
data []android.DataPath
testConfig android.Path
}
@@ -605,7 +607,9 @@ func (benchmark *benchmarkDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps
}
func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Path) {
benchmark.data = android.PathsForModuleSrc(ctx, benchmark.Properties.Data)
for _, d := range android.PathsForModuleSrc(ctx, benchmark.Properties.Data) {
benchmark.data = append(benchmark.data, android.DataPath{SrcPath: d})
}
var configs []tradefed.Config
if Bool(benchmark.Properties.Require_root) {
@@ -623,6 +627,7 @@ func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Pat
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
benchmark.binaryDecorator.baseInstaller.installTestData(ctx, benchmark.data)
benchmark.binaryDecorator.baseInstaller.install(ctx, file)
}