1# 2# Copyright (C) 2014 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 17LOCAL_PATH := $(call my-dir) 18 19# Unit tests 20include $(CLEAR_VARS) 21LOCAL_CFLAGS := -Wall -Werror 22LOCAL_MODULE := recovery_unit_test 23LOCAL_COMPATIBILITY_SUITE := device-tests 24LOCAL_STATIC_LIBRARIES := \ 25 libverifier \ 26 libminui \ 27 libotautil \ 28 libupdater \ 29 libziparchive \ 30 libutils \ 31 libz \ 32 libselinux \ 33 libbase \ 34 libBionicGtestMain 35 36LOCAL_SRC_FILES := \ 37 unit/asn1_decoder_test.cpp \ 38 unit/dirutil_test.cpp \ 39 unit/locale_test.cpp \ 40 unit/rangeset_test.cpp \ 41 unit/sysutil_test.cpp \ 42 unit/zip_test.cpp \ 43 44LOCAL_C_INCLUDES := bootable/recovery 45LOCAL_SHARED_LIBRARIES := liblog 46include $(BUILD_NATIVE_TEST) 47 48# Manual tests 49include $(CLEAR_VARS) 50LOCAL_CFLAGS := -Wall -Werror 51LOCAL_MODULE := recovery_manual_test 52LOCAL_STATIC_LIBRARIES := \ 53 libminui \ 54 libbase \ 55 libBionicGtestMain 56 57LOCAL_SRC_FILES := manual/recovery_test.cpp 58LOCAL_SHARED_LIBRARIES := \ 59 liblog \ 60 libpng 61 62resource_files := $(call find-files-in-subdirs, bootable/recovery, \ 63 "*_text.png", \ 64 res-mdpi/images \ 65 res-hdpi/images \ 66 res-xhdpi/images \ 67 res-xxhdpi/images \ 68 res-xxxhdpi/images \ 69 ) 70 71# The resource image files that will go to $OUT/data/nativetest/recovery. 72testimage_out_path := $(TARGET_OUT_DATA)/nativetest/recovery 73GEN := $(addprefix $(testimage_out_path)/, $(resource_files)) 74 75$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 76$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ 77$(GEN): $(testimage_out_path)/% : bootable/recovery/% 78 $(transform-generated-source) 79LOCAL_GENERATED_SOURCES += $(GEN) 80 81include $(BUILD_NATIVE_TEST) 82 83# Component tests 84include $(CLEAR_VARS) 85LOCAL_CFLAGS := \ 86 -Wall \ 87 -Werror \ 88 -D_FILE_OFFSET_BITS=64 89 90ifeq ($(AB_OTA_UPDATER),true) 91LOCAL_CFLAGS += -DAB_OTA_UPDATER=1 92endif 93 94ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true) 95LOCAL_CFLAGS += -DPRODUCT_SUPPORTS_VERITY=1 96endif 97 98ifeq ($(BOARD_AVB_ENABLE),true) 99LOCAL_CFLAGS += -DBOARD_AVB_ENABLE=1 100endif 101 102LOCAL_MODULE := recovery_component_test 103LOCAL_COMPATIBILITY_SUITE := device-tests 104LOCAL_C_INCLUDES := bootable/recovery 105LOCAL_SRC_FILES := \ 106 component/applypatch_test.cpp \ 107 component/bootloader_message_test.cpp \ 108 component/edify_test.cpp \ 109 component/imgdiff_test.cpp \ 110 component/install_test.cpp \ 111 component/sideload_test.cpp \ 112 component/uncrypt_test.cpp \ 113 component/updater_test.cpp \ 114 component/update_verifier_test.cpp \ 115 component/verifier_test.cpp 116 117LOCAL_SHARED_LIBRARIES := \ 118 libhidlbase 119 120tune2fs_static_libraries := \ 121 libext2_com_err \ 122 libext2_blkid \ 123 libext2_quota \ 124 libext2_uuid \ 125 libext2_e2p \ 126 libext2fs 127 128LOCAL_STATIC_LIBRARIES := \ 129 libapplypatch_modes \ 130 libapplypatch \ 131 libedify \ 132 libimgdiff \ 133 libimgpatch \ 134 libbsdiff \ 135 libbspatch \ 136 libfusesideload \ 137 libotafault \ 138 librecovery \ 139 libupdater \ 140 libbootloader_message \ 141 libverifier \ 142 libotautil \ 143 libmounts \ 144 libupdate_verifier \ 145 libdivsufsort \ 146 libdivsufsort64 \ 147 libfs_mgr \ 148 libvintf_recovery \ 149 libvintf \ 150 libhidl-gen-utils \ 151 libtinyxml2 \ 152 libselinux \ 153 libext4_utils \ 154 libsparse \ 155 libcrypto_utils \ 156 libcrypto \ 157 libbz \ 158 libziparchive \ 159 liblog \ 160 libutils \ 161 libz \ 162 libbase \ 163 libtune2fs \ 164 libfec \ 165 libfec_rs \ 166 libsquashfs_utils \ 167 libcutils \ 168 libbrotli \ 169 libBionicGtestMain \ 170 $(tune2fs_static_libraries) 171 172testdata_files := $(call find-subdir-files, testdata/*) 173 174# The testdata files that will go to $OUT/data/nativetest/recovery. 175testdata_out_path := $(TARGET_OUT_DATA)/nativetest/recovery 176GEN := $(addprefix $(testdata_out_path)/, $(testdata_files)) 177$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 178$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ 179$(GEN): $(testdata_out_path)/% : $(LOCAL_PATH)/% 180 $(transform-generated-source) 181LOCAL_GENERATED_SOURCES += $(GEN) 182 183# A copy of the testdata to be packed into continuous_native_tests.zip. 184testdata_continuous_zip_prefix := \ 185 $(call intermediates-dir-for,PACKAGING,recovery_component_test)/DATA 186testdata_continuous_zip_path := $(testdata_continuous_zip_prefix)/nativetest/recovery 187GEN := $(addprefix $(testdata_continuous_zip_path)/, $(testdata_files)) 188$(GEN): PRIVATE_PATH := $(LOCAL_PATH) 189$(GEN): PRIVATE_CUSTOM_TOOL = cp $< $@ 190$(GEN): $(testdata_continuous_zip_path)/% : $(LOCAL_PATH)/% 191 $(transform-generated-source) 192LOCAL_GENERATED_SOURCES += $(GEN) 193LOCAL_PICKUP_FILES := $(testdata_continuous_zip_prefix) 194 195include $(BUILD_NATIVE_TEST) 196 197# Host tests 198include $(CLEAR_VARS) 199LOCAL_CFLAGS := -Wall -Werror 200LOCAL_MODULE := recovery_host_test 201LOCAL_MODULE_HOST_OS := linux 202LOCAL_C_INCLUDES := bootable/recovery 203LOCAL_SRC_FILES := \ 204 component/imgdiff_test.cpp 205LOCAL_STATIC_LIBRARIES := \ 206 libimgdiff \ 207 libimgpatch \ 208 libotautil \ 209 libbsdiff \ 210 libbspatch \ 211 libziparchive \ 212 libutils \ 213 libbase \ 214 libcrypto \ 215 libbrotli \ 216 libbz \ 217 libdivsufsort64 \ 218 libdivsufsort \ 219 libz \ 220 libBionicGtestMain 221LOCAL_SHARED_LIBRARIES := \ 222 liblog 223include $(BUILD_HOST_NATIVE_TEST) 224