From 216805457cb4567fe73f8d31a79c473d8f3d9e33 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 7 Dec 2022 18:18:37 -0800 Subject: [PATCH] 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 --- cc/test.go | 23 ++++-- java/java.go | 28 ++++++-- java/java_test.go | 24 +++++++ java/robolectric.go | 11 ++- python/test.go | 11 ++- rust/benchmark.go | 14 ++-- rust/test.go | 17 +++-- sh/sh_binary.go | 12 +++- tradefed/autogen.go | 170 +++++++++----------------------------------- 9 files changed, 145 insertions(+), 165 deletions(-) diff --git a/cc/test.go b/cc/test.go index 2a4861c77..16ef0eff5 100644 --- a/cc/test.go +++ b/cc/test.go @@ -415,8 +415,16 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) { testInstallBase := getTestInstallBase(useVendor) configs := getTradefedConfigOptions(ctx, &test.Properties, test.isolated(ctx)) - test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config, - test.Properties.Test_config_template, test.testDecorator.InstallerProperties.Test_suites, configs, test.Properties.Auto_gen_config, testInstallBase) + test.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{ + TestConfigProp: test.Properties.Test_config, + TestConfigTemplateProp: test.Properties.Test_config_template, + TestSuites: test.testDecorator.InstallerProperties.Test_suites, + Config: configs, + AutoGenConfig: test.Properties.Auto_gen_config, + TestInstallBase: testInstallBase, + DeviceTemplate: "${NativeTestConfigTemplate}", + HostTemplate: "${NativeHostTestConfigTemplate}", + }) test.extraTestConfigs = android.PathsForModuleSrc(ctx, test.Properties.Test_options.Extra_test_configs) @@ -630,8 +638,15 @@ func (benchmark *benchmarkDecorator) install(ctx ModuleContext, file android.Pat if Bool(benchmark.Properties.Require_root) { configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.RootTargetPreparer", nil}) } - benchmark.testConfig = tradefed.AutoGenNativeBenchmarkTestConfig(ctx, benchmark.Properties.Test_config, - benchmark.Properties.Test_config_template, benchmark.Properties.Test_suites, configs, benchmark.Properties.Auto_gen_config) + benchmark.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{ + TestConfigProp: benchmark.Properties.Test_config, + TestConfigTemplateProp: benchmark.Properties.Test_config_template, + TestSuites: benchmark.Properties.Test_suites, + Config: configs, + AutoGenConfig: benchmark.Properties.Auto_gen_config, + DeviceTemplate: "${NativeBenchmarkTestConfigTemplate}", + HostTemplate: "${NativeBenchmarkTestConfigTemplate}", + }) benchmark.binaryDecorator.baseInstaller.dir = filepath.Join("benchmarktest", ctx.ModuleName()) benchmark.binaryDecorator.baseInstaller.dir64 = filepath.Join("benchmarktest64", ctx.ModuleName()) diff --git a/java/java.go b/java/java.go index 275abbe35..5421a154c 100644 --- a/java/java.go +++ b/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