From 069b75077a072907937f3df00ab2058d69711bd5 Mon Sep 17 00:00:00 2001 From: Julien Desprez Date: Fri, 19 Feb 2021 14:56:28 -0800 Subject: [PATCH] Attempt to run all java_test_host that look unit tests Currently includes some heuristic for the first round of onboarding. Test: presubmit Bug: 180736967 Change-Id: I220551549ed3c1468390655cb911f3b8c0f8880d --- java/java.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/java.go b/java/java.go index dbfad029b..f0eeb29c8 100644 --- a/java/java.go +++ b/java/java.go @@ -2505,6 +2505,11 @@ func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) { } func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { + if j.testProperties.Test_options.Unit_test == nil && ctx.Host() { + // TODO(b/): Clean temporary heuristic to avoid unexpected onboarding. + defaultUnitTest := !inList("tradefed", j.properties.Static_libs) && !inList("tradefed", j.properties.Libs) && !inList("cts", j.testProperties.Test_suites) && !inList("robolectric-host-android_all", j.properties.Static_libs) && !inList("robolectric-host-android_all", j.properties.Libs) + 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, j.testProperties.Auto_gen_config, j.testProperties.Test_options.Unit_test) @@ -2665,6 +2670,7 @@ func TestHostFactory() android.Module { module.Module.properties.Installable = proptools.BoolPtr(true) InitJavaModuleMultiTargets(module, android.HostSupported) + return module }