cts.mk revision dca10d536dc63f1901fa37fbb823cc6f8f6365a3
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_linux-x86 21# darwin-x86 --> android-cts_mac-x86 22# windows-x86 --> android-cts_windows 23# 24cts_name := android-cts 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 and start script to CTS directory 78 $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/ 79 $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/startcts $(PRIVATE_DIR)/tools/ 80 $(hide) touch $@ 81 82# Generate the default test plan for User. 83$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh 84 $(hide) bash $(cts_tools_src_dir)/utils/genDefaultTestPlan.sh cts/tests/tests/ \ 85 $(PRIVATE_DIR) $(TMP_DIR) $(TOP) $(TARGET_COMMON_OUT_ROOT) $(OUT_DIR) 86 87# Package CTS and clean up. 88INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip 89$(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name) 90$(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir) 91$(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name) 92$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp 93$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) 94 @echo "Package CTS: $@" 95 $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) 96 97.PHONY: cts 98cts: $(INTERNAL_CTS_TARGET) adb 99$(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) 100 101define copy-testcase-apk 102 103$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ 104 $(PRIVATE_DIR)/repository/testcases/$(1).apk 105 106endef 107 108