1#
2# Copyright (C) 2018 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# Build rules for VTF (Vendor Test Framework).
18#
19# It is designed as a customizable build rule where its callers can provide
20# specifications. Before including it, please set the following variables:
21#
22# - VTF_OUT_ROOT for the base path of a local output directory base.
23# - VTF_TESTCASES_OUT for the testcases sub directory of its output zip file.
24# - VTF_TOOLS_OUT for tools sub directory of its output zip file.
25# - VTF_EXTRA_SCRIPTS for the file name of any extra script to include.
26
27build_list_dir := test/vts/tools/build/tasks/list
28build_utils_dir := test/vts/tools/build/utils
29
30include $(build_list_dir)/vts_apk_package_list.mk
31include $(build_list_dir)/vts_bin_package_list.mk
32include $(build_list_dir)/vts_lib_package_list.mk
33include $(build_utils_dir)/vts_package_utils.mk
34
35# Packaging rule for android-vts10.zip's testcases dir (DATA subdir).
36vtf_target_native_modules := \
37    $(vts_apk_packages) \
38    $(vts_bin_packages) \
39    $(vts_lib_packages) \
40
41vtf_target_native_copy_pairs := \
42  $(call target-native-copy-pairs,$(vtf_target_native_modules),$(VTF_TESTCASES_OUT))
43
44# Packaging rule for host-side test native packages
45
46target_hostdriven_modules := \
47  $(vts_test_host_lib_packages) \
48  $(vts_test_host_bin_packages) \
49
50target_hostdriven_copy_pairs := \
51  $(call host-native-copy-pairs,$(target_hostdriven_modules),$(VTF_TESTCASES_OUT))
52
53host_additional_deps_copy_pairs := \
54  test/vts/tools/vts-tradefed/etc/vts10-tradefed_win.bat:$(VTF_TOOLS_OUT)/vts10-tradefed_win.bat \
55  test/vts/tools/vts-tradefed/DynamicConfig.xml:$(VTF_TESTCASES_OUT)/cts.dynamic
56
57# Packaging rule for host-side Python logic, configs, and data files
58
59host_framework_files := \
60  $(call find-files-in-subdirs,test/vts,"*.py" -and -type f,.) \
61  $(call find-files-in-subdirs,test/vts,"*.runner_conf" -and -type f,.) \
62  $(call find-files-in-subdirs,test/vts,"*.push" -and -type f,.)
63
64host_framework_copy_pairs := \
65  $(foreach f,$(host_framework_files),\
66    test/vts/$(f):$(VTF_TESTCASES_OUT)/vts/$(f))
67
68host_testcase_files := \
69  $(call find-files-in-subdirs,test/vts-testcase,"*.py" -and -type f,.) \
70  $(call find-files-in-subdirs,test/vts-testcase,"*.runner_conf" -and -type f,.) \
71  $(call find-files-in-subdirs,test/vts-testcase,"*.push" -and -type f,.) \
72  $(call find-files-in-subdirs,test/vts-testcase,"*.dump" -and -type f,.)
73
74host_testcase_copy_pairs := \
75  $(foreach f,$(host_testcase_files),\
76    test/vts-testcase/$(f):$(VTF_TESTCASES_OUT)/vts/testcases/$(f))
77
78vts_test_core_copy_pairs := \
79  $(call copy-many-files,$(host_testcase_copy_pairs)) \
80
81ifneq ($(TARGET_BUILD_PDK),true)
82
83host_camera_its_files := \
84  $(call find-files-in-subdirs,cts/apps/CameraITS,"*.py" -and -type f,.) \
85  $(call find-files-in-subdirs,cts/apps/CameraITS,"*.pdf" -and -type f,.) \
86  $(call find-files-in-subdirs,cts/apps/CameraITS,"*.png" -and -type f,.)
87
88host_camera_its_copy_pairs := \
89  $(foreach f,$(host_camera_its_files),\
90    cts/apps/CameraITS/$(f):$(VTF_TESTCASES_OUT)/CameraITS/$(f))
91
92else
93
94host_camera_its_copy_pairs :=
95
96endif  # ifneq ($(TARGET_BUILD_PDK),true)
97
98host_systrace_files := \
99  $(filter-out .git/%, \
100    $(call find-files-in-subdirs,external/chromium-trace,"*" -and -type f,.))
101
102host_systrace_copy_pairs := \
103  $(foreach f,$(host_systrace_files),\
104    external/chromium-trace/$(f):$(VTF_TOOLS_OUT)/external/chromium-trace/$(f))
105
106target_script_files := \
107  $(call find-files-in-subdirs,test/vts/script/target,"*.sh" -and -type f,.)
108
109target_script_copy_pairs := \
110  $(foreach f,$(target_script_files),\
111    test/vts/script/target/$(f):$(VTF_TESTCASES_OUT)/script/target/$(f))
112
113vtf_copy_pairs := \
114  $(call copy-many-files,$(host_framework_copy_pairs)) \
115  $(call copy-many-files,$(host_additional_deps_copy_pairs)) \
116  $(call copy-many-files,$(host_systrace_copy_pairs)) \
117  $(call copy-many-files,$(host_camera_its_copy_pairs)) \
118  $(call copy-many-files,$(vtf_target_native_copy_pairs)) \
119  $(call copy-many-files,$(target_hostdriven_copy_pairs)) \
120  $(call copy-many-files,$(target_hal_hash_copy_pairs)) \
121  $(call copy-many-files,$(target_script_copy_pairs)) \
122
123.PHONY: vts-test-core
124vts-test-core: $(vts_test_core_copy_pairs) $(vtf_copy_pairs)
125