From ad1668fc139cacf9d54ae584536c43bdd9558335 Mon Sep 17 00:00:00 2001 From: Yuntao Xu Date: Thu, 27 May 2021 10:30:26 -0700 Subject: [PATCH] add the LOCAL_DISABLE_TEST_CONFIG variable Introduce and set the variable LOCAL_DISABLE_TEST_CONFIG varaible to be true for the `android_test_helper_app` type modules. Bug: 188927912 Test: rum 'm module-name' (`android_test_helper_app` type module) Test: TreeHugger Change-Id: I5db1029f31d8afe1ca5e9fab95e39d751971058d Merged-In: I5db1029f31d8afe1ca5e9fab95e39d751971058d --- java/androidmk.go | 2 ++ java/androidmk_test.go | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/java/androidmk.go b/java/androidmk.go index 015454464..04357e066 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -460,6 +460,8 @@ func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries { entries := &entriesList[0] entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites) + // introduce a flag variable to control the generation of the .config file + entries.SetString("LOCAL_DISABLE_TEST_CONFIG", "true") }) return entriesList diff --git a/java/androidmk_test.go b/java/androidmk_test.go index 5eaa77b32..246c0eb07 100644 --- a/java/androidmk_test.go +++ b/java/androidmk_test.go @@ -188,3 +188,21 @@ func TestImportSoongDexJar(t *testing.T) { android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_SOONG_DEX_JAR", result.Config, []string{expectedSoongDexJar}, actualSoongDexJar) } + +func TestAndroidTestHelperApp_LocalDisableTestConfig(t *testing.T) { + ctx, _ := testJava(t, ` + android_test_helper_app { + name: "foo", + srcs: ["a.java"], + } + `) + + mod := ctx.ModuleForTests("foo", "android_common").Module() + entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] + + expected := []string{"true"} + actual := entries.EntryMap["LOCAL_DISABLE_TEST_CONFIG"] + if !reflect.DeepEqual(expected, actual) { + t.Errorf("Unexpected flag value - expected: %q, actual: %q", expected, actual) + } +}