Revert "Allow adding extra tradefed options in the Android.bp file"
This reverts commit 8ec823cba1
.
Reason for revert: DroidMonitor: Potential culprit for Bug b/262965953 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
This commit is contained in:
committed by
Gerrit Code Review
parent
8ec823cba1
commit
77dc7d0839
@@ -27,6 +27,7 @@ import (
|
|||||||
"text/scanner"
|
"text/scanner"
|
||||||
|
|
||||||
"android/soong/bazel"
|
"android/soong/bazel"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
)
|
)
|
||||||
|
23
cc/test.go
23
cc/test.go
@@ -459,16 +459,8 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.MinApiLevelModuleController", options})
|
configs = append(configs, tradefed.Object{"module_controller", "com.android.tradefed.testtype.suite.module.MinApiLevelModuleController", options})
|
||||||
}
|
}
|
||||||
|
|
||||||
test.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
|
||||||
SetTestConfigProp(test.Properties.Test_config).
|
test.Properties.Test_config_template, test.testDecorator.InstallerProperties.Test_suites, configs, test.Properties.Auto_gen_config, testInstallBase)
|
||||||
SetTestTemplateConfigProp(test.Properties.Test_config_template).
|
|
||||||
SetTestSuites(test.testDecorator.InstallerProperties.Test_suites).
|
|
||||||
SetConfig(configs).
|
|
||||||
SetAutoGenConfig(test.Properties.Auto_gen_config).
|
|
||||||
SetTestInstallBase(testInstallBase).
|
|
||||||
SetDeviceTemplate("${NativeTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${NativeHostTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
test.extraTestConfigs = android.PathsForModuleSrc(ctx, test.Properties.Test_options.Extra_test_configs)
|
test.extraTestConfigs = android.PathsForModuleSrc(ctx, test.Properties.Test_options.Extra_test_configs)
|
||||||
|
|
||||||
@@ -624,15 +616,8 @@ func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Pat
|
|||||||
if Bool(benchmark.Properties.Require_root) {
|
if Bool(benchmark.Properties.Require_root) {
|
||||||
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil})
|
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil})
|
||||||
}
|
}
|
||||||
benchmark.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config,
|
||||||
SetTestConfigProp(benchmark.Properties.Test_config).
|
benchmark.Properties.Test_config_template, benchmark.Properties.Test_suites, configs, benchmark.Properties.Auto_gen_config)
|
||||||
SetTestTemplateConfigProp(benchmark.Properties.Test_config_template).
|
|
||||||
SetTestSuites(benchmark.Properties.Test_suites).
|
|
||||||
SetConfig(configs).
|
|
||||||
SetAutoGenConfig(benchmark.Properties.Auto_gen_config).
|
|
||||||
SetDeviceTemplate("${NativeBenchmarkTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${NativeBenchmarkTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
|
benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName())
|
||||||
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
|
benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName())
|
||||||
|
27
java/java.go
27
java/java.go
@@ -888,10 +888,6 @@ type TestOptions struct {
|
|||||||
|
|
||||||
// a list of extra test configuration files that should be installed with the module.
|
// a list of extra test configuration files that should be installed with the module.
|
||||||
Extra_test_configs []string `android:"path,arch_variant"`
|
Extra_test_configs []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
// Extra <option> tags to add to the auto generated test xml file. The "key"
|
|
||||||
// is optional in each of these.
|
|
||||||
Tradefed_options []tradefed.Option
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type testProperties struct {
|
type testProperties struct {
|
||||||
@@ -1170,18 +1166,8 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
|
|||||||
j.testProperties.Test_options.Unit_test = proptools.BoolPtr(defaultUnitTest)
|
j.testProperties.Test_options.Unit_test = proptools.BoolPtr(defaultUnitTest)
|
||||||
}
|
}
|
||||||
|
|
||||||
j.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
|
||||||
SetTestConfigProp(j.testProperties.Test_config).
|
j.testProperties.Test_suites, configs, j.testProperties.Auto_gen_config, j.testProperties.Test_options.Unit_test)
|
||||||
SetTestTemplateConfigProp(j.testProperties.Test_config_template).
|
|
||||||
SetTestSuites(j.testProperties.Test_suites).
|
|
||||||
SetConfig(configs).
|
|
||||||
SetOptionsForAutogenerated(j.testProperties.Test_options.Tradefed_options).
|
|
||||||
SetAutoGenConfig(j.testProperties.Auto_gen_config).
|
|
||||||
SetUnitTest(j.testProperties.Test_options.Unit_test).
|
|
||||||
SetDeviceTemplate("${JavaTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${JavaHostTestConfigTemplate}").
|
|
||||||
SetHostUnitTestTemplate("${JavaHostUnitTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
|
j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
|
||||||
|
|
||||||
@@ -1226,13 +1212,8 @@ func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContex
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.prebuiltTestProperties.Test_config, nil,
|
||||||
SetTestConfigProp(j.prebuiltTestProperties.Test_config).
|
j.prebuiltTestProperties.Test_suites, nil, nil, nil)
|
||||||
SetTestSuites(j.prebuiltTestProperties.Test_suites).
|
|
||||||
SetDeviceTemplate("${JavaTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${JavaHostTestConfigTemplate}").
|
|
||||||
SetHostUnitTestTemplate("${JavaHostUnitTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
j.Import.GenerateAndroidBuildActions(ctx)
|
j.Import.GenerateAndroidBuildActions(ctx)
|
||||||
}
|
}
|
||||||
|
@@ -1945,25 +1945,3 @@ func TestJavaApiLibraryJarGeneration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTradefedOptions(t *testing.T) {
|
|
||||||
result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
|
|
||||||
java_test_host {
|
|
||||||
name: "foo",
|
|
||||||
test_options: {
|
|
||||||
tradefed_options: [
|
|
||||||
{
|
|
||||||
name: "exclude-path",
|
|
||||||
value: "org/apache"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
args := result.ModuleForTests("foo", "linux_glibc_common").
|
|
||||||
Output("out/soong/.intermediates/foo/linux_glibc_common/foo.config").Args
|
|
||||||
expected := proptools.NinjaAndShellEscape("<option name=\"exclude-path\" value=\"org/apache\" />")
|
|
||||||
if args["extraConfigs"] != expected {
|
|
||||||
t.Errorf("Expected args[\"extraConfigs\"] to equal %q, was %q", expected, args["extraConfigs"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -131,14 +131,9 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
r.forceOSType = ctx.Config().BuildOS
|
r.forceOSType = ctx.Config().BuildOS
|
||||||
r.forceArchType = ctx.Config().BuildArch
|
r.forceArchType = ctx.Config().BuildArch
|
||||||
|
|
||||||
r.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
r.testConfig = tradefed.AutoGenRobolectricTestConfig(ctx, r.testProperties.Test_config,
|
||||||
SetTestConfigProp(r.testProperties.Test_config).
|
r.testProperties.Test_config_template, r.testProperties.Test_suites,
|
||||||
SetTestTemplateConfigProp(r.testProperties.Test_config_template).
|
r.testProperties.Auto_gen_config)
|
||||||
SetTestSuites(r.testProperties.Test_suites).
|
|
||||||
SetAutoGenConfig(r.testProperties.Auto_gen_config).
|
|
||||||
SetDeviceTemplate("${RobolectricTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${RobolectricTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
r.data = android.PathsForModuleSrc(ctx, r.testProperties.Data)
|
r.data = android.PathsForModuleSrc(ctx, r.testProperties.Data)
|
||||||
|
|
||||||
roboTestConfig := android.PathForModuleGen(ctx, "robolectric").
|
roboTestConfig := android.PathForModuleGen(ctx, "robolectric").
|
||||||
|
@@ -67,14 +67,9 @@ func (test *testDecorator) bootstrapperProps() []interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
|
func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) {
|
||||||
test.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
test.testConfig = tradefed.AutoGenPythonBinaryHostTestConfig(ctx, test.testProperties.Test_config,
|
||||||
SetTestConfigProp(test.testProperties.Test_config).
|
test.testProperties.Test_config_template, test.binaryDecorator.binaryProperties.Test_suites,
|
||||||
SetTestTemplateConfigProp(test.testProperties.Test_config_template).
|
test.binaryDecorator.binaryProperties.Auto_gen_config)
|
||||||
SetTestSuites(test.binaryDecorator.binaryProperties.Test_suites).
|
|
||||||
SetAutoGenConfig(test.binaryDecorator.binaryProperties.Auto_gen_config).
|
|
||||||
SetDeviceTemplate("${PythonBinaryHostTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${PythonBinaryHostTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
test.binaryDecorator.pythonInstaller.dir = "nativetest"
|
test.binaryDecorator.pythonInstaller.dir = "nativetest"
|
||||||
test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
|
test.binaryDecorator.pythonInstaller.dir64 = "nativetest64"
|
||||||
|
@@ -112,14 +112,12 @@ func (benchmark *benchmarkDecorator) compilerProps() []interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (benchmark *benchmarkDecorator) install(ctx ModuleContext) {
|
func (benchmark *benchmarkDecorator) install(ctx ModuleContext) {
|
||||||
benchmark.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
benchmark.testConfig = tradefed.AutoGenRustBenchmarkConfig(ctx,
|
||||||
SetTestConfigProp(benchmark.Properties.Test_config).
|
benchmark.Properties.Test_config,
|
||||||
SetTestTemplateConfigProp(benchmark.Properties.Test_config_template).
|
benchmark.Properties.Test_config_template,
|
||||||
SetTestSuites(benchmark.Properties.Test_suites).
|
benchmark.Properties.Test_suites,
|
||||||
SetAutoGenConfig(benchmark.Properties.Auto_gen_config).
|
nil,
|
||||||
SetDeviceTemplate("${RustDeviceBenchmarkConfigTemplate}").
|
benchmark.Properties.Auto_gen_config)
|
||||||
SetHostTemplate("${RustHostBenchmarkConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
// default relative install path is module name
|
// default relative install path is module name
|
||||||
if !Bool(benchmark.Properties.No_named_install_directory) {
|
if !Bool(benchmark.Properties.No_named_install_directory) {
|
||||||
|
17
rust/test.go
17
rust/test.go
@@ -130,16 +130,13 @@ func (test *testDecorator) install(ctx ModuleContext) {
|
|||||||
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", options})
|
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", options})
|
||||||
}
|
}
|
||||||
|
|
||||||
test.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
test.testConfig = tradefed.AutoGenRustTestConfig(ctx,
|
||||||
SetTestConfigProp(test.Properties.Test_config).
|
test.Properties.Test_config,
|
||||||
SetTestTemplateConfigProp(test.Properties.Test_config_template).
|
test.Properties.Test_config_template,
|
||||||
SetTestSuites(test.Properties.Test_suites).
|
test.Properties.Test_suites,
|
||||||
SetConfig(configs).
|
configs,
|
||||||
SetAutoGenConfig(test.Properties.Auto_gen_config).
|
test.Properties.Auto_gen_config,
|
||||||
SetTestInstallBase(testInstallBase).
|
testInstallBase)
|
||||||
SetDeviceTemplate("${RustDeviceTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${RustHostTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
dataSrcPaths := android.PathsForModuleSrc(ctx, test.Properties.Data)
|
dataSrcPaths := android.PathsForModuleSrc(ctx, test.Properties.Data)
|
||||||
|
|
||||||
|
@@ -379,16 +379,8 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.PushFilePreparer", options})
|
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.PushFilePreparer", options})
|
||||||
}
|
}
|
||||||
s.testConfig = tradefed.NewMaybeAutoGenTestConfigBuilder(ctx).
|
s.testConfig = tradefed.AutoGenShellTestConfig(ctx, s.testProperties.Test_config,
|
||||||
SetTestConfigProp(s.testProperties.Test_config).
|
s.testProperties.Test_config_template, s.testProperties.Test_suites, configs, s.testProperties.Auto_gen_config, s.outputFilePath.Base())
|
||||||
SetTestTemplateConfigProp(s.testProperties.Test_config_template).
|
|
||||||
SetTestSuites(s.testProperties.Test_suites).
|
|
||||||
SetConfig(configs).
|
|
||||||
SetAutoGenConfig(s.testProperties.Auto_gen_config).
|
|
||||||
SetOutputFileName(s.outputFilePath.Base()).
|
|
||||||
SetDeviceTemplate("${ShellTestConfigTemplate}").
|
|
||||||
SetHostTemplate("${ShellTestConfigTemplate}").
|
|
||||||
Build()
|
|
||||||
|
|
||||||
s.dataModules = make(map[string]android.Path)
|
s.dataModules = make(map[string]android.Path)
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
|
@@ -107,134 +107,15 @@ func (ob Object) Config() string {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaybeAutoGenTestConfigBuilder provides a Build() method that will either
|
func autogenTemplate(ctx android.ModuleContext, output android.WritablePath, template string, configs []Config, testInstallBase string) {
|
||||||
// generate a AndroidTest.xml file, or use an existing user-supplied one.
|
autogenTemplateWithNameAndOutputFile(ctx, ctx.ModuleName(), output, template, configs, "", testInstallBase)
|
||||||
// It used to be a bunch of separate functions for each language, but was
|
|
||||||
// converted to this builder pattern to have one function that accepts many
|
|
||||||
// optional arguments.
|
|
||||||
type MaybeAutoGenTestConfigBuilder struct {
|
|
||||||
ctx android.ModuleContext
|
|
||||||
name string
|
|
||||||
outputFileName string
|
|
||||||
testConfigProp *string
|
|
||||||
testConfigTemplateProp *string
|
|
||||||
testSuites []string
|
|
||||||
config []Config
|
|
||||||
configsForAutogenerated []Config
|
|
||||||
autoGenConfig *bool
|
|
||||||
unitTest *bool
|
|
||||||
testInstallBase string
|
|
||||||
deviceTemplate string
|
|
||||||
hostTemplate string
|
|
||||||
hostUnitTestTemplate string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMaybeAutoGenTestConfigBuilder(ctx android.ModuleContext) *MaybeAutoGenTestConfigBuilder {
|
func autogenTemplateWithName(ctx android.ModuleContext, name string, output android.WritablePath, template string, configs []Config, testInstallBase string) {
|
||||||
return &MaybeAutoGenTestConfigBuilder{
|
autogenTemplateWithNameAndOutputFile(ctx, name, output, template, configs, "", testInstallBase)
|
||||||
ctx: ctx,
|
|
||||||
name: ctx.ModuleName(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetName(name string) *MaybeAutoGenTestConfigBuilder {
|
func autogenTemplateWithNameAndOutputFile(ctx android.ModuleContext, name string, output android.WritablePath, template string, configs []Config, outputFileName string, testInstallBase string) {
|
||||||
b.name = name
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetOutputFileName(outputFileName string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.outputFileName = outputFileName
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetTestConfigProp(testConfigProp *string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.testConfigProp = testConfigProp
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetTestTemplateConfigProp(testConfigTemplateProp *string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.testConfigTemplateProp = testConfigTemplateProp
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetTestSuites(testSuites []string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.testSuites = testSuites
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetConfig(config []Config) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.config = config
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetOptionsForAutogenerated(configsForAutogenerated []Option) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
configs := make([]Config, 0, len(configsForAutogenerated))
|
|
||||||
for _, c := range configsForAutogenerated {
|
|
||||||
configs = append(configs, c)
|
|
||||||
}
|
|
||||||
b.configsForAutogenerated = configs
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetUnitTest(unitTest *bool) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.unitTest = unitTest
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetAutoGenConfig(autoGenConfig *bool) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.autoGenConfig = autoGenConfig
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetTestInstallBase(testInstallBase string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.testInstallBase = testInstallBase
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetDeviceTemplate(deviceTemplate string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.deviceTemplate = deviceTemplate
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetHostTemplate(hostTemplate string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.hostTemplate = hostTemplate
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) SetHostUnitTestTemplate(hostUnitTestTemplate string) *MaybeAutoGenTestConfigBuilder {
|
|
||||||
b.hostUnitTestTemplate = hostUnitTestTemplate
|
|
||||||
return b
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *MaybeAutoGenTestConfigBuilder) Build() android.Path {
|
|
||||||
config := append(b.config, b.configsForAutogenerated...)
|
|
||||||
path, autogenPath := testConfigPath(b.ctx, b.testConfigProp, b.testSuites, b.autoGenConfig, b.testConfigTemplateProp)
|
|
||||||
if autogenPath != nil {
|
|
||||||
templatePath := getTestConfigTemplate(b.ctx, b.testConfigTemplateProp)
|
|
||||||
if templatePath.Valid() {
|
|
||||||
autogenTemplate(b.ctx, b.name, autogenPath, templatePath.String(), config, b.outputFileName, b.testInstallBase)
|
|
||||||
} else {
|
|
||||||
if b.ctx.Device() {
|
|
||||||
autogenTemplate(b.ctx, b.name, autogenPath, b.deviceTemplate, config, b.outputFileName, b.testInstallBase)
|
|
||||||
} else {
|
|
||||||
if Bool(b.unitTest) {
|
|
||||||
autogenTemplate(b.ctx, b.name, autogenPath, b.hostUnitTestTemplate, config, b.outputFileName, b.testInstallBase)
|
|
||||||
} else {
|
|
||||||
autogenTemplate(b.ctx, b.name, autogenPath, b.hostTemplate, config, b.outputFileName, b.testInstallBase)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return autogenPath
|
|
||||||
}
|
|
||||||
if len(b.configsForAutogenerated) > 0 {
|
|
||||||
b.ctx.ModuleErrorf("Extra tradefed configurations were provided for an autogenerated xml file, but the autogenerated xml file was not used.")
|
|
||||||
}
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
|
|
||||||
func autogenTemplate(ctx android.ModuleContext, name string, output android.WritablePath, template string, configs []Config, outputFileName string, testInstallBase string) {
|
|
||||||
if template == "" {
|
|
||||||
ctx.ModuleErrorf("Empty template")
|
|
||||||
}
|
|
||||||
var configStrings []string
|
var configStrings []string
|
||||||
for _, config := range configs {
|
for _, config := range configs {
|
||||||
configStrings = append(configStrings, config.Config())
|
configStrings = append(configStrings, config.Config())
|
||||||
@@ -256,6 +137,148 @@ func autogenTemplate(ctx android.ModuleContext, name string, output android.Writ
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AutoGenNativeTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool, testInstallBase string) android.Path {
|
||||||
|
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), config, testInstallBase)
|
||||||
|
} else {
|
||||||
|
if ctx.Device() {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${NativeTestConfigTemplate}", config, testInstallBase)
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${NativeHostTestConfigTemplate}", config, testInstallBase)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenShellTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool, outputFileName string) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplateWithNameAndOutputFile(ctx, ctx.ModuleName(), autogenPath, templatePath.String(), config, outputFileName, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplateWithNameAndOutputFile(ctx, ctx.ModuleName(), autogenPath, "${ShellTestConfigTemplate}", config, outputFileName, "")
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenNativeBenchmarkTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, configs []Config, autoGenConfig *bool) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), configs, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${NativeBenchmarkTestConfigTemplate}", configs, "")
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenJavaTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string,
|
||||||
|
testSuites []string, config []Config, autoGenConfig *bool, unitTest *bool) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), config, "")
|
||||||
|
} else {
|
||||||
|
if ctx.Device() {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${JavaTestConfigTemplate}", config, "")
|
||||||
|
} else {
|
||||||
|
if Bool(unitTest) {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${JavaHostUnitTestConfigTemplate}", config, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${JavaHostTestConfigTemplate}", config, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenPythonBinaryHostTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, autoGenConfig *bool) android.Path {
|
||||||
|
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), nil, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${PythonBinaryHostTestConfigTemplate}", nil, "")
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenRustTestConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool, testInstallBase string) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), config, testInstallBase)
|
||||||
|
} else {
|
||||||
|
if ctx.Device() {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${RustDeviceTestConfigTemplate}", config, testInstallBase)
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${RustHostTestConfigTemplate}", config, testInstallBase)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenRustBenchmarkConfig(ctx android.ModuleContext, testConfigProp *string,
|
||||||
|
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), config, "")
|
||||||
|
} else {
|
||||||
|
if ctx.Device() {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${RustDeviceBenchmarkConfigTemplate}", config, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${RustHostBenchmarkConfigTemplate}", config, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
func AutoGenRobolectricTestConfig(ctx android.ModuleContext, testConfigProp *string, testConfigTemplateProp *string,
|
||||||
|
testSuites []string, autoGenConfig *bool) android.Path {
|
||||||
|
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
|
||||||
|
if autogenPath != nil {
|
||||||
|
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
|
||||||
|
if templatePath.Valid() {
|
||||||
|
autogenTemplate(ctx, autogenPath, templatePath.String(), nil, "")
|
||||||
|
} else {
|
||||||
|
autogenTemplate(ctx, autogenPath, "${RobolectricTestConfigTemplate}", nil, "")
|
||||||
|
}
|
||||||
|
return autogenPath
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
|
var autogenInstrumentationTest = pctx.StaticRule("autogenInstrumentationTest", blueprint.RuleParams{
|
||||||
Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template ${extraConfigs}",
|
Command: "${AutoGenTestConfigScript} $out $in ${EmptyTestConfig} $template ${extraConfigs}",
|
||||||
CommandDeps: []string{
|
CommandDeps: []string{
|
||||||
|
Reference in New Issue
Block a user