• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Builds a package and defines a rule to generate the associated test
17# package XML needed by CTS.
18#
19# Replace "include $(BUILD_PACKAGE)" with "include $(BUILD_CTS_PACKAGE)"
20#
21
22# Disable by default so "m cts" will work in emulator builds
23LOCAL_DEX_PREOPT := false
24LOCAL_PROGUARD_ENABLED := disabled
25
26include $(BUILD_CTS_SUPPORT_PACKAGE)
27include $(BUILD_CTS_MODULE_TEST_CONFIG)
28
29cts_src_dirs := $(LOCAL_PATH)
30cts_src_dirs += $(sort $(dir $(LOCAL_GENERATED_SOURCES)))
31cts_src_dirs := $(addprefix -s , $(cts_src_dirs))
32
33cts_package_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_PACKAGE_NAME).xml
34$(cts_package_xml): PRIVATE_SRC_DIRS := $(cts_src_dirs)
35$(cts_package_xml): PRIVATE_INSTRUMENTATION := $(LOCAL_INSTRUMENTATION_FOR)
36$(cts_package_xml): PRIVATE_PACKAGE := $(LOCAL_PACKAGE_NAME)
37ifneq ($(filter cts/suite/cts/%, $(LOCAL_PATH)),)
38PRIVATE_CTS_TEST_PACKAGE_NAME_ := com.android.cts.$(notdir $(LOCAL_PATH))
39else
40PRIVATE_CTS_TEST_PACKAGE_NAME_ := android.$(notdir $(LOCAL_PATH))
41endif
42ifeq ($(cts_runtime_hint),)
43$(cts_package_xml): PRIVATE_CTS_RUNTIME_HINT := "0"
44else
45$(cts_package_xml): PRIVATE_CTS_RUNTIME_HINT := $(cts_runtime_hint)
46endif
47$(cts_package_xml): PRIVATE_TEST_PACKAGE := $(PRIVATE_CTS_TEST_PACKAGE_NAME_)
48$(cts_package_xml): PRIVATE_MANIFEST := $(LOCAL_PATH)/AndroidManifest.xml
49$(cts_package_xml): PRIVATE_TEST_TYPE := $(if $(LOCAL_CTS_TEST_RUNNER),$(LOCAL_CTS_TEST_RUNNER),'')
50$(cts_package_xml): $(cts_support_apks)
51$(cts_package_xml): $(cts_module_test_config)
52$(cts_package_xml): $(CTS_EXPECTATIONS) $(CTS_UNSUPPORTED_ABIS) $(CTS_JAVA_TEST_SCANNER_DOCLET) $(CTS_JAVA_TEST_SCANNER) $(CTS_XML_GENERATOR)
53	$(hide) echo Generating test description for java package $(PRIVATE_PACKAGE)
54	$(hide) mkdir -p $(CTS_TESTCASES_OUT)
55	$(hide) $(CTS_JAVA_TEST_SCANNER) \
56						$(PRIVATE_SRC_DIRS) \
57						-d $(CTS_JAVA_TEST_SCANNER_DOCLET) | \
58			$(CTS_XML_GENERATOR) \
59						-t $(PRIVATE_TEST_TYPE) \
60						-m $(PRIVATE_MANIFEST) \
61						-i "$(PRIVATE_INSTRUMENTATION)" \
62						-n $(PRIVATE_PACKAGE) \
63						-p $(PRIVATE_TEST_PACKAGE) \
64						-x "runtimeHint->$(PRIVATE_CTS_RUNTIME_HINT)" \
65						-e $(CTS_EXPECTATIONS) \
66						-b $(CTS_UNSUPPORTED_ABIS) \
67						-a $(CTS_TARGET_ARCH) \
68						-o $@
69# Have the module name depend on the cts files; so the cts files get generated when you run mm/mmm/mma/mmma.
70$(my_register_name) : $(cts_package_xml) $(cts_module_test_config)
71
72# Make sure we clear cts_runtime_hint, so other parents will use the default if they do not set cts_runtime_hint.
73cts_runtime_hint :=
74