ATest: Sync auto_test_config for multilib modules

auto_test_config will only be set once for the same
$(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)
ATest should also treat the multilib variant modules as testable.

Fix auto_generated config may have chance to be set as 2nd_arch name

BUG: 111397357
BUG: 110820867
BUG: 80298359

Test: . build/envseup.sh
      lunch aosp_x86_64-eng
      make -j out/target/product/generic_x86_64/module-info.json
      (check module-info.json for hello_world_test)
      make -j hello_world_test
      cat out/target/product/generic_x86_64/testcases/hello_world_test/hello_world_test.config

Change-Id: I69895b6373476c0053f2c6e657770d606ccfbcd1
This commit is contained in:
yangbill 2018-07-13 22:55:36 +08:00
parent 6ac13c77c7
commit 86f441d899
2 changed files with 61 additions and 54 deletions

View File

@ -29,9 +29,10 @@ else
autogen_test_config_template := $(NATIVE_TEST_CONFIG_TEMPLATE) autogen_test_config_template := $(NATIVE_TEST_CONFIG_TEMPLATE)
endif endif
# Auto generating test config file for native test # Auto generating test config file for native test
$(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE)
$(autogen_test_config_file) : $(autogen_test_config_template) $(autogen_test_config_file) : $(autogen_test_config_template)
@echo "Auto generating test config $(notdir $@)" @echo "Auto generating test config $(notdir $@)"
$(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $< > $@ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g' $< > $@
my_auto_generate_config := true my_auto_generate_config := true
else else
# Auto generating test config file for instrumentation test # Auto generating test config file for instrumentation test
@ -52,6 +53,7 @@ ifeq (true,$(my_auto_generate_config))
LOCAL_INTERMEDIATE_TARGETS += $(autogen_test_config_file) LOCAL_INTERMEDIATE_TARGETS += $(autogen_test_config_file)
$(LOCAL_BUILT_MODULE): $(autogen_test_config_file) $(LOCAL_BUILT_MODULE): $(autogen_test_config_file)
ALL_MODULES.$(my_register_name).auto_test_config := true ALL_MODULES.$(my_register_name).auto_test_config := true
$(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_autogen := true
else else
autogen_test_config_file := autogen_test_config_file :=
endif endif

View File

@ -566,69 +566,74 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))) \ $(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))) \
$(eval my_compat_dist_config_$(suite) := )) $(eval my_compat_dist_config_$(suite) := ))
# Make sure we only add the files once for multilib modules. # Make sure we only add the files once for multilib modules.
ifndef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
$(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true # Sync the auto_test_config value for multilib modules.
ifdef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_autogen
# LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>]. ALL_MODULES.$(my_register_name).auto_test_config := true
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES), \
$(eval p := $(subst :,$(space),$(f))) \
$(eval s := $(word 1,$(p))) \
$(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(s):$(dir)/$(n)))))
test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
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 endif
# CTS modules can be used for test data, so test config files must be else
# explicitly created using AndroidTest.xml $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true
ifeq (,$(filter cts, $(LOCAL_COMPATIBILITY_SUITE))) # LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
ifneq (true, $(LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG)) $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
ifeq (true, $(filter true,$(is_native) $(is_instrumentation_test))) $(eval my_compat_dist_$(suite) += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES), \
include $(BUILD_SYSTEM)/autogen_test_config.mk $(eval p := $(subst :,$(space),$(f))) \
test_config := $(autogen_test_config_file) $(eval s := $(word 1,$(p))) \
autogen_test_config_file := $(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(s):$(dir)/$(n)))))
test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
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 endif
endif endif
endif
is_instrumentation_test := is_instrumentation_test :=
ifneq (,$(test_config)) ifneq (,$(test_config))
$(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)), \
$(test_config):$(dir)/$(LOCAL_MODULE).config))) $(test_config):$(dir)/$(LOCAL_MODULE).config)))
endif endif
test_config := 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)), \
$(LOCAL_PATH)/DynamicConfig.xml:$(dir)/$(LOCAL_MODULE).dynamic))) $(LOCAL_PATH)/DynamicConfig.xml:$(dir)/$(LOCAL_MODULE).dynamic)))
endif endif
ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config)) ifneq (,$(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config))
$(foreach extra_config, $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config), \ $(foreach extra_config, $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config), \
$(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)), \
$(extra_config):$(dir)/$(notdir $(extra_config)))))) $(extra_config):$(dir)/$(notdir $(extra_config))))))
endif endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
ifneq ($(my_test_data_file_pairs),) ifneq ($(my_test_data_file_pairs),)