Allow adding extra tradefed options in the Android.bp file
Some tests need to add custom tradefed options, but still want to keep most of the soong autogenerated tradefed xml file. Expose a test_options: { tradefed_options: [...] } property that will allow tests to add more options to the autogenerated xml file. Fixes: 184895128 Test: go test, and verified that the ninja files did not change for aosp_arm64 Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
This commit is contained in:
28
java/java.go
28
java/java.go
@@ -915,6 +915,10 @@ type TestOptions struct {
|
||||
|
||||
// a list of extra test configuration files that should be installed with the module.
|
||||
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 {
|
||||
@@ -1192,9 +1196,18 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
|
||||
defaultUnitTest := !inList("tradefed", j.properties.Libs) && !inList("cts", j.testProperties.Test_suites)
|
||||
j.testProperties.Test_options.Unit_test = proptools.BoolPtr(defaultUnitTest)
|
||||
}
|
||||
|
||||
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
|
||||
j.testProperties.Test_suites, configs, j.testProperties.Auto_gen_config, j.testProperties.Test_options.Unit_test)
|
||||
j.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{
|
||||
TestConfigProp: j.testProperties.Test_config,
|
||||
TestConfigTemplateProp: j.testProperties.Test_config_template,
|
||||
TestSuites: j.testProperties.Test_suites,
|
||||
Config: configs,
|
||||
OptionsForAutogenerated: j.testProperties.Test_options.Tradefed_options,
|
||||
AutoGenConfig: j.testProperties.Auto_gen_config,
|
||||
UnitTest: j.testProperties.Test_options.Unit_test,
|
||||
DeviceTemplate: "${JavaTestConfigTemplate}",
|
||||
HostTemplate: "${JavaHostTestConfigTemplate}",
|
||||
HostUnitTestTemplate: "${JavaHostUnitTestConfigTemplate}",
|
||||
})
|
||||
|
||||
j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
|
||||
|
||||
@@ -1239,8 +1252,13 @@ func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContex
|
||||
}
|
||||
|
||||
func (j *JavaTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.prebuiltTestProperties.Test_config, nil,
|
||||
j.prebuiltTestProperties.Test_suites, nil, nil, nil)
|
||||
j.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{
|
||||
TestConfigProp: j.prebuiltTestProperties.Test_config,
|
||||
TestSuites: j.prebuiltTestProperties.Test_suites,
|
||||
DeviceTemplate: "${JavaTestConfigTemplate}",
|
||||
HostTemplate: "${JavaHostTestConfigTemplate}",
|
||||
HostUnitTestTemplate: "${JavaHostUnitTestConfigTemplate}",
|
||||
})
|
||||
|
||||
j.Import.GenerateAndroidBuildActions(ctx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user