diff options
author | 2021-11-16 13:46:49 +0000 | |
---|---|---|
committer | 2021-11-16 13:46:49 +0000 | |
commit | b993a835c3cb5925d0c58b6c069f0742794d63a1 (patch) | |
tree | a23409b8c7ab35135c566128e3b62c180ddd9d03 /rust/test.go | |
parent | a10ebe60ab750bbb5dccdf2aee2a06740ce7911e (diff) | |
parent | 4e5f07d27ba2e8ae460457a5a977478b9b2c96eb (diff) |
Merge "rust: Add data_libs and data_bins to rust_test"
Diffstat (limited to 'rust/test.go')
-rw-r--r-- | rust/test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/rust/test.go b/rust/test.go index bb877a9a5..3eea0ada4 100644 --- a/rust/test.go +++ b/rust/test.go @@ -18,6 +18,7 @@ import ( "github.com/google/blueprint/proptools" "android/soong/android" + "android/soong/cc" "android/soong/tradefed" ) @@ -49,6 +50,12 @@ type TestProperties struct { // the test Data []string `android:"path,arch_variant"` + // 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"` + // Flag to indicate whether or not to create test config automatically. If AndroidTest.xml // doesn't exist next to the Android.bp, this attribute doesn't need to be set to true // explicitly. @@ -137,6 +144,32 @@ func (test *testDecorator) install(ctx ModuleContext) { dataSrcPaths := android.PathsForModuleSrc(ctx, test.Properties.Data) + ctx.VisitDirectDepsWithTag(dataLibDepTag, func(dep android.Module) { + depName := ctx.OtherModuleName(dep) + linkableDep, ok := dep.(cc.LinkableInterface) + if !ok { + ctx.ModuleErrorf("data_lib %q is not a linkable module", depName) + } + if linkableDep.OutputFile().Valid() { + test.data = append(test.data, + android.DataPath{SrcPath: linkableDep.OutputFile().Path(), + RelativeInstallPath: linkableDep.RelativeInstallPath()}) + } + }) + + ctx.VisitDirectDepsWithTag(dataBinDepTag, func(dep android.Module) { + depName := ctx.OtherModuleName(dep) + linkableDep, ok := dep.(cc.LinkableInterface) + if !ok { + ctx.ModuleErrorf("data_bin %q is not a linkable module", depName) + } + if linkableDep.OutputFile().Valid() { + test.data = append(test.data, + android.DataPath{SrcPath: linkableDep.OutputFile().Path(), + RelativeInstallPath: linkableDep.RelativeInstallPath()}) + } + }) + for _, dataSrcPath := range dataSrcPaths { test.data = append(test.data, android.DataPath{SrcPath: dataSrcPath}) } @@ -194,6 +227,9 @@ func (test *testDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { deps.Rustlibs = append(deps.Rustlibs, "libtest") + deps.DataLibs = append(deps.DataLibs, test.Properties.Data_libs...) + deps.DataBins = append(deps.DataBins, test.Properties.Data_bins...) + return deps } |