Add LOCAL_COMPATIBILITY_SUPPORT_FILES to copy arbitrary CTS support files.

LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>:<dest>,
where <src> is relative to LOCAL_PATH and <dest> is relative to the
suite's testcases out directory.
We keep the rule to auto-detect AndroidTest.xml and DynamicConfig.xml,
so you don't need to modify the existing cts Android.mks.

Bug: 24139963
Bug: 21762834
Change-Id: Iecb83fcbcf8c7575c27802bfd773e4134aec39d5
This commit is contained in:
Ying Wang 2015-09-17 12:24:56 -07:00
parent c7244404c3
commit 25e01177de
2 changed files with 21 additions and 17 deletions

View File

@ -333,32 +333,35 @@ ifneq ($(words $(LOCAL_COMPATIBILITY_SUITE)),1)
$(error $(LOCAL_PATH):$(LOCAL_MODULE) LOCAL_COMPATIBILITY_SUITE can be only one name)
endif
cts_testcase_file := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(my_installed_module_stem)
$(cts_testcase_file) : $(LOCAL_BUILT_MODULE) | $(ACP)
$(copy-file-to-new-target)
# LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
my_compat_dist := $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES),\
$(eval p := $(subst :,$(space),$(f)))\
$(eval s := $(LOCAL_PATH)/$(word 1,$(p)))\
$(eval d := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(or $(word 2,$(p)),(word 1,$(p))))\
$(s):$(d))
cts_testcase_config :=
android_test_xml := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
ifdef android_test_xml
cts_testcase_config := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).config
$(cts_testcase_config) : $(android_test_xml) | $(ACP)
$(copy-file-to-new-target)
# The module itself.
my_compat_dist += \
$(LOCAL_BUILT_MODULE):$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(my_installed_module_stem)
ifneq (,$(wildcard $(LOCAL_PATH)/AndroidTest.xml))
my_compat_dist += \
$(LOCAL_PATH)/AndroidTest.xml:$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).config
endif
cts_testcase_dynamic :=
dynamic_config_xml := $(wildcard $(LOCAL_PATH)/DynamicConfig.xml)
ifdef dynamic_config_xml
cts_testcase_dynamic := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).dynamic
$(cts_testcase_dynamic) : $(dynamic_config_xml) | $(ACP)
$(copy-file-to-new-target)
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
my_compat_dist += \
$(LOCAL_PATH)/DynamicConfig.xml:$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).dynamic
endif
my_compat_files := $(call copy-many-files, $(my_compat_dist))
COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES := \
$(COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES) \
$(cts_testcase_file) $(cts_testcase_config) $(cts_testcase_dynamic)
$(my_compat_files)
# Copy over the compatibility files when user runs mm/mmm.
$(my_register_name) : $(cts_testcase_file) $(cts_testcase_config) $(cts_testcase_dynamic)
$(my_register_name) : $(my_compat_files)
endif # LOCAL_COMPATIBILITY_SUITE
###########################################################

View File

@ -148,6 +148,7 @@ LOCAL_ODM_MODULE:=
LOCAL_PRIVILEGED_MODULE:=
LOCAL_MODULE_OWNER:=
LOCAL_COMPATIBILITY_SUITE:=
LOCAL_COMPATIBILITY_SUPPORT_FILES:=
LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=