cts.mk revision 475fa12adef8fc2b08290555a33dc8a9fef05be4
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 15cts_dir := $(HOST_OUT)/cts 16cts_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# 24cts_name := android-cts_$(FILE_NAME_TAG) 25ifeq ($(HOST_OS),darwin) 26 cts_host_os := mac 27else 28 cts_host_os := $(HOST_OS) 29endif 30ifneq ($(HOST_OS),windows) 31 cts_host_os := $(cts_host_os)-$(HOST_ARCH) 32endif 33cts_name := $(cts_name)_$(cts_host_os) 34 35CTS_EXECUTABLE := cts 36ifeq ($(HOST_OS),windows) 37 CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat 38else 39 CTS_EXECUTABLE_PATH := $(HOST_OUT_EXECUTABLES)/$(CTS_EXECUTABLE) 40endif 41CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar 42 43CTS_CASE_LIST := \ 44 DeviceInfoCollector \ 45 CtsTestStubs \ 46 CtsAppTestCases \ 47 CtsContentTestCases \ 48 CtsDatabaseTestCases \ 49 CtsGraphicsTestCases \ 50 CtsLocationTestCases \ 51 CtsNetTestCases \ 52 CtsOsTestCases \ 53 CtsProviderTestCases \ 54 CtsTextTestCases \ 55 CtsUtilTestCases \ 56 CtsViewTestCases \ 57 CtsWidgetTestCases \ 58 SignatureTest 59 60DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans 61 62$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) | $(ACP) 63# Make necessary directory for CTS 64 @rm -rf $(PRIVATE_CTS_DIR) 65 @mkdir -p $(TMP_DIR) 66 @mkdir -p $(PRIVATE_DIR)/docs 67 @mkdir -p $(PRIVATE_DIR)/tools 68 @mkdir -p $(PRIVATE_DIR)/repository/testcases 69 @mkdir -p $(PRIVATE_DIR)/repository/plans 70# Copy executable to CTS directory 71 $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools 72 $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools 73# Change mode of the executables 74 $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH)) 75 $(foreach apk,$(CTS_CASE_LIST), \ 76 $(call copy-testcase-apk,$(apk))) 77# Copy CTS host config to CTS directory 78 $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/ 79 $(hide) touch $@ 80 81# Generate the default test plan for User. 82$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh 83 $(hide) bash $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh cts/tests/tests/ \ 84 $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR) 85 86# Package CTS and clean up. 87INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip 88$(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name) 89$(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir) 90$(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name) 91$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp 92$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) 93 @echo "Package CTS: $@" 94 $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) 95 96.PHONY: cts 97cts: $(INTERNAL_CTS_TARGET) adb 98$(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) 99 100define copy-testcase-apk 101 102$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ 103 $(PRIVATE_DIR)/repository/testcases/$(1).apk 104 105endef 106 107