diff options
author | 2023-11-17 15:27:06 +0000 | |
---|---|---|
committer | 2023-11-20 21:52:56 +0000 | |
commit | 87b2ab28a80c11b264794344c4299e734b87e24d (patch) | |
tree | 9cc8db0392d01889e307cd07e0ff78baa1823efc | |
parent | b91108c9c07c45ff708030114372db6d217b4e2d (diff) |
Add test spec provider to test modules.
Provider added for the following test modules in this change: art_cc_test, cc_benchmark, cc_fuzz, cc_test, cc_test_host, rust_test,and rust_test_host.
Bug: 296873595
Test: Manual test
Change-Id: I815680529bcbecacb3a2bdb8f3746053afdee48c
-rw-r--r-- | cc/Android.bp | 1 | ||||
-rw-r--r-- | cc/cc.go | 11 | ||||
-rw-r--r-- | cc/fuzz.go | 1 | ||||
-rw-r--r-- | cc/test.go | 3 | ||||
-rw-r--r-- | rust/Android.bp | 1 | ||||
-rw-r--r-- | rust/rust.go | 9 | ||||
-rw-r--r-- | rust/test.go | 2 |
7 files changed, 23 insertions, 5 deletions
diff --git a/cc/Android.bp b/cc/Android.bp index 8fa0fbeb0..77e96db35 100644 --- a/cc/Android.bp +++ b/cc/Android.bp @@ -19,6 +19,7 @@ bootstrap_go_package { "soong-multitree", "soong-snapshot", "soong-sysprop-bp2build", + "soong-testing", "soong-tradefed", ], srcs: [ @@ -24,6 +24,7 @@ import ( "strconv" "strings" + "android/soong/testing" "android/soong/ui/metrics/bp2build_metrics_proto" "github.com/google/blueprint" @@ -862,9 +863,10 @@ type Module struct { Properties BaseProperties // initialize before calling Init - hod android.HostOrDeviceSupported - multilib android.Multilib - bazelable bool + hod android.HostOrDeviceSupported + multilib android.Multilib + bazelable bool + testModule bool // Allowable SdkMemberTypes of this module type. sdkMemberTypes []android.SdkMemberType @@ -2329,6 +2331,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { } } } + if c.testModule { + ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{}) + } c.maybeInstall(ctx, apexInfo) } diff --git a/cc/fuzz.go b/cc/fuzz.go index df9f21ad2..8fc48983e 100644 --- a/cc/fuzz.go +++ b/cc/fuzz.go @@ -96,6 +96,7 @@ func fuzzMutatorDeps(mctx android.TopDownMutatorContext) { // your device, or $ANDROID_PRODUCT_OUT/data/fuzz in your build tree. func LibFuzzFactory() android.Module { module := NewFuzzer(android.HostAndDeviceSupported) + module.testModule = true return module.Init() } diff --git a/cc/test.go b/cc/test.go index 5b778dc87..28994e0ee 100644 --- a/cc/test.go +++ b/cc/test.go @@ -141,6 +141,7 @@ func init() { func TestFactory() android.Module { module := NewTest(android.HostAndDeviceSupported, true) module.bazelHandler = &ccTestBazelHandler{module: module} + module.testModule = true return module.Init() } @@ -158,12 +159,14 @@ func TestLibraryFactory() android.Module { // binary. func BenchmarkFactory() android.Module { module := NewBenchmark(android.HostAndDeviceSupported) + module.testModule = true return module.Init() } // cc_test_host compiles a test host binary. func TestHostFactory() android.Module { module := NewTest(android.HostSupported, true) + module.testModule = true return module.Init() } diff --git a/rust/Android.bp b/rust/Android.bp index b01a94ad0..c5b200019 100644 --- a/rust/Android.bp +++ b/rust/Android.bp @@ -12,6 +12,7 @@ bootstrap_go_package { "soong-cc", "soong-rust-config", "soong-snapshot", + "soong-testing", ], srcs: [ "afdo.go", diff --git a/rust/rust.go b/rust/rust.go index 19c5230b4..15144acad 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -20,6 +20,7 @@ import ( "android/soong/bazel" "android/soong/bloaty" + "android/soong/testing" "android/soong/ui/metrics/bp2build_metrics_proto" "github.com/google/blueprint" @@ -144,8 +145,9 @@ type Module struct { Properties BaseProperties - hod android.HostOrDeviceSupported - multilib android.Multilib + hod android.HostOrDeviceSupported + multilib android.Multilib + testModule bool makeLinkType string @@ -1038,6 +1040,9 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { ctx.Phony("rust", ctx.RustModule().OutputFile().Path()) } + if mod.testModule { + ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{}) + } } func (mod *Module) deps(ctx DepsContext) Deps { diff --git a/rust/test.go b/rust/test.go index 4b5296e54..7ffc36767 100644 --- a/rust/test.go +++ b/rust/test.go @@ -222,11 +222,13 @@ func RustTestFactory() android.Module { // rustTestHostMultilib load hook to set MultilibFirst for the // host target. android.AddLoadHook(module, rustTestHostMultilib) + module.testModule = true return module.Init() } func RustTestHostFactory() android.Module { module, _ := NewRustTest(android.HostSupported) + module.testModule = true return module.Init() } |