The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -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 | cts_name := android-cts |
| 19 | |
Phil Dubach | 9e35a86 | 2009-05-11 11:00:16 -0700 | [diff] [blame] | 20 | CTS_EXECUTABLE := startcts |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | ifeq ($(HOST_OS),windows) |
| 22 | CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat |
| 23 | else |
Phil Dubach | 9e35a86 | 2009-05-11 11:00:16 -0700 | [diff] [blame] | 24 | CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/utils/$(CTS_EXECUTABLE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 25 | endif |
| 26 | CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar |
| 27 | |
Brett Chabot | 67bae7f | 2009-06-26 14:41:30 -0700 | [diff] [blame] | 28 | junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 29 | HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar |
Brett Chabot | 67bae7f | 2009-06-26 14:41:30 -0700 | [diff] [blame] | 30 | |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 31 | CTS_CORE_CASE_LIST := \ |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 32 | android.core.tests.dom \ |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 33 | android.core.tests.luni.io \ |
| 34 | android.core.tests.luni.lang \ |
| 35 | android.core.tests.luni.net \ |
| 36 | android.core.tests.luni.util \ |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 37 | android.core.tests.xml \ |
Jorg Pleumann | 6178820 | 2009-05-07 01:33:14 -0700 | [diff] [blame] | 38 | android.core.tests.runner |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 39 | |
Brian Muramatsu | fa3d88f | 2010-07-22 14:46:53 -0700 | [diff] [blame] | 40 | -include cts/CtsTestCaseList.mk |
| 41 | CTS_CASE_LIST := $(CTS_CORE_CASE_LIST) $(CTS_TEST_CASE_LIST) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 42 | |
| 43 | DEFAULT_TEST_PLAN := $(PRIVATE_DIR)/resource/plans |
| 44 | |
Brett Chabot | 67bae7f | 2009-06-26 14:41:30 -0700 | [diff] [blame] | 45 | $(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar) |
| 46 | |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 47 | $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(ACP) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 48 | # Make necessary directory for CTS |
| 49 | @rm -rf $(PRIVATE_CTS_DIR) |
| 50 | @mkdir -p $(TMP_DIR) |
| 51 | @mkdir -p $(PRIVATE_DIR)/docs |
| 52 | @mkdir -p $(PRIVATE_DIR)/tools |
| 53 | @mkdir -p $(PRIVATE_DIR)/repository/testcases |
| 54 | @mkdir -p $(PRIVATE_DIR)/repository/plans |
| 55 | # Copy executable to CTS directory |
| 56 | $(hide) $(ACP) -fp $(CTS_HOST_JAR) $(PRIVATE_DIR)/tools |
| 57 | $(hide) $(ACP) -fp $(CTS_EXECUTABLE_PATH) $(PRIVATE_DIR)/tools |
Brett Chabot | 67bae7f | 2009-06-26 14:41:30 -0700 | [diff] [blame] | 58 | # Copy junit jar |
| 59 | $(hide) $(ACP) -fp $(PRIVATE_JUNIT_HOST_JAR) $(PRIVATE_DIR)/tools |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 60 | # Copy hosttestlib jar |
| 61 | $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(PRIVATE_DIR)/tools |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 62 | # Change mode of the executables |
| 63 | $(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH)) |
| 64 | $(foreach apk,$(CTS_CASE_LIST), \ |
| 65 | $(call copy-testcase-apk,$(apk))) |
Phil Dubach | 9e35a86 | 2009-05-11 11:00:16 -0700 | [diff] [blame] | 66 | # Copy CTS host config to CTS directory |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 67 | $(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 68 | $(hide) touch $@ |
| 69 | |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 70 | # Generate the test descriptions for the core-tests |
Phil Dubach | c539dbe | 2009-08-07 10:59:04 -0700 | [diff] [blame] | 71 | # Parameters: |
| 72 | # $1 : The output file where the description should be written (without the '.xml' extension) |
| 73 | # $2 : The AndroidManifest.xml corresponding to the test package |
| 74 | # $3 : The name of the TestSuite generator class to use |
| 75 | # $4 : The Android.mk corresponding to the test package (required for host-side tests only) |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 76 | define generate-core-test-description |
| 77 | @echo "Generate core-test description ("$(notdir $(1))")" |
| 78 | $(hide) java $(PRIVATE_JAVAOPTS) \ |
| 79 | -classpath $(PRIVATE_CLASSPATH) \ |
| 80 | $(PRIVATE_PARAMS) CollectAllTests $(1) \ |
Phil Dubach | c539dbe | 2009-08-07 10:59:04 -0700 | [diff] [blame] | 81 | $(2) $(3) $(4) |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 82 | endef |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 83 | |
| 84 | CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON) |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 85 | JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON) |
| 86 | RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON) |
| 87 | SUPPORT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-support,,COMMON) |
| 88 | DOM_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-dom,,COMMON) |
| 89 | XML_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-xml,,COMMON) |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 90 | TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON) |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 91 | GEN_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 Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 92 | |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 93 | $(cts_dir)/all_cts_core_files_stamp: PRIVATE_CLASSPATH:=$(GEN_CLASSPATH) |
| 94 | $(cts_dir)/all_cts_core_files_stamp: PRIVATE_JAVAOPTS:=-Xmx256M |
| 95 | $(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true |
| 96 | $(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 97 | # Why does this depend on javalib.jar instead of classes.jar? Because |
| 98 | # even though the tool will operate on the classes.jar files, the |
| 99 | # build system requires that dependencies use javalib.jar. If |
| 100 | # javalib.jar is up-to-date, then classes.jar is as well. Depending |
| 101 | # on classes.jar will build the files incorrectly. |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 102 | $(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 Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 103 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.dom,\ |
| 104 | cts/tests/core/dom/AndroidManifest.xml,\ |
| 105 | tests.dom.AllTests) |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 106 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.io,\ |
| 107 | cts/tests/core/luni-io/AndroidManifest.xml,\ |
| 108 | tests.luni.AllTestsIo) |
| 109 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.lang,\ |
| 110 | cts/tests/core/luni-lang/AndroidManifest.xml,\ |
| 111 | tests.luni.AllTestsLang) |
| 112 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.net,\ |
| 113 | cts/tests/core/luni-net/AndroidManifest.xml,\ |
| 114 | tests.luni.AllTestsNet) |
| 115 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.util,\ |
| 116 | cts/tests/core/luni-util/AndroidManifest.xml,\ |
| 117 | tests.luni.AllTestsUtil) |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 118 | $(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.xml,\ |
| 119 | cts/tests/core/xml/AndroidManifest.xml,\ |
| 120 | tests.xml.AllTests) |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 121 | $(hide) touch $@ |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 122 | |
| 123 | |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 124 | # ----- Generate the test descriptions for the vm-tests ----- |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 125 | # |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 126 | CORE_VM_TEST_DESC := $(cts_dir)/$(cts_name)/repository/testcases/android.core.vm-tests |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 127 | |
| 128 | VMTESTS_INTERMEDIATES :=$(call intermediates-dir-for,EXECUTABLES,vm-tests,1,) |
| 129 | # core tests only needed to get hold of junit-framework-classes |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 130 | CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON) |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 131 | JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON) |
| 132 | RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON) |
| 133 | TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON) |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 134 | |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 135 | GEN_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 Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 136 | |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 137 | $(CORE_VM_TEST_DESC): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH) |
| 138 | $(CORE_VM_TEST_DESC): PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true |
| 139 | $(CORE_VM_TEST_DESC): PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true |
| 140 | $(CORE_VM_TEST_DESC): PRIVATE_JAVAOPTS:=-Xmx256M |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 141 | # Please see big comment above on why this line depends on javalib.jar instead of classes.jar |
Brian Carlstrom | 7dc35a3 | 2010-08-04 23:17:47 -0700 | [diff] [blame] | 142 | $(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 Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 143 | $(call generate-core-test-description,$(CORE_VM_TEST_DESC),\ |
| 144 | cts/tests/vm-tests/AndroidManifest.xml,\ |
| 145 | dot.junit.AllJunitHostTests, cts/tools/vm-tests/Android.mk) |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 146 | $(ACP) -fv $(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar $(PRIVATE_DIR)/repository/testcases/android.core.vm-tests.jar |
| 147 | |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 148 | # Move app security host-side tests to the repository |
| 149 | APP_SECURITY_LIB := $(cts_dir)/$(cts_name)/repository/testcases/CtsAppSecurityTests.jar |
| 150 | |
Phil Dubach | 793817b | 2009-08-24 14:18:15 -0700 | [diff] [blame] | 151 | $(APP_SECURITY_LIB): $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(cts_dir)/all_cts_files_stamp $(ACP) |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 152 | $(ACP) -fv $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(APP_SECURITY_LIB) |
| 153 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 154 | # Generate the default test plan for User. |
Phil Dubach | 5e3ab04 | 2009-08-14 13:48:34 -0700 | [diff] [blame] | 155 | # Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath> |
Phil Dubach | 3b7521b | 2009-08-19 16:26:40 -0700 | [diff] [blame] | 156 | $(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 Dubach | 5e3ab04 | 2009-08-14 13:48:34 -0700 | [diff] [blame] | 157 | $(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \ |
| 158 | $(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 159 | |
| 160 | # Package CTS and clean up. |
| 161 | # |
| 162 | # TODO: |
| 163 | # Pack cts.bat into the same zip file as well. See http://buganizer/issue?id=1656821 for more details |
| 164 | INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip |
| 165 | $(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name) |
| 166 | $(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir) |
| 167 | $(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name) |
| 168 | $(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp |
Urs Grob | b3c6b2d | 2009-04-17 11:27:08 -0700 | [diff] [blame] | 169 | $(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) $(CORE_VM_TEST_DESC) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 170 | @echo "Package CTS: $@" |
| 171 | $(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) |
| 172 | |
| 173 | .PHONY: cts |
| 174 | cts: $(INTERNAL_CTS_TARGET) adb |
| 175 | $(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) |
| 176 | |
| 177 | define copy-testcase-apk |
| 178 | |
| 179 | $(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \ |
| 180 | $(PRIVATE_DIR)/repository/testcases/$(1).apk |
| 181 | |
| 182 | endef |