1// Copyright (C) 2018 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 // See: http://go/android-license-faq 17 // A large-scale-change added 'default_applicable_licenses' to import 18 // all of the 'license_kinds' from "bootable_recovery_license" 19 // to get the below license kinds: 20 // SPDX-license-identifier-Apache-2.0 21 default_applicable_licenses: ["bootable_recovery_license"], 22} 23 24cc_defaults { 25 name: "recovery_test_defaults", 26 27 defaults: [ 28 "recovery_defaults", 29 ], 30 31 include_dirs: [ 32 "bootable/recovery", 33 ], 34 35 shared_libs: [ 36 "libbase", 37 "libcrypto", 38 "libcutils", 39 "liblog", 40 "libpng", 41 "libprocessgroup", 42 "libselinux", 43 "libziparchive", 44 ], 45 46 target: { 47 android: { 48 shared_libs: [ 49 "libutils", 50 "libvndksupport", 51 ], 52 }, 53 54 host: { 55 static_libs: [ 56 "libutils", 57 ], 58 }, 59 }, 60} 61 62// libapplypatch, libapplypatch_modes 63libapplypatch_static_libs = [ 64 "libapplypatch_modes", 65 "libapplypatch", 66 "libedify", 67 "libotautil", 68 "libbsdiff", 69 "libbspatch", 70 "libdivsufsort", 71 "libdivsufsort64", 72 "libutils", 73 "libbase", 74 "libbrotli", 75 "libbz", 76 "libz_stable", 77 "libziparchive", 78] 79 80// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't 81// have 32-bit android.hardware.health@2.0.so or libbootloader_message.so on marlin). 82librecovery_static_libs = [ 83 "librecovery", 84 "librecovery_fastboot", 85 "libinstall", 86 "librecovery_ui", 87 "libminui", 88 "libfusesideload", 89 "libbootloader_message", 90 "libotautil", 91 92 "libhealthhalutils", 93 "libvintf", 94 95 "android.hardware.health@2.0", 96 "android.hardware.health@1.0", 97 "libext4_utils", 98 "libfs_mgr", 99 "libhidl-gen-utils", 100 "libhidlbase", 101 "liblp", 102 "libtinyxml2", 103 "libc++fs", 104] 105 106// recovery image for unittests. 107// ======================================================== 108genrule { 109 name: "recovery_image", 110 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | $(location minigzip)) $(location testdata/recovery_tail) > $(out)", 111 srcs: [ 112 "testdata/recovery_head", 113 "testdata/recovery_body", 114 "testdata/recovery_tail", 115 ], 116 tools: [ 117 "minigzip", 118 ], 119 out: [ 120 "testdata/recovery.img", 121 ], 122} 123 124cc_test { 125 name: "recovery_unit_test", 126 isolated: true, 127 require_root: true, 128 129 defaults: [ 130 "recovery_test_defaults", 131 "libupdater_defaults", 132 "libupdater_device_defaults", 133 ], 134 135 test_suites: ["device-tests"], 136 137 tidy_timeout_srcs: [ 138 "unit/commands_test.cpp", 139 ], 140 141 srcs: [ 142 "unit/*.cpp", 143 ], 144 145 shared_libs: [ 146 "libbinder_ndk", 147 ], 148 149 static_libs: libapplypatch_static_libs + librecovery_static_libs + [ 150 "android.hardware.health-translate-ndk", 151 "android.hardware.health-V2-ndk", 152 "libhealthshim", 153 "librecovery_ui", 154 "libfusesideload", 155 "libminui", 156 "librecovery_utils", 157 "libotautil", 158 "libupdater_device", 159 "libupdater_core", 160 "libupdate_verifier", 161 162 "libprotobuf-cpp-lite", 163 ], 164 header_libs: [ 165 "libgtest_prod_headers", 166 ], 167 168 data: [ 169 "testdata/*", 170 ":recovery_image", 171 ":res-testdata", 172 ], 173} 174 175cc_test { 176 name: "recovery_manual_test", 177 isolated: true, 178 179 defaults: [ 180 "recovery_test_defaults", 181 ], 182 183 test_suites: ["device-tests"], 184 185 srcs: [ 186 "manual/recovery_test.cpp", 187 ], 188} 189 190cc_test_host { 191 name: "recovery_host_test", 192 isolated: true, 193 194 defaults: [ 195 "recovery_test_defaults", 196 "libupdater_defaults", 197 ], 198 199 tidy_timeout_srcs: [ 200 "unit/host/imgdiff_test.cpp", 201 ], 202 203 srcs: [ 204 "unit/host/*", 205 ], 206 207 static_libs: [ 208 "libupdater_host", 209 "libupdater_core", 210 "libimgdiff", 211 "libbsdiff", 212 "libdivsufsort64", 213 "libdivsufsort", 214 "libfstab", 215 "libc++fs", 216 ], 217 218 test_suites: ["general-tests"], 219 test_config: "RecoveryHostTest.xml", 220 221 data: ["testdata/*"], 222 223 target: { 224 darwin: { 225 // libapplypatch in "libupdater_defaults" is not available on the Mac. 226 enabled: false, 227 }, 228 }, 229} 230 231cc_fuzz { 232 name: "libinstall_verify_package_fuzzer", 233 defaults: [ 234 "recovery_test_defaults", 235 ], 236 237 srcs: ["fuzz/verify_package_fuzzer.cpp"], 238 239 corpus: [ 240 "testdata/otasigned*.zip", 241 ], 242 243 static_libs: [ 244 "libotautil", 245 "libinstall", 246 "librecovery_ui", 247 "libminui", 248 ], 249} 250