1# 2# Copyright (C) 2012 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# several makefiles for CTS merged for PTS 18 19LOCAL_PATH:= $(call my-dir) 20 21# New packages should be added here 22PTS_TEST_PACKAGES := \ 23 PtsDeviceFilePerf \ 24 PtsDeviceUi \ 25 PtsDeviceDram 26 27 28PTS_SUPPORT_PACKAGES := \ 29 TestDeviceSetup \ 30 PtsDeviceTaskswitchingAppA \ 31 PtsDeviceTaskswitchingAppB \ 32 PtsDeviceTaskswitchingControl \ 33 com.replica.replicaisland \ 34 PtsDeviceBrowserLauncher 35 36PTS_HOST_CASES := \ 37 PtsHostBootup \ 38 PtsHostUi \ 39 PtsHostBrowser 40 41PTS_HOST_LIBS := \ 42 $(HOST_OUT_JAVA_LIBRARIES)/ptscommonutilhost.jar \ 43 $(HOST_OUT_JAVA_LIBRARIES)/ptshostutil.jar 44 45BUILD_PTS_PACKAGE := cts/suite/pts/build/test_package.mk 46BUILD_PTS_HOST_JAVA_LIBRARY := cts/suite/pts/build/test_host_java_library.mk 47 48PTS_JAVA_TEST_SCANNER := $(HOST_OUT_EXECUTABLES)/cts-java-scanner 49PTS_JAVA_TEST_SCANNER_DOCLET := $(HOST_OUT_JAVA_LIBRARIES)/cts-java-scanner-doclet.jar 50 51# Generator of test XMLs from scanner output. 52PTS_XML_GENERATOR := $(HOST_OUT_EXECUTABLES)/cts-xml-generator 53 54# File indicating which tests should be blacklisted due to problems. 55PTS_EXPECTATIONS := cts/suite/pts/expectations/knownfailures.txt 56 57PTS_TESTCASES_OUT := $(HOST_OUT)/pts-testcases 58 59define pts-get-package-paths 60 $(foreach pkg,$(1),$(PTS_TESTCASES_OUT)/$(pkg).apk) 61endef 62 63define pts-get-test-xmls 64 $(foreach name,$(1),$(PTS_TESTCASES_OUT)/$(name).xml) 65endef 66 67define pts-get-lib-paths 68 $(foreach lib,$(1),$(HOST_OUT_JAVA_LIBRARIES)/$(lib).jar) 69endef 70 71PTS_TEST_CASE_LIST := \ 72 $(PTS_SUPPORT_PACKAGES) 73 74PTS_TEST_CASES := \ 75 $(call pts-get-package-paths,$(PTS_TEST_PACKAGES)) \ 76 $(call pts-get-lib-paths,$(PTS_HOST_CASES)) 77 78PTS_TEST_XMLS := \ 79 $(call pts-get-test-xmls,$(PTS_TEST_PACKAGES)) \ 80 $(call pts-get-test-xmls,$(PTS_HOST_CASES)) 81 82pts_dir := $(HOST_OUT)/pts 83pts_tools_src_dir := cts/tools 84 85pts_name := android-pts 86 87DDMLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/ddmlib-prebuilt.jar 88junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar 89HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar 90TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar 91PTS_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar 92PTS_TF_EXEC := $(HOST_OUT_EXECUTABLES)/pts-tradefed 93PTS_TF_README := $(pts_tools_src_dir)/tradefed-host/README 94 95 96DEFAULT_TEST_PLAN := $(pts_dir)/$(pts_name)/resource/plans/PTS.xml 97 98$(pts_dir)/all_pts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar) 99 100$(pts_dir)/all_pts_files_stamp: $(PTS_TEST_CASES) $(PTS_TEST_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(PTS_HOST_LIBRARY_JARS) $(TF_JAR) $(VMTESTSTF_JAR) $(PTS_TF_JAR) $(PTS_TF_EXEC) $(PTS_TF_README) $(ACP) $(PTS_HOST_LIBS) 101# Make necessary directory for PTS 102 $(hide) rm -rf $(PRIVATE_PTS_DIR) 103 $(hide) mkdir -p $(TMP_DIR) 104 $(hide) mkdir -p $(PRIVATE_DIR)/docs 105 $(hide) mkdir -p $(PRIVATE_DIR)/tools 106 $(hide) mkdir -p $(PRIVATE_DIR)/repository/testcases 107 $(hide) mkdir -p $(PRIVATE_DIR)/repository/plans 108# Copy executable and JARs to PTS directory 109 $(hide) $(ACP) -fp $(DDMLIB_JAR) $(PRIVATE_JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(PTS_HOST_LIBRARY_JARS) $(TF_JAR) $(PTS_TF_JAR) $(PTS_TF_EXEC) $(PTS_TF_README) $(PTS_HOST_LIBS) $(PRIVATE_DIR)/tools 110# Change mode of the executables 111 $(foreach apk,$(PTS_TEST_CASE_LIST),$(call copy-testcase-apk,$(apk))) 112 $(foreach testcase,$(PTS_TEST_CASES),$(call copy-testcase,$(testcase))) 113 $(hide) touch $@ 114 115# Generate the default test plan for User. 116# Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath> 117 118$(DEFAULT_TEST_PLAN): $(pts_dir)/all_pts_files_stamp $(pts_tools_src_dir)/utils/buildCts.py $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(PTS_TEST_XMLS) | $(ACP) 119 $(hide) $(ACP) -fp $(PTS_TEST_XMLS) $(PRIVATE_DIR)/repository/testcases 120 $(hide) $(pts_tools_src_dir)/utils/buildCts.py cts/suite/pts $(PRIVATE_DIR) $(TMP_DIR) \ 121 $(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar -pts 122 123# Package PTS and clean up. 124INTERNAL_PTS_TARGET := $(pts_dir)/$(pts_name).zip 125$(INTERNAL_PTS_TARGET): PRIVATE_NAME := $(pts_name) 126$(INTERNAL_PTS_TARGET): PRIVATE_PTS_DIR := $(pts_dir) 127$(INTERNAL_PTS_TARGET): PRIVATE_DIR := $(pts_dir)/$(pts_name) 128$(INTERNAL_PTS_TARGET): TMP_DIR := $(pts_dir)/temp 129$(INTERNAL_PTS_TARGET): $(pts_dir)/all_pts_files_stamp $(DEFAULT_TEST_PLAN) 130 $(hide) echo "Package PTS: $@" 131 $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) 132 133.PHONY: pts 134pts: $(INTERNAL_PTS_TARGET) 135cts: pts 136# generate PTS during CTS build 137ifneq ($(filter cts, $(MAKECMDGOALS)),) 138$(call dist-for-goals,cts,$(INTERNAL_PTS_TARGET)) 139endif 140 141define copy-testcase-apk 142 143$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ 144 $(PRIVATE_DIR)/repository/testcases/$(1).apk 145 146endef 147 148define copy-testcase 149 150$(hide) $(ACP) -fp $(1) $(PRIVATE_DIR)/repository/testcases/$(notdir $1) 151 152endef 153