Add support for LOCAL_COMPATIBILITY_SUITE
A module can specify itself to be a Compatibility Suite module with:
LOCAL_COMPATIBILITY_SUITE := <cts-name>
<cts-name> can be "cts" or any other cts name supported by the
build system.
The cts name's config.mk must define global variable
COMPATIBILITY_TESTCASES_OUT_<cts-name> to point to the testcase
output directory.
This change copies the module's built file, as well as the module's
AndroidTest.xml, to the testcase output directory.
The build system collects all the testcase files in a global variable
COMPATIBILITY.<cts-name>.FILES, which you can reference in a build
task that builds the suite's zip package.
Also copy over the test case files if user runs mm/mmm/etc.
Change-Id: Ica0dbc4f193db7de7d395b9c686733bdac41f566
diff --git a/core/base_rules.mk b/core/base_rules.mk
index bd1e252..aa3dded 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -596,6 +596,30 @@
endif
###########################################################
+## Compatibiliy suite files.
+###########################################################
+ifdef LOCAL_COMPATIBILITY_SUITE
+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)
+
+cts_testcase_config := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).config
+$(cts_testcase_config) : $(LOCAL_PATH)/AndroidTest.xml
+ $(copy-file-to-new-target)
+
+COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES := \
+ $(COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES) \
+ $(cts_testcase_file) $(cts_testcase_config)
+
+# Copy over the compatibility files when user runs mm/mmm.
+$(my_register_name) : $(cts_testcase_file) $(cts_testcase_config)
+endif # LOCAL_COMPATIBILITY_SUITE
+
+###########################################################
## Register with ALL_MODULES
###########################################################