blob: 17a7a0e6a12c2f9e36ae2d6e17b56820b0536c85 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# 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
18cts_name := android-cts
19
Phil Dubach9e35a862009-05-11 11:00:16 -070020CTS_EXECUTABLE := startcts
The Android Open Source Project88b60792009-03-03 19:28:42 -080021ifeq ($(HOST_OS),windows)
22 CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat
23else
Phil Dubach9e35a862009-05-11 11:00:16 -070024 CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/utils/$(CTS_EXECUTABLE)
The Android Open Source Project88b60792009-03-03 19:28:42 -080025endif
26CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar
27
Brett Chabot67bae7f2009-06-26 14:41:30 -070028junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
Phil Dubach3b7521b2009-08-19 16:26:40 -070029HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
Brett Chabot67bae7f2009-06-26 14:41:30 -070030
Brian Carlstromb6a08f02010-05-28 17:02:57 -070031CTS_CORE_CASE_LIST := \
Urs Grobb3c6b2d2009-04-17 11:27:08 -070032 android.core.tests.dom \
Urs Grobb3c6b2d2009-04-17 11:27:08 -070033 android.core.tests.luni.io \
34 android.core.tests.luni.lang \
35 android.core.tests.luni.net \
36 android.core.tests.luni.util \
Urs Grobb3c6b2d2009-04-17 11:27:08 -070037 android.core.tests.xml \
Jorg Pleumann61788202009-05-07 01:33:14 -070038 android.core.tests.runner
Urs Grobb3c6b2d2009-04-17 11:27:08 -070039
Phil Dubach3b7521b2009-08-19 16:26:40 -070040CTS_SECURITY_APPS_LIST := \
41 CtsAppAccessData \
42 CtsAppWithData \
43 CtsInstrumentationAppDiffCert \
44 CtsPermissionDeclareApp \
45 CtsSharedUidInstall \
46 CtsSharedUidInstallDiffCert \
47 CtsSimpleAppInstall \
48 CtsSimpleAppInstallDiffCert \
49 CtsTargetInstrumentationApp \
50 CtsUsePermissionDiffCert
51
The Android Open Source Project88b60792009-03-03 19:28:42 -080052CTS_CASE_LIST := \
Brett Chabot2779fa72009-11-12 13:29:07 -080053 TestDeviceSetup \
The Android Open Source Project88b60792009-03-03 19:28:42 -080054 CtsTestStubs \
Svetoslav Ganov08430d52010-04-22 19:17:49 -070055 CtsAccessibilityServiceTestCases \
Brett Chabot1e43c512009-12-17 15:14:40 -080056 CtsAccountManagerTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080057 CtsAppTestCases \
Dan Bornsteinbb0c8802009-11-20 13:13:41 -080058 CtsBluetoothTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080059 CtsContentTestCases \
60 CtsDatabaseTestCases \
Svetoslav Ganov08430d52010-04-22 19:17:49 -070061 CtsDelegatingAccessibilityService \
Brett Chabot30e1f2b2009-09-10 13:35:54 -070062 CtsDpiTestCases \
63 CtsDpiTestCases2 \
Dan Bornstein1347f922009-11-17 14:27:40 -080064 CtsExampleTestCases \
65 CtsGestureTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080066 CtsGraphicsTestCases \
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070067 CtsHardwareTestCases \
Dan Bornstein01833fb2009-11-18 17:18:07 -080068 CtsJniTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080069 CtsLocationTestCases \
Phil Dubach571d0f22009-07-13 14:47:25 -070070 CtsMediaTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080071 CtsOsTestCases \
The Android Open Source Projectfdd3a102009-03-11 12:11:54 -070072 CtsPermissionTestCases \
Brett Chabot7b5edc32009-07-28 20:11:24 -070073 CtsPermission2TestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080074 CtsProviderTestCases \
Brett Chabot45dc54f2009-09-16 18:56:23 -070075 CtsSpeechTestCases \
Phil Dubach951f3d82009-07-14 19:11:30 -070076 CtsTelephonyTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080077 CtsTextTestCases \
78 CtsUtilTestCases \
79 CtsViewTestCases \
Phil Dubach951f3d82009-07-14 19:11:30 -070080 CtsWebkitTestCases \
The Android Open Source Project88b60792009-03-03 19:28:42 -080081 CtsWidgetTestCases \
82 CtsNetTestCases \
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -080083 SignatureTest \
Bill Napierf23f5b42009-04-23 10:14:59 -070084 CtsPerformanceTestCases \
85 CtsPerformance2TestCases \
86 CtsPerformance3TestCases \
87 CtsPerformance4TestCases \
88 CtsPerformance5TestCases \
Bill Napierf22b9a02009-04-24 18:26:58 -070089 ApiDemos \
Bill Napierf23f5b42009-04-23 10:14:59 -070090 ApiDemosReferenceTest \
Phil Dubach3b7521b2009-08-19 16:26:40 -070091 $(CTS_CORE_CASE_LIST) \
92 $(CTS_SECURITY_APPS_LIST)
The Android Open Source Project88b60792009-03-03 19:28:42 -080093
94DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans
95
Brett Chabot67bae7f2009-06-26 14:41:30 -070096$(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar)
97
Phil Dubach3b7521b2009-08-19 16:26:40 -070098$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -080099# Make necessary directory for CTS
100 @rm -rf $(PRIVATE_CTS_DIR)
101 @mkdir -p $(TMP_DIR)
102 @mkdir -p $(PRIVATE_DIR)/docs
103 @mkdir -p $(PRIVATE_DIR)/tools
104 @mkdir -p $(PRIVATE_DIR)/repository/testcases
105 @mkdir -p $(PRIVATE_DIR)/repository/plans
106# Copy executable to CTS directory
107 $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools
108 $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools
Brett Chabot67bae7f2009-06-26 14:41:30 -0700109# Copy junit jar
110 $(hide) $(ACP) -fp $(PRIVATE_JUNIT_HOST_JAR) $(PRIVATE_DIR)/tools
Phil Dubach3b7521b2009-08-19 16:26:40 -0700111# Copy hosttestlib jar
112 $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(PRIVATE_DIR)/tools
The Android Open Source Project88b60792009-03-03 19:28:42 -0800113# Change mode of the executables
114 $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH))
115 $(foreach apk,$(CTS_CASE_LIST), \
116 $(call copy-testcase-apk,$(apk)))
Phil Dubach9e35a862009-05-11 11:00:16 -0700117# Copy CTS host config to CTS directory
The Android Open Source Project88b60792009-03-03 19:28:42 -0800118 $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/
The Android Open Source Project88b60792009-03-03 19:28:42 -0800119 $(hide) touch $@
120
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700121# Generate the test descriptions for the core-tests
Phil Dubachc539dbe2009-08-07 10:59:04 -0700122# Parameters:
123# $1 : The output file where the description should be written (without the '.xml' extension)
124# $2 : The AndroidManifest.xml corresponding to the test package
125# $3 : The name of the TestSuite generator class to use
126# $4 : The Android.mk corresponding to the test package (required for host-side tests only)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700127define generate-core-test-description
128@echo "Generate core-test description ("$(notdir $(1))")"
129$(hide) java $(PRIVATE_JAVAOPTS) \
130 -classpath $(PRIVATE_CLASSPATH) \
131 $(PRIVATE_PARAMS) CollectAllTests $(1) \
Phil Dubachc539dbe2009-08-07 10:59:04 -0700132 $(2) $(3) $(4)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700133endef
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800134
135CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700136JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
137RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON)
138SUPPORT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-support,,COMMON)
139DOM_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-dom,,COMMON)
140XML_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-xml,,COMMON)
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800141TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700142GEN_CLASSPATH := $(CORE_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(RUNNER_INTERMEDIATES)/classes.jar:$(SUPPORT_INTERMEDIATES)/classes.jar:$(DOM_INTERMEDIATES)/classes.jar:$(XML_INTERMEDIATES)/classes.jar:$(TESTS_INTERMEDIATES)/classes.jar:$(CORE_INTERMEDIATES)/javalib.jar:$(JUNIT_INTERMEDIATES)/javalib.jar:$(RUNNER_INTERMEDIATES)/javalib.jar:$(SUPPORT_INTERMEDIATES)/javalib.jar:$(DOM_INTERMEDIATES)/javalib.jar:$(XML_INTERMEDIATES)/javalib.jar:$(TESTS_INTERMEDIATES)/javalib.jar:$(HOST_OUT_JAVA_LIBRARIES)/descGen.jar:$(HOST_JDK_TOOLS_JAR)
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800143
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700144$(cts_dir)/all_cts_core_files_stamp: PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
145$(cts_dir)/all_cts_core_files_stamp: PRIVATE_JAVAOPTS:=-Xmx256M
146$(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true
147$(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800148# Why does this depend on javalib.jar instead of classes.jar? Because
149# even though the tool will operate on the classes.jar files, the
150# build system requires that dependencies use javalib.jar. If
151# javalib.jar is up-to-date, then classes.jar is as well. Depending
152# on classes.jar will build the files incorrectly.
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700153$(cts_dir)/all_cts_core_files_stamp: $(CTS_CORE_CASE_LIST) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CORE_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(RUNNER_INTERMEDIATES)/javalib.jar $(SUPPORT_INTERMEDIATES)/javalib.jar $(DOM_INTERMEDIATES)/javalib.jar $(XML_INTERMEDIATES)/javalib.jar $(TESTS_INTERMEDIATES)/javalib.jar $(cts_dir)/all_cts_files_stamp | $(ACP)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700154 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.dom,\
155 cts/tests/core/dom/AndroidManifest.xml,\
156 tests.dom.AllTests)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700157 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.io,\
158 cts/tests/core/luni-io/AndroidManifest.xml,\
159 tests.luni.AllTestsIo)
160 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.lang,\
161 cts/tests/core/luni-lang/AndroidManifest.xml,\
162 tests.luni.AllTestsLang)
163 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.net,\
164 cts/tests/core/luni-net/AndroidManifest.xml,\
165 tests.luni.AllTestsNet)
166 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.util,\
167 cts/tests/core/luni-util/AndroidManifest.xml,\
168 tests.luni.AllTestsUtil)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700169 $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.xml,\
170 cts/tests/core/xml/AndroidManifest.xml,\
171 tests.xml.AllTests)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700172 $(hide) touch $@
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800173
174
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700175# ----- Generate the test descriptions for the vm-tests -----
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800176#
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700177CORE_VM_TEST_DESC := $(cts_dir)/$(cts_name)/repository/testcases/android.core.vm-tests
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800178
179VMTESTS_INTERMEDIATES :=$(call intermediates-dir-for,EXECUTABLES,vm-tests,1,)
180# core tests only needed to get hold of junit-framework-classes
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800181CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700182JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
183RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON)
184TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800185
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700186GEN_CLASSPATH := $(CORE_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(RUNNER_INTERMEDIATES)/classes.jar:$(TESTS_INTERMEDIATES)/classes.jar:$(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar:$(HOST_OUT_JAVA_LIBRARIES)/descGen.jar:$(HOST_JDK_TOOLS_JAR)
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800187
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700188$(CORE_VM_TEST_DESC): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
189$(CORE_VM_TEST_DESC): PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true
190$(CORE_VM_TEST_DESC): PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true
191$(CORE_VM_TEST_DESC): PRIVATE_JAVAOPTS:=-Xmx256M
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800192# Please see big comment above on why this line depends on javalib.jar instead of classes.jar
Brian Carlstromd05d74b2010-05-28 18:47:17 -0700193$(CORE_VM_TEST_DESC): vm-tests $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CORE_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(RUNNER_INTERMEDIATES)/javalib.jar $(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar $(TESTS_INTERMEDIATES)/javalib.jar $(cts_dir)/all_cts_files_stamp | $(ACP)
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700194 $(call generate-core-test-description,$(CORE_VM_TEST_DESC),\
195 cts/tests/vm-tests/AndroidManifest.xml,\
196 dot.junit.AllJunitHostTests, cts/tools/vm-tests/Android.mk)
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800197 $(ACP) -fv $(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar $(PRIVATE_DIR)/repository/testcases/android.core.vm-tests.jar
198
Phil Dubach3b7521b2009-08-19 16:26:40 -0700199# Move app security host-side tests to the repository
200APP_SECURITY_LIB := $(cts_dir)/$(cts_name)/repository/testcases/CtsAppSecurityTests.jar
201
Phil Dubach793817b2009-08-24 14:18:15 -0700202$(APP_SECURITY_LIB): $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(cts_dir)/all_cts_files_stamp $(ACP)
Phil Dubach3b7521b2009-08-19 16:26:40 -0700203 $(ACP) -fv $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(APP_SECURITY_LIB)
204
The Android Open Source Project88b60792009-03-03 19:28:42 -0800205# Generate the default test plan for User.
Phil Dubach5e3ab042009-08-14 13:48:34 -0700206# Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>
Phil Dubach3b7521b2009-08-19 16:26:40 -0700207$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_dir)/all_cts_core_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(CORE_VM_TEST_DESC) $(APP_SECURITY_LIB) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
Phil Dubach5e3ab042009-08-14 13:48:34 -0700208 $(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \
209 $(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800210
211# Package CTS and clean up.
212#
213# TODO:
214# Pack cts.bat into the same zip file as well. See http://buganizer/issue?id=1656821 for more details
215INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip
216$(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name)
217$(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir)
218$(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name)
219$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp
Urs Grobb3c6b2d2009-04-17 11:27:08 -0700220$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) $(CORE_VM_TEST_DESC)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800221 @echo "Package CTS: $@"
222 $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME)
223
224.PHONY: cts
225cts: $(INTERNAL_CTS_TARGET) adb
226$(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET))
227
228define copy-testcase-apk
229
230$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \
231 $(PRIVATE_DIR)/repository/testcases/$(1).apk
232
233endef