Merge "Atest: add LOCAL_TEST_CONFIG to module_info.json"
This commit is contained in:
@@ -573,6 +573,42 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
|||||||
$(eval my_compat_dist_config_$(suite) := ))
|
$(eval my_compat_dist_config_$(suite) := ))
|
||||||
|
|
||||||
|
|
||||||
|
# Auto-generate build config.
|
||||||
|
ifneq (,$(LOCAL_FULL_TEST_CONFIG))
|
||||||
|
test_config := $(LOCAL_FULL_TEST_CONFIG)
|
||||||
|
else ifneq (,$(LOCAL_TEST_CONFIG))
|
||||||
|
test_config := $(LOCAL_PATH)/$(LOCAL_TEST_CONFIG)
|
||||||
|
else
|
||||||
|
test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
|
||||||
|
endif
|
||||||
|
ifeq (,$(test_config))
|
||||||
|
ifneq (true,$(is_native))
|
||||||
|
is_instrumentation_test := true
|
||||||
|
ifeq (true, $(LOCAL_IS_HOST_MODULE))
|
||||||
|
is_instrumentation_test := false
|
||||||
|
endif
|
||||||
|
# If LOCAL_MODULE_CLASS is not APPS, it's certainly not an instrumentation
|
||||||
|
# test. However, some packages for test data also have LOCAL_MODULE_CLASS
|
||||||
|
# set to APPS. These will require flag LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG
|
||||||
|
# to disable auto-generating test config file.
|
||||||
|
ifneq (APPS, $(LOCAL_MODULE_CLASS))
|
||||||
|
is_instrumentation_test := false
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
# CTS modules can be used for test data, so test config files must be
|
||||||
|
# explicitly created using AndroidTest.xml
|
||||||
|
ifeq (,$(filter cts, $(LOCAL_COMPATIBILITY_SUITE)))
|
||||||
|
ifneq (true, $(LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG))
|
||||||
|
ifeq (true, $(filter true,$(is_native) $(is_instrumentation_test)))
|
||||||
|
include $(BUILD_SYSTEM)/autogen_test_config.mk
|
||||||
|
test_config := $(autogen_test_config_file)
|
||||||
|
autogen_test_config_file :=
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
is_instrumentation_test :=
|
||||||
|
|
||||||
# Make sure we only add the files once for multilib modules.
|
# Make sure we only add the files once for multilib modules.
|
||||||
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
||||||
# Sync the auto_test_config value for multilib modules.
|
# Sync the auto_test_config value for multilib modules.
|
||||||
@@ -589,41 +625,6 @@ else
|
|||||||
$(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
|
$(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
|
||||||
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
||||||
$(s):$(dir)/$(n)))))
|
$(s):$(dir)/$(n)))))
|
||||||
ifneq (,$(LOCAL_FULL_TEST_CONFIG))
|
|
||||||
test_config := $(LOCAL_FULL_TEST_CONFIG)
|
|
||||||
else ifneq (,$(LOCAL_TEST_CONFIG))
|
|
||||||
test_config := $(LOCAL_PATH)/$(LOCAL_TEST_CONFIG)
|
|
||||||
else
|
|
||||||
test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
|
|
||||||
endif
|
|
||||||
ifeq (,$(test_config))
|
|
||||||
ifneq (true,$(is_native))
|
|
||||||
is_instrumentation_test := true
|
|
||||||
ifeq (true, $(LOCAL_IS_HOST_MODULE))
|
|
||||||
is_instrumentation_test := false
|
|
||||||
endif
|
|
||||||
# If LOCAL_MODULE_CLASS is not APPS, it's certainly not an instrumentation
|
|
||||||
# test. However, some packages for test data also have LOCAL_MODULE_CLASS
|
|
||||||
# set to APPS. These will require flag LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG
|
|
||||||
# to disable auto-generating test config file.
|
|
||||||
ifneq (APPS, $(LOCAL_MODULE_CLASS))
|
|
||||||
is_instrumentation_test := false
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
# CTS modules can be used for test data, so test config files must be
|
|
||||||
# explicitly created using AndroidTest.xml
|
|
||||||
ifeq (,$(filter cts, $(LOCAL_COMPATIBILITY_SUITE)))
|
|
||||||
ifneq (true, $(LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG))
|
|
||||||
ifeq (true, $(filter true,$(is_native) $(is_instrumentation_test)))
|
|
||||||
include $(BUILD_SYSTEM)/autogen_test_config.mk
|
|
||||||
test_config := $(autogen_test_config_file)
|
|
||||||
autogen_test_config_file :=
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
is_instrumentation_test :=
|
|
||||||
|
|
||||||
ifneq (,$(test_config))
|
ifneq (,$(test_config))
|
||||||
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
||||||
@@ -631,8 +632,6 @@ else
|
|||||||
$(test_config):$(dir)/$(LOCAL_MODULE).config)))
|
$(test_config):$(dir)/$(LOCAL_MODULE).config)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test_config :=
|
|
||||||
|
|
||||||
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
|
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
|
||||||
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
||||||
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
||||||
@@ -647,19 +646,17 @@ else
|
|||||||
endif
|
endif
|
||||||
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
||||||
|
|
||||||
# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by copying it to
|
# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by setting the flag in
|
||||||
# the location autogenerated test configs use and setting the flag in
|
|
||||||
# module-info.json
|
# module-info.json
|
||||||
ifdef LOCAL_FULL_TEST_CONFIG
|
# TODO: (b/113029686) Add explicit flag from Soong to determine if a test was
|
||||||
|
# autogenerated.
|
||||||
|
ifneq (,$(filter $(SOONG_OUT_DIR)%,$(LOCAL_FULL_TEST_CONFIG)))
|
||||||
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
||||||
my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config
|
|
||||||
$(eval $(call copy-one-file,$(LOCAL_FULL_TEST_CONFIG),$(my_test_config_file)))
|
|
||||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(my_test_config_file))
|
|
||||||
ALL_MODULES.$(my_register_name).auto_test_config := true
|
ALL_MODULES.$(my_register_name).auto_test_config := true
|
||||||
my_test_config_file :=
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(my_test_data_file_pairs),)
|
ifneq ($(my_test_data_file_pairs),)
|
||||||
$(foreach pair, $(my_test_data_file_pairs), \
|
$(foreach pair, $(my_test_data_file_pairs), \
|
||||||
$(eval parts := $(subst :,$(space),$(pair))) \
|
$(eval parts := $(subst :,$(space),$(pair))) \
|
||||||
@@ -771,6 +768,8 @@ endif
|
|||||||
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
|
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).MODULE_NAME := $(LOCAL_MODULE)
|
||||||
ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SUITE)
|
ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SUITE)
|
||||||
|
ALL_MODULES.$(my_register_name).TEST_CONFIG := $(test_config)
|
||||||
|
test_config :=
|
||||||
|
|
||||||
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
|
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ $(MODULE_INFO_JSON):
|
|||||||
'"compatibility_suites": [$(foreach w,$(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES)),"$(w)", )], ' \
|
'"compatibility_suites": [$(foreach w,$(sort $(ALL_MODULES.$(m).COMPATIBILITY_SUITES)),"$(w)", )], ' \
|
||||||
'"auto_test_config": [$(ALL_MODULES.$(m).auto_test_config)], ' \
|
'"auto_test_config": [$(ALL_MODULES.$(m).auto_test_config)], ' \
|
||||||
'"module_name": ["$(ALL_MODULES.$(m).MODULE_NAME)"], ' \
|
'"module_name": ["$(ALL_MODULES.$(m).MODULE_NAME)"], ' \
|
||||||
|
'"test_config": [$(if $(ALL_MODULES.$(m).TEST_CONFIG),"$(ALL_MODULES.$(m).TEST_CONFIG)")], ' \
|
||||||
'},\n' \
|
'},\n' \
|
||||||
) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
|
) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
|
||||||
$(hide) echo '}' >> $@
|
$(hide) echo '}' >> $@
|
||||||
|
Reference in New Issue
Block a user