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