diff options
author | 2022-12-07 18:18:37 -0800 | |
---|---|---|
committer | 2022-12-09 15:23:26 -0800 | |
commit | 8ec823cba166a41eb0e9e5ff8fe679e691fec678 (patch) | |
tree | f293a018289e7466302470e68e706b5c1b904894 /java/java.go | |
parent | 3784d144047e567e0740a0eda5c6693bc126e2bf (diff) |
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: I75f7eb002c8325ce7cdc76e12e76e16195320620
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/java/java.go b/java/java.go index 9dd585062..dd2437621 100644 --- a/java/java.go +++ b/java/java.go @@ -888,6 +888,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 { @@ -1166,8 +1170,18 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, 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.NewMaybeAutoGenTestConfigBuilder(ctx). + SetTestConfigProp(j.testProperties.Test_config). + 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) @@ -1212,8 +1226,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.NewMaybeAutoGenTestConfigBuilder(ctx). + SetTestConfigProp(j.prebuiltTestProperties.Test_config). + SetTestSuites(j.prebuiltTestProperties.Test_suites). + SetDeviceTemplate("${JavaTestConfigTemplate}"). + SetHostTemplate("${JavaHostTestConfigTemplate}"). + SetHostUnitTestTemplate("${JavaHostUnitTestConfigTemplate}"). + Build() j.Import.GenerateAndroidBuildActions(ctx) } |