1#
2# Copyright (C) 2017 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 VTS10 (Vendor Test Suite) that includes VTF and tests.
18
19LOCAL_PATH := $(call my-dir)
20
21#include $(LOCAL_PATH)/vtf_package.mk
22
23build_utils_dir := $(LOCAL_PATH)/../utils
24
25include $(LOCAL_PATH)/list/vts_adapter_package_list.mk
26include $(LOCAL_PATH)/list/vts_spec_file_list.mk
27include $(LOCAL_PATH)/list/vts_test_bin_package_list.mk
28include $(LOCAL_PATH)/list/vts_test_lib_package_list.mk
29include $(LOCAL_PATH)/list/vts_test_lib_hal_package_list.mk
30include $(LOCAL_PATH)/list/vts_test_lib_hidl_package_list.mk
31include $(LOCAL_PATH)/list/vts_func_fuzzer_package_list.mk
32include $(LOCAL_PATH)/list/vts_test_host_lib_package_list.mk
33include $(LOCAL_PATH)/list/vts_test_host_bin_package_list.mk
34include $(LOCAL_PATH)/list/vts_test_hidl_hal_hash_list.mk
35include $(LOCAL_PATH)/list/vts_vndk_abi_dump_package_list.mk
36include $(build_utils_dir)/vts_package_utils.mk
37-include external/linux-kselftest/android/kselftest_test_list.mk
38-include external/ltp/android/ltp_package_list.mk
39
40VTS10_OUT_ROOT := $(HOST_OUT)/vts10
41VTS10_TESTCASES_OUT := $(VTS10_OUT_ROOT)/android-vts10/testcases
42# TODO(b/151896491): Remove these 2 variable after internal master is updated.
43VTS_OUT_ROOT := $(VTS10_OUT_ROOT)
44VTS_TESTCASES_OUT := $(VTS10_TESTCASES_OUT)
45
46# Packaging rule for android-vts10.zip
47test_suite_name := vts10
48test_suite_tradefed := vts10-tradefed
49test_suite_readme := test/vts/README.md
50# Package vts-core libraries.
51test_suite_tools += $(HOST_OUT_JAVA_LIBRARIES)/vts-core-tradefed-harness.jar \
52    $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed-tests.jar
53
54include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
55
56.PHONY: vts10
57vts10: $(compatibility_zip) vtslab adb
58$(call dist-for-goals, vts10, $(compatibility_zip))
59
60# Packaging rule for android-vts10.zip's testcases dir (DATA subdir).
61target_native_modules := \
62    $(kselftest_modules) \
63    ltp \
64    $(ltp_packages) \
65    $(vts_adapter_package_list) \
66    $(vts_test_bin_packages) \
67    $(vts_test_lib_hal_packages) \
68    $(vts_test_lib_hidl_packages) \
69    $(vts_func_fuzzer_packages) \
70
71target_native_copy_pairs := \
72  $(call target-native-copy-pairs,$(target_native_modules),$(VTS10_TESTCASES_OUT))
73
74# Packaging rule for android-vts10.zip's testcases dir (spec subdir).
75
76target_spec_modules := \
77  $(VTS_SPEC_FILE_LIST)
78
79target_spec_copy_pairs :=
80$(foreach m,$(target_spec_modules),\
81  $(eval my_spec_copy_dir :=\
82    spec/$(word 2,$(subst android/frameworks/, frameworks/hardware/interfaces/,\
83                    $(subst android/hardware/, hardware/interfaces/,\
84                      $(subst android/hidl/, system/libhidl/transport/,\
85                        $(subst android/system/, system/hardware/interfaces/,$(dir $(m)))))))/vts)\
86  $(eval my_spec_copy_file := $(notdir $(m)))\
87  $(eval my_spec_copy_dest := $(my_spec_copy_dir)/$(my_spec_copy_file))\
88  $(eval target_spec_copy_pairs += $(m):$(VTS10_TESTCASES_OUT)/$(my_spec_copy_dest)))
89
90$(foreach m,$(vts_spec_file_list),\
91  $(if $(wildcard $(m)),\
92    $(eval target_spec_copy_pairs += $(m):$(VTS10_TESTCASES_OUT)/spec/$(m))))
93
94target_trace_files := \
95  $(call find-files-in-subdirs,test/vts-testcase/hal-trace,"*.vts.trace" -and -type f,.) \
96
97target_trace_copy_pairs := \
98$(foreach f,$(target_trace_files),\
99    test/vts-testcase/hal-trace/$(f):$(VTS10_TESTCASES_OUT)/hal-hidl-trace/test/vts-testcase/hal-trace/$(f))
100
101target_hal_hash_modules := \
102    $(vts_test_hidl_hal_hash_list) \
103
104target_hal_hash_copy_pairs :=
105$(foreach m,$(target_hal_hash_modules),\
106  $(if $(wildcard $(m)),\
107    $(eval target_hal_hash_copy_pairs += $(m):$(VTS10_TESTCASES_OUT)/hal-hidl-hash/$(m))))
108
109host_vndk_abi_dumps := \
110  $(foreach target,$(vts_vndk_abi_dump_target_tuple_list),\
111    $(call create-vndk-abi-dump-from-target,$(target),$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden))
112
113media_test_res_files := \
114  $(call find-files-in-subdirs,hardware/interfaces/media/res,"*.*" -and -type f,.) \
115
116media_test_res_copy_pairs := \
117  $(foreach f,$(media_test_res_files),\
118    hardware/interfaces/media/res/$(f):$(VTS10_TESTCASES_OUT)/DATA/media/res/$(f))
119
120media_c2_test_res_files := \
121  $(call find-files-in-subdirs,frameworks/av/media/codec2/hidl/1.0/vts/functional/res,"*.*" -and -type f,.) \
122
123media_c2_test_res_copy_pairs := \
124  $(foreach f,$(media_c2_test_res_files),\
125    frameworks/av/media/codec2/hidl/1.0/vts/functional/res/$(f):$(VTS10_TESTCASES_OUT)/DATA/media/c2/res/$(f))
126
127nbu_p2p_apk_files := \
128  $(call find-files-in-subdirs,test/vts-testcase/nbu/src,"*.apk" -and -type f,.)
129
130nbu_p2p_apk_copy_pairs := \
131  $(foreach f,$(nbu_p2p_apk_files),\
132      test/vts-testcase/nbu/src/$(f):$(VTS10_TESTCASES_OUT)/DATA/app/nbu/$(f))
133
134performance_test_res_files := \
135  $(call find-files-in-subdirs,test/vts-testcase/performance/res/,"*.*" -and -type f,.) \
136
137performance_test_res_copy_pairs := \
138  $(foreach f,$(performance_test_res_files),\
139    test/vts-testcase/performance/res/$(f):$(VTS10_TESTCASES_OUT)/DATA/performance/res/$(f))
140
141audio_test_res_files := \
142  $(call find-files-in-subdirs,hardware/interfaces/audio,"*.xsd" -and -type f,.) \
143
144audio_test_res_copy_pairs := \
145  $(foreach f,$(audio_test_res_files),\
146    hardware/interfaces/audio/$(f):$(VTS10_TESTCASES_OUT)/DATA/hardware/interfaces/audio/$(f))
147
148ifeq (REL,$(PLATFORM_VERSION_CODENAME))
149LATEST_VNDK_LIB_EXTRA_LIST := development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-$(PLATFORM_VNDK_VERSION).txt
150else
151LATEST_VNDK_LIB_EXTRA_LIST := development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-current.txt
152endif
153
154vndk_test_res_copy_pairs := \
155  $(LATEST_VNDK_LIB_LIST):$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/$(PLATFORM_VNDK_VERSION)/vndk-lib-list.txt \
156  $(LATEST_VNDK_LIB_EXTRA_LIST):$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/$(PLATFORM_VNDK_VERSION)/vndk-lib-extra-list.txt \
157  $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),build/make/target/product/gsi/$(vndk_ver).txt:$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/$(vndk_ver)/vndk-lib-list.txt) \
158  $(foreach vndk_ver,$(PRODUCT_EXTRA_VNDK_VERSIONS),development/vndk/tools/definition-tool/datasets/vndk-lib-extra-list-$(vndk_ver).txt:$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/$(vndk_ver)/vndk-lib-extra-list.txt) \
159
160system_property_compatibility_test_res_copy_pairs := \
161  system/sepolicy/public/property_contexts:$(VTS10_TESTCASES_OUT)/vts/testcases/security/system_property/data/property_contexts
162
163# For VtsSecurityAvb
164gsi_key_copy_pairs := \
165  system/core/rootdir/avb/q-gsi.avbpubkey:$(VTS10_TESTCASES_OUT)/DATA/avb/q-gsi.avbpubkey \
166  system/core/rootdir/avb/r-gsi.avbpubkey:$(VTS10_TESTCASES_OUT)/DATA/avb/r-gsi.avbpubkey \
167  system/core/rootdir/avb/s-gsi.avbpubkey:$(VTS10_TESTCASES_OUT)/DATA/avb/s-gsi.avbpubkey \
168
169$(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/platform_vndk_version.txt:
170	@echo -n $(PLATFORM_VNDK_VERSION) > $@
171
172# Package roots that contains /prebuilt_hashes, and thus can be analyzed.
173vts_hidl_hals_package_roots := \
174    android.hardware:hardware/interfaces \
175
176vts_hidl_hals := \
177    $(call find-files-in-subdirs, ., "*.hal" -and -type f, \
178        $(foreach pair,$(vts_hidl_hals_package_roots),$(call word-colon,2,$(pair))))
179
180vts_hidl_hashes := \
181    $(foreach pair,$(vts_hidl_hals_package_roots),$(call word-colon,2,$(pair))/current.txt) \
182    $(call find-files-in-subdirs, ., "*.txt" -and -type f, \
183        $(foreach pair,$(vts_hidl_hals_package_roots),$(call word-colon,2,$(pair))/prebuilt_hashes))
184
185vts_hidl_hals_dump := $(VTS_TESTCASES_OUT)/DATA/etc/hidl_hals_for_release.json
186$(vts_hidl_hals_dump): $(HOST_OUT)/bin/dump_hals_for_release $(vts_hidl_hals) $(vts_hidl_hashes)
187	$< --pretty --package-root $(vts_hidl_hals_package_roots) \
188	    --filter-out '::types$$' '^android[.]hardware[.]tests[.]' \
189	    -- $(vts_hidl_hashes) > $@
190
191# for VTF (Vendor Test Framework) packages
192VTF_OUT_ROOT := $(HOST_OUT)/vts10
193VTF_TESTCASES_OUT := $(VTF_OUT_ROOT)/android-vts10/testcases
194VTF_TOOLS_OUT := $(VTF_OUT_ROOT)/android-vts10/tools
195VTF_EXTRA_SCRIPTS :=
196
197xsd_config_files := \
198  system/libvintf/xsd/compatibilityMatrix/compatibility_matrix.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/compatibility_matrix.xsd \
199  system/libvintf/xsd/halManifest/hal_manifest.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/hal_manifest.xsd \
200  frameworks/av/media/libstagefright/xmlparser/media_codecs.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/media_codecs.xsd \
201  frameworks/av/media/libmedia/xsd/media_profiles.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/media_profiles.xsd \
202  frameworks/base/services/core/xsd/default-permissions.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/default-permissions.xsd \
203  frameworks/base/core/xsd/permission.xsd:$(VTS10_TESTCASES_OUT)/DATA/etc/permission.xsd
204
205include $(LOCAL_PATH)/framework/vtf_package.mk
206
207# finally back to the rules for VTS10 (Vendor Test Suite) packages
208vts_copy_pairs := \
209  $(vtf_copy_pairs) \
210  $(vts_test_core_copy_pairs) \
211  $(call copy-many-files,$(target_native_copy_pairs)) \
212  $(call copy-many-files,$(target_spec_copy_pairs)) \
213  $(call copy-many-files,$(target_trace_copy_pairs)) \
214  $(call copy-many-files,$(media_test_res_copy_pairs)) \
215  $(call copy-many-files,$(media_c2_test_res_copy_pairs)) \
216  $(call copy-many-files,$(nbu_p2p_apk_copy_pairs)) \
217  $(call copy-many-files,$(performance_test_res_copy_pairs)) \
218  $(call copy-many-files,$(audio_test_res_copy_pairs)) \
219  $(call copy-many-files,$(vndk_test_res_copy_pairs)) \
220  $(call copy-many-files,$(system_property_compatibility_test_res_copy_pairs)) \
221  $(call copy-many-files,$(xsd_config_files)) \
222  $(call copy-many-files,$(gsi_key_copy_pairs)) \
223  $(VTS10_TESTCASES_OUT)/vts/testcases/vndk/golden/platform_vndk_version.txt \
224  $(vts_hidl_hals_dump) \
225
226$(compatibility_zip): $(vts_copy_pairs) $(host_vndk_abi_dumps)
227
228-include vendor/google_vts/tools/build/vts_package_vendor.mk
229