The Android Open Source Project | dcc08f0 | 2008-12-17 18:03:49 -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 | # Build a name that looks like: |
| 19 | # |
| 20 | # linux-x86 --> android-cts_12345_linux-x86 |
| 21 | # darwin-x86 --> android-cts_12345_mac-x86 |
| 22 | # windows-x86 --> android-cts_12345_windows |
| 23 | # |
| 24 | cts_name := android-cts_$(FILE_NAME_TAG) |
| 25 | ifeq ($(HOST_OS),darwin) |
| 26 | cts_host_os := mac |
| 27 | else |
| 28 | cts_host_os := $(HOST_OS) |
| 29 | endif |
| 30 | ifneq ($(HOST_OS),windows) |
| 31 | cts_host_os := $(cts_host_os)-$(HOST_ARCH) |
| 32 | endif |
| 33 | cts_name := $(cts_name)_$(cts_host_os) |
| 34 | |
| 35 | CTS_EXECUTABLE := cts |
| 36 | ifeq ($(HOST_OS),windows) |
| 37 | CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat |
| 38 | else |
| 39 | CTS_EXECUTABLE_PATH := $(HOST_OUT_EXECUTABLES)/$(CTS_EXECUTABLE) |
| 40 | endif |
| 41 | CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar |
| 42 | |
| 43 | CTS_CASE_LIST := \ |
| 44 | DeviceInfoCollector \ |
| 45 | CtsTestStubs \ |
| 46 | CtsTextTestCases \ |
| 47 | CtsViewTestCases \ |
| 48 | CtsGraphicsTestCases \ |
| 49 | SignatureTest |
| 50 | |
| 51 | DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans |
| 52 | |
| 53 | $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) | $(ACP) |
| 54 | # Make necessary directory for CTS |
| 55 | @rm -rf $(PRIVATE_CTS_DIR) |
| 56 | @mkdir -p $(TMP_DIR) |
| 57 | @mkdir -p $(PRIVATE_DIR)/docs |
| 58 | @mkdir -p $(PRIVATE_DIR)/tools |
| 59 | @mkdir -p $(PRIVATE_DIR)/repository/testcases |
| 60 | @mkdir -p $(PRIVATE_DIR)/repository/plans |
| 61 | # Copy executable to CTS directory |
| 62 | $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools |
| 63 | $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools |
| 64 | # Change mode of the executables |
| 65 | $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH)) |
| 66 | $(foreach apk,$(CTS_CASE_LIST), \ |
| 67 | $(call copy-testcase-apk,$(apk))) |
| 68 | # Copy CTS host config to CTS directory |
| 69 | $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/ |
| 70 | $(hide) touch $@ |
| 71 | |
| 72 | # Generate the default test plan for User. |
| 73 | $(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh |
| 74 | $(hide) bash $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh cts/tests/tests/ \ |
| 75 | $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR) |
| 76 | |
| 77 | # Package CTS and clean up. |
| 78 | INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip |
| 79 | $(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name) |
| 80 | $(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir) |
| 81 | $(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name) |
| 82 | $(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp |
| 83 | $(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) |
| 84 | @echo "Package CTS: $@" |
| 85 | $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) |
| 86 | |
| 87 | .PHONY: cts |
| 88 | cts: $(INTERNAL_CTS_TARGET) adb |
| 89 | $(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) |
| 90 | |
| 91 | define copy-testcase-apk |
| 92 | $(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ |
| 93 | $(PRIVATE_DIR)/repository/testcases/$(1).apk |
| 94 | |
| 95 | endef |
| 96 | |