aboutsummaryrefslogtreecommitdiff
path: root/AfwTestHarnessBuild.mk
blob: c1fdb1e55c22074ac5bdad317e043e405dd0ef41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Copyright (C) 2016 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.
#

-include test/AfwTestHarness/AfwTestCaseList.mk

afw_th_src_dir := test/AfwTestHarness
afw_th_dir := $(HOST_OUT)/afw-th
afw_th_tools_src_dir := $(afw_th_src_dir)/tools
afw_th_tests_src_dir := $(afw_th_src_dir)/tests

TH_COMPATIBILITY_HOST_UTIL_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar
AFW_TH_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/afw-test-tradefed.jar
AFW_TH_TF_EXEC_PATH ?= $(HOST_OUT_EXECUTABLES)/afw-test-tradefed
AFW_TH_TF_README_PATH := $(afw_th_tools_src_dir)/tradefed-host/README

$(afw_th_dir)/all_afw_th_files_stamp: $(AFW_TH_TEST_CASES) $(AFW_TH_SUPPORT_PACKAGE_APKS) $(TF_JAR) $(AFW_TH_TF_JAR) $(AFW_TH_TF_EXEC_PATH) $(AFW_TH_TF_README_PATH) $(TH_COMPATIBILITY_HOST_UTIL_JAR) $(ACP)

# Make necessary directory for afw-test
	$(hide) mkdir -p $(TMP_DIR)
	$(hide) mkdir -p $(PRIVATE_DIR)/tools
	$(hide) mkdir -p $(PRIVATE_DIR)/testcases
# Copy executable and JARs to afw-test directory
	$(hide) $(ACP) -fp $(TF_JAR) $(AFW_TH_TF_JAR) $(AFW_TH_TF_EXEC_PATH) $(AFW_TH_TF_README_PATH) $(TH_COMPATIBILITY_HOST_UTIL_JAR) $(PRIVATE_DIR)/tools
# Copy prebuilt TestDeviceSetup which is required for afw-test-tradefed
	$(hide) $(ACP) -f $(afw_th_tools_src_dir)/prebuilt/TestDeviceSetup.apk $(PRIVATE_DIR)/testcases
# Copy prebuilt CtsDeviceInfo which is required for afw-test-tradefed
	$(hide) $(ACP) -f $(afw_th_tools_src_dir)/prebuilt/CtsDeviceInfo.apk $(PRIVATE_DIR)/testcases
# Copy prebuilt TestDpc which is required for afw-test-tradefed
	$(hide) $(ACP) -f $(afw_th_tools_src_dir)/prebuilt/TestDpc.apk $(PRIVATE_DIR)/testcases
	$(hide) touch $@


afw_th_name := android-afw-test-harness

# Package afw-test-harness and clean up.
#
INTERNAL_AFW_TH_TARGET := $(afw_th_dir)/$(afw_th_name).zip
$(INTERNAL_AFW_TH_TARGET): PRIVATE_NAME := android-cts
$(INTERNAL_AFW_TH_TARGET): PRIVATE_AFW_TH_DIR := $(afw_th_dir)
$(INTERNAL_AFW_TH_TARGET): PRIVATE_DIR := $(afw_th_dir)/android-cts
$(INTERNAL_AFW_TH_TARGET): TMP_DIR := $(afw_th_dir)/temp
$(INTERNAL_AFW_TH_TARGET): $(afw_th_dir)/all_afw_th_files_stamp $(AFW_TH_TEST_XMLS)
	$(hide) echo "Package Android for Work Test Harness: $@"
	$(hide) $(ACP) -f $(afw_th_src_dir)/afw-test.props $(PRIVATE_DIR)/testcases
	$(hide) $(ACP) -f $(afw_th_src_dir)/zip_exclude.lst $(afw_th_dir)
	$(hide) cd $(dir $@) && zip -rq $(notdir $@) $(PRIVATE_NAME) -x@zip_exclude.lst

.PHONY: afw-test-harness
afw-test-harness: $(INTERNAL_AFW_TH_TARGET) adb
	$(hide) echo "********************************************"
	$(hide) echo "To start tradefed, run: afw-test-tradefed"
	$(hide) echo "********************************************"
$(call dist-for-goals,afw-test-harness,$(INTERNAL_AFW_TH_TARGET))