Merge "Add test spec provider to test modules." into main am: bc34d495c9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2836758 Change-Id: I98d9c51c8ffab2ec0e9a6451e0637eea07e23727 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
0c6c5f5431
7 changed files with 23 additions and 5 deletions
|
@ -19,6 +19,7 @@ bootstrap_go_package {
|
|||
"soong-multitree",
|
||||
"soong-snapshot",
|
||||
"soong-sysprop-bp2build",
|
||||
"soong-testing",
|
||||
"soong-tradefed",
|
||||
],
|
||||
srcs: [
|
||||
|
|
11
cc/cc.go
11
cc/cc.go
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ bootstrap_go_package {
|
|||
"soong-cc",
|
||||
"soong-rust-config",
|
||||
"soong-snapshot",
|
||||
"soong-testing",
|
||||
],
|
||||
srcs: [
|
||||
"afdo.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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue