The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame^] | 1 | # Copyright (C) 2008 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 | cts_dir := $(HOST_OUT)/cts |
| 16 | cts_tools_src_dir := cts/tools |
| 17 | |
| 18 | cts_name := android-cts |
| 19 | |
| 20 | CTS_EXECUTABLE := cts |
| 21 | ifeq ($(HOST_OS),windows) |
| 22 | CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat |
| 23 | else |
| 24 | CTS_EXECUTABLE_PATH := $(HOST_OUT_EXECUTABLES)/$(CTS_EXECUTABLE) |
| 25 | endif |
| 26 | CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar |
| 27 | |
| 28 | CTS_CASE_LIST := \ |
| 29 | DeviceInfoCollector \ |
| 30 | CtsTestStubs \ |
| 31 | CtsAppTestCases \ |
| 32 | CtsContentTestCases \ |
| 33 | CtsDatabaseTestCases \ |
| 34 | CtsGraphicsTestCases \ |
| 35 | CtsLocationTestCases \ |
| 36 | CtsOsTestCases \ |
| 37 | CtsProviderTestCases \ |
| 38 | CtsTextTestCases \ |
| 39 | CtsUtilTestCases \ |
| 40 | CtsViewTestCases \ |
| 41 | CtsWidgetTestCases \ |
| 42 | CtsNetTestCases \ |
| 43 | SignatureTest |
| 44 | |
| 45 | DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans |
| 46 | |
| 47 | $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) | $(ACP) |
| 48 | # Make necessary directory for CTS |
| 49 | @rm -rf $(PRIVATE_CTS_DIR) |
| 50 | @mkdir -p $(TMP_DIR) |
| 51 | @mkdir -p $(PRIVATE_DIR)/docs |
| 52 | @mkdir -p $(PRIVATE_DIR)/tools |
| 53 | @mkdir -p $(PRIVATE_DIR)/repository/testcases |
| 54 | @mkdir -p $(PRIVATE_DIR)/repository/plans |
| 55 | # Copy executable to CTS directory |
| 56 | $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools |
| 57 | $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools |
| 58 | # Change mode of the executables |
| 59 | $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH)) |
| 60 | $(foreach apk,$(CTS_CASE_LIST), \ |
| 61 | $(call copy-testcase-apk,$(apk))) |
| 62 | # Copy CTS host config and start script to CTS directory |
| 63 | $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/ |
| 64 | $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/startcts $(PRIVATE_DIR)/tools/ |
| 65 | $(hide) touch $@ |
| 66 | |
| 67 | # Generate the default test plan for User. |
| 68 | $(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh |
| 69 | $(hide) bash $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh cts/tests/tests/ \ |
| 70 | $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR) |
| 71 | |
| 72 | # Package CTS and clean up. |
| 73 | # |
| 74 | # TODO: |
| 75 | # Pack cts.bat into the same zip file as well. See http://buganizer/issue?id=1656821 for more details |
| 76 | INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip |
| 77 | $(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name) |
| 78 | $(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir) |
| 79 | $(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name) |
| 80 | $(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp |
| 81 | $(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) |
| 82 | @echo "Package CTS: $@" |
| 83 | $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) |
| 84 | |
| 85 | .PHONY: cts |
| 86 | cts: $(INTERNAL_CTS_TARGET) adb |
| 87 | $(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) |
| 88 | |
| 89 | define copy-testcase-apk |
| 90 | |
| 91 | $(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ |
| 92 | $(PRIVATE_DIR)/repository/testcases/$(1).apk |
| 93 | |
| 94 | endef |
| 95 | |