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
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user