Atest: add LOCAL_TEST_CONFIG to module_info.json
Bug: 112335032 Test: 1. Add LOCAL_TEST_CONFIG := ahat-tests.xml in art/tools/ahat/Android.mk for ahat-tests 2. add ahat-tests.xml in local 3. atest -m hello_world_test 4. check module_info.json local_full_test_config": ["art/tools/ahat/ahat-tests.xml"] Change-Id: Ice2a0c85979fa6b872c92aea5ff4a340342408ad
This commit is contained in:
parent
ebe17177fe
commit
c9347b3167
2 changed files with 44 additions and 44 deletions
|
@ -573,6 +573,42 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_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.
|
||||
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
||||
# Sync the auto_test_config value for multilib modules.
|
||||
|
@ -589,41 +625,6 @@ else
|
|||
$(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
|
||||
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
||||
$(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))
|
||||
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
||||
|
@ -631,8 +632,6 @@ else
|
|||
$(test_config):$(dir)/$(LOCAL_MODULE).config)))
|
||||
endif
|
||||
|
||||
test_config :=
|
||||
|
||||
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
|
||||
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
|
||||
$(eval my_compat_dist_config_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
|
||||
|
@ -647,19 +646,17 @@ else
|
|||
endif
|
||||
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
||||
|
||||
# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by copying it to
|
||||
# the location autogenerated test configs use and setting the flag in
|
||||
# HACK: pretend a soong LOCAL_FULL_TEST_CONFIG is autogenerated by setting the flag in
|
||||
# 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))
|
||||
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
|
||||
my_test_config_file :=
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifneq ($(my_test_data_file_pairs),)
|
||||
$(foreach pair, $(my_test_data_file_pairs), \
|
||||
$(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).MODULE_NAME := $(LOCAL_MODULE)
|
||||
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)
|
||||
|
||||
|
|
|
@ -14,6 +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)")], ' \
|
||||
'},\n' \
|
||||
) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
|
||||
$(hide) echo '}' >> $@
|
||||
|
|
Loading…
Reference in a new issue