2009-03-04 04:28:42 +01:00
|
|
|
# Copyright (C) 2008 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
cts_dir := $(HOST_OUT)/cts
|
|
|
|
cts_tools_src_dir := cts/tools
|
|
|
|
|
|
|
|
cts_name := android-cts
|
|
|
|
|
2009-05-11 20:00:16 +02:00
|
|
|
CTS_EXECUTABLE := startcts
|
2009-03-04 04:28:42 +01:00
|
|
|
ifeq ($(HOST_OS),windows)
|
|
|
|
CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/host/etc/cts.bat
|
|
|
|
else
|
2009-05-11 20:00:16 +02:00
|
|
|
CTS_EXECUTABLE_PATH := $(cts_tools_src_dir)/utils/$(CTS_EXECUTABLE)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
CTS_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts.jar
|
|
|
|
|
2010-07-28 20:07:31 +02:00
|
|
|
DDMLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/ddmlib-prebuilt.jar
|
2009-06-26 23:41:30 +02:00
|
|
|
junit_host_jar := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar
|
2009-08-20 01:26:40 +02:00
|
|
|
HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar
|
2011-01-31 00:07:21 +01:00
|
|
|
TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar
|
|
|
|
CTS_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar
|
|
|
|
CTS_TF_EXEC_PATH := $(HOST_OUT_EXECUTABLES)/cts-tradefed
|
2011-02-19 00:13:50 +01:00
|
|
|
CTS_TF_README_PATH := $(cts_tools_src_dir)/tradefed-host/README
|
2009-06-26 23:41:30 +02:00
|
|
|
|
2010-05-29 02:02:57 +02:00
|
|
|
CTS_CORE_CASE_LIST := \
|
2009-04-17 20:27:08 +02:00
|
|
|
android.core.tests.dom \
|
|
|
|
android.core.tests.luni.io \
|
|
|
|
android.core.tests.luni.lang \
|
|
|
|
android.core.tests.luni.net \
|
|
|
|
android.core.tests.luni.util \
|
|
|
|
android.core.tests.xml \
|
2009-05-07 10:33:14 +02:00
|
|
|
android.core.tests.runner
|
2009-04-17 20:27:08 +02:00
|
|
|
|
2010-07-22 23:46:53 +02:00
|
|
|
-include cts/CtsTestCaseList.mk
|
|
|
|
CTS_CASE_LIST := $(CTS_CORE_CASE_LIST) $(CTS_TEST_CASE_LIST)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2010-06-15 23:29:19 +02:00
|
|
|
DEFAULT_TEST_PLAN := $(cts_dir)/$(cts_name)/resource/plans
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2009-06-26 23:41:30 +02:00
|
|
|
$(cts_dir)/all_cts_files_stamp: PRIVATE_JUNIT_HOST_JAR := $(junit_host_jar)
|
|
|
|
|
2010-09-02 21:36:59 +02:00
|
|
|
-include cts/CtsHostLibraryList.mk
|
2011-02-19 00:13:50 +01:00
|
|
|
$(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ACP)
|
2009-03-04 04:28:42 +01:00
|
|
|
# Make necessary directory for CTS
|
2010-12-06 21:49:13 +01:00
|
|
|
$(hide) rm -rf $(PRIVATE_CTS_DIR)
|
|
|
|
$(hide) mkdir -p $(TMP_DIR)
|
|
|
|
$(hide) mkdir -p $(PRIVATE_DIR)/docs
|
|
|
|
$(hide) mkdir -p $(PRIVATE_DIR)/tools
|
|
|
|
$(hide) mkdir -p $(PRIVATE_DIR)/repository/testcases
|
|
|
|
$(hide) mkdir -p $(PRIVATE_DIR)/repository/plans
|
2010-09-02 21:36:59 +02:00
|
|
|
# Copy executable and JARs to CTS directory
|
2011-02-19 00:13:50 +01:00
|
|
|
$(hide) $(ACP) -fp $(CTS_HOST_JAR) $(CTS_EXECUTABLE_PATH) $(DDMLIB_JAR) $(PRIVATE_JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools
|
2009-03-04 04:28:42 +01:00
|
|
|
# Change mode of the executables
|
|
|
|
$(hide) chmod ug+rwX $(PRIVATE_DIR)/tools/$(notdir $(CTS_EXECUTABLE_PATH))
|
|
|
|
$(foreach apk,$(CTS_CASE_LIST), \
|
|
|
|
$(call copy-testcase-apk,$(apk)))
|
2009-05-11 20:00:16 +02:00
|
|
|
# Copy CTS host config to CTS directory
|
2009-03-04 04:28:42 +01:00
|
|
|
$(hide) $(ACP) -fp $(cts_tools_src_dir)/utils/host_config.xml $(PRIVATE_DIR)/repository/
|
|
|
|
$(hide) touch $@
|
|
|
|
|
2009-04-17 20:27:08 +02:00
|
|
|
# Generate the test descriptions for the core-tests
|
2009-08-07 19:59:04 +02:00
|
|
|
# Parameters:
|
|
|
|
# $1 : The output file where the description should be written (without the '.xml' extension)
|
|
|
|
# $2 : The AndroidManifest.xml corresponding to the test package
|
|
|
|
# $3 : The name of the TestSuite generator class to use
|
2010-12-14 23:45:08 +01:00
|
|
|
# $4 : The directory containing vogar expectations files
|
|
|
|
# $5 : The Android.mk corresponding to the test package (required for host-side tests only)
|
2009-04-17 20:27:08 +02:00
|
|
|
define generate-core-test-description
|
|
|
|
@echo "Generate core-test description ("$(notdir $(1))")"
|
|
|
|
$(hide) java $(PRIVATE_JAVAOPTS) \
|
|
|
|
-classpath $(PRIVATE_CLASSPATH) \
|
|
|
|
$(PRIVATE_PARAMS) CollectAllTests $(1) \
|
2010-12-14 23:45:08 +01:00
|
|
|
$(2) $(3) $(4) $(5)
|
2009-04-17 20:27:08 +02:00
|
|
|
endef
|
2009-03-05 23:34:30 +01:00
|
|
|
|
|
|
|
CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)
|
2010-05-29 03:47:17 +02:00
|
|
|
JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
|
|
|
|
RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON)
|
|
|
|
SUPPORT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-support,,COMMON)
|
|
|
|
DOM_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-dom,,COMMON)
|
|
|
|
XML_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests-xml,,COMMON)
|
2009-03-05 23:34:30 +01:00
|
|
|
TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
|
2010-05-29 03:47:17 +02:00
|
|
|
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)
|
2009-03-05 23:34:30 +01:00
|
|
|
|
2009-04-17 20:27:08 +02:00
|
|
|
$(cts_dir)/all_cts_core_files_stamp: PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
|
|
|
|
$(cts_dir)/all_cts_core_files_stamp: PRIVATE_JAVAOPTS:=-Xmx256M
|
|
|
|
$(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true
|
|
|
|
$(cts_dir)/all_cts_core_files_stamp: PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true
|
2009-03-05 23:34:30 +01:00
|
|
|
# Why does this depend on javalib.jar instead of classes.jar? Because
|
|
|
|
# even though the tool will operate on the classes.jar files, the
|
|
|
|
# build system requires that dependencies use javalib.jar. If
|
|
|
|
# javalib.jar is up-to-date, then classes.jar is as well. Depending
|
|
|
|
# on classes.jar will build the files incorrectly.
|
2010-05-29 03:47:17 +02:00
|
|
|
$(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)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.dom,\
|
|
|
|
cts/tests/core/dom/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.dom.AllTests, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.io,\
|
|
|
|
cts/tests/core/luni-io/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.luni.AllTestsIo, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.lang,\
|
|
|
|
cts/tests/core/luni-lang/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.luni.AllTestsLang, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.net,\
|
|
|
|
cts/tests/core/luni-net/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.luni.AllTestsNet, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.luni.util,\
|
|
|
|
cts/tests/core/luni-util/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.luni.AllTestsUtil, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(cts_dir)/$(cts_name)/repository/testcases/android.core.tests.xml,\
|
|
|
|
cts/tests/core/xml/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
tests.xml.AllTests, libcore/expectations)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(hide) touch $@
|
2009-03-05 23:34:30 +01:00
|
|
|
|
|
|
|
|
2009-04-17 20:27:08 +02:00
|
|
|
# ----- Generate the test descriptions for the vm-tests -----
|
2009-03-05 23:34:30 +01:00
|
|
|
#
|
2009-04-17 20:27:08 +02:00
|
|
|
CORE_VM_TEST_DESC := $(cts_dir)/$(cts_name)/repository/testcases/android.core.vm-tests
|
2009-03-05 23:34:30 +01:00
|
|
|
|
|
|
|
VMTESTS_INTERMEDIATES :=$(call intermediates-dir-for,EXECUTABLES,vm-tests,1,)
|
|
|
|
# core tests only needed to get hold of junit-framework-classes
|
|
|
|
CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)
|
2010-05-29 03:47:17 +02:00
|
|
|
JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
|
|
|
|
RUNNER_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junitrunner,,COMMON)
|
|
|
|
TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
|
2009-03-05 23:34:30 +01:00
|
|
|
|
2010-10-28 03:49:33 +02:00
|
|
|
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:$(HOSTTESTLIB_JAR):$(DDMLIB_JAR):$(HOST_JDK_TOOLS_JAR)
|
2009-03-05 23:34:30 +01:00
|
|
|
|
2009-04-17 20:27:08 +02:00
|
|
|
$(CORE_VM_TEST_DESC): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
|
|
|
|
$(CORE_VM_TEST_DESC): PRIVATE_PARAMS:=-Dcts.useSuppliedTestResult=true
|
|
|
|
$(CORE_VM_TEST_DESC): PRIVATE_PARAMS+=-Dcts.useEnhancedJunit=true
|
|
|
|
$(CORE_VM_TEST_DESC): PRIVATE_JAVAOPTS:=-Xmx256M
|
2009-03-05 23:34:30 +01:00
|
|
|
# Please see big comment above on why this line depends on javalib.jar instead of classes.jar
|
2010-10-28 03:49:33 +02:00
|
|
|
$(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 $(HOSTTESTLIB_JAR) $(DDMLIB_JAR) $(cts_dir)/all_cts_files_stamp | $(ACP)
|
2009-04-17 20:27:08 +02:00
|
|
|
$(call generate-core-test-description,$(CORE_VM_TEST_DESC),\
|
|
|
|
cts/tests/vm-tests/AndroidManifest.xml,\
|
2010-12-14 23:45:08 +01:00
|
|
|
dot.junit.AllJunitHostTests, libcore/expectations, cts/tools/vm-tests/Android.mk)
|
2009-03-05 23:34:30 +01:00
|
|
|
$(ACP) -fv $(VMTESTS_INTERMEDIATES)/android.core.vm-tests.jar $(PRIVATE_DIR)/repository/testcases/android.core.vm-tests.jar
|
|
|
|
|
2009-08-20 01:26:40 +02:00
|
|
|
# Move app security host-side tests to the repository
|
|
|
|
APP_SECURITY_LIB := $(cts_dir)/$(cts_name)/repository/testcases/CtsAppSecurityTests.jar
|
|
|
|
|
2009-08-24 23:18:15 +02:00
|
|
|
$(APP_SECURITY_LIB): $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(cts_dir)/all_cts_files_stamp $(ACP)
|
2009-08-20 01:26:40 +02:00
|
|
|
$(ACP) -fv $(HOST_OUT_JAVA_LIBRARIES)/CtsAppSecurityTests.jar $(APP_SECURITY_LIB)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Generate the default test plan for User.
|
2009-08-14 22:48:34 +02:00
|
|
|
# Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>
|
2009-08-20 01:26:40 +02:00
|
|
|
$(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
|
2009-08-14 22:48:34 +02:00
|
|
|
$(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \
|
|
|
|
$(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# Package CTS and clean up.
|
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# Pack cts.bat into the same zip file as well. See http://buganizer/issue?id=1656821 for more details
|
|
|
|
INTERNAL_CTS_TARGET := $(cts_dir)/$(cts_name).zip
|
|
|
|
$(INTERNAL_CTS_TARGET): PRIVATE_NAME := $(cts_name)
|
|
|
|
$(INTERNAL_CTS_TARGET): PRIVATE_CTS_DIR := $(cts_dir)
|
|
|
|
$(INTERNAL_CTS_TARGET): PRIVATE_DIR := $(cts_dir)/$(cts_name)
|
|
|
|
$(INTERNAL_CTS_TARGET): TMP_DIR := $(cts_dir)/temp
|
2009-04-17 20:27:08 +02:00
|
|
|
$(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) $(CORE_VM_TEST_DESC)
|
2010-12-06 21:49:13 +01:00
|
|
|
$(hide) echo "Package CTS: $@"
|
2009-03-04 04:28:42 +01:00
|
|
|
$(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME)
|
|
|
|
|
|
|
|
.PHONY: cts
|
|
|
|
cts: $(INTERNAL_CTS_TARGET) adb
|
|
|
|
$(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET))
|
|
|
|
|
|
|
|
define copy-testcase-apk
|
|
|
|
|
|
|
|
$(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,$(1))/package.apk \
|
|
|
|
$(PRIVATE_DIR)/repository/testcases/$(1).apk
|
|
|
|
|
|
|
|
endef
|