From 0c9a525b98ff138e3bceef8087a260af0d9b67b8 Mon Sep 17 00:00:00 2001 From: Dan Shi Date: Sat, 15 Aug 2020 12:27:42 -0700 Subject: [PATCH] Add extra_test_configs option support in mk Bug: 163344047 Test: m -j HelloWorldHostTest hello_world_test HelloWorldTests Change-Id: Ie63c2a80e01984ac9941d0bad4ad7948e0bb8ac0 --- core/base_rules.mk | 8 ++++++++ core/clear_vars.mk | 1 + core/tasks/module-info.mk | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index ddf736bf3..739747046 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -757,6 +757,13 @@ else $(test_config):$(dir)/$(LOCAL_MODULE).config))) endif + ifneq (,$(LOCAL_EXTRA_FULL_TEST_CONFIGS)) + $(foreach test_config_file, $(LOCAL_EXTRA_FULL_TEST_CONFIGS), \ + $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ + $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \ + $(test_config_file):$(dir)/$(notdir $(test_config_file)))))) + endif + ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml)) $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ $(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \ @@ -973,6 +980,7 @@ ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross) ALL_MODULES.$(my_register_name).MODULE_NAME := $(LOCAL_MODULE) ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SUITE) ALL_MODULES.$(my_register_name).TEST_CONFIG := $(test_config) +ALL_MODULES.$(my_register_name).EXTRA_TEST_CONFIGS := $(LOCAL_EXTRA_FULL_TEST_CONFIGS) test_config := INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 307c2c227..288c85543 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -98,6 +98,7 @@ LOCAL_EXPORT_PROGUARD_FLAG_FILES:= LOCAL_EXPORT_SDK_LIBRARIES:= LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:= LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:= +LOCAL_EXTRA_FULL_TEST_CONFIGS:= LOCAL_EXTRACT_APK:= LOCAL_EXTRACT_DPI_APK:= LOCAL_FDO_SUPPORT:= diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk index f6cec1525..b2bd47aa3 100644 --- a/core/tasks/module-info.mk +++ b/core/tasks/module-info.mk @@ -14,7 +14,7 @@ $(MODULE_INFO_JSON): '"compatibility_suites": [$(foreach w,$(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES)),"$(w)", )], ' \ '"auto_test_config": [$(ALL_MODULES.$(m).auto_test_config)], ' \ '"module_name": "$(ALL_MODULES.$(m).MODULE_NAME)", ' \ - '"test_config": [$(if $(ALL_MODULES.$(m).TEST_CONFIG),"$(ALL_MODULES.$(m).TEST_CONFIG)")], ' \ + '"test_config": [$(foreach w,$(strip $(ALL_MODULES.$(m).TEST_CONFIG) $(ALL_MODULES.$(m).EXTRA_TEST_CONFIGS)).TEST_CONFIG,"$(w)", )], ' \ '"dependencies": [$(foreach w,$(sort $(ALL_DEPS.$(m).ALL_DEPS)),"$(w)", )], ' \ '"srcs": [$(foreach w,$(sort $(ALL_MODULES.$(m).SRCS)),"$(w)", )], ' \ '"srcjars": [$(foreach w,$(sort $(ALL_MODULES.$(m).SRCJARS)),"$(w)", )], ' \