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