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 15cc_defaults { 16 name: "recovery_test_defaults", 17 18 defaults: [ 19 "recovery_defaults", 20 ], 21 22 include_dirs: [ 23 "bootable/recovery", 24 ], 25 26 shared_libs: [ 27 "libbase", 28 "libcrypto", 29 "libcutils", 30 "liblog", 31 "libpng", 32 "libprocessgroup", 33 "libselinux", 34 "libz", 35 "libziparchive", 36 ], 37 38 target: { 39 android: { 40 shared_libs: [ 41 "libutils", 42 "libvndksupport", 43 ], 44 }, 45 46 host: { 47 static_libs: [ 48 "libutils", 49 ], 50 }, 51 }, 52} 53 54// libapplypatch, libapplypatch_modes 55libapplypatch_static_libs = [ 56 "libapplypatch_modes", 57 "libapplypatch", 58 "libedify", 59 "libotautil", 60 "libbsdiff", 61 "libbspatch", 62 "libdivsufsort", 63 "libdivsufsort64", 64 "libutils", 65 "libbase", 66 "libbrotli", 67 "libbz", 68 "libz", 69 "libziparchive", 70] 71 72// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't 73// have 32-bit android.hardware.health@2.0.so or libbootloader_message.so on marlin). 74librecovery_static_libs = [ 75 "librecovery", 76 "librecovery_fastboot", 77 "libinstall", 78 "librecovery_ui", 79 "libminui", 80 "libfusesideload", 81 "libbootloader_message", 82 "libotautil", 83 84 "libhealthhalutils", 85 "libvintf", 86 87 "android.hardware.health@2.0", 88 "android.hardware.health@1.0", 89 "libext4_utils", 90 "libfs_mgr", 91 "libhidl-gen-utils", 92 "libhidlbase", 93 "liblp", 94 "libtinyxml2", 95 "libc++fs", 96] 97 98// recovery image for unittests. 99// ======================================================== 100genrule { 101 name: "recovery_image", 102 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | $(location minigzip)) $(location testdata/recovery_tail) > $(out)", 103 srcs: [ 104 "testdata/recovery_head", 105 "testdata/recovery_body", 106 "testdata/recovery_tail", 107 ], 108 tools: [ 109 "minigzip", 110 ], 111 out: [ 112 "testdata/recovery.img", 113 ], 114} 115 116cc_test { 117 name: "recovery_unit_test", 118 isolated: true, 119 require_root: true, 120 121 defaults: [ 122 "recovery_test_defaults", 123 "libupdater_defaults", 124 "libupdater_device_defaults", 125 ], 126 127 test_suites: ["device-tests"], 128 129 srcs: [ 130 "unit/*.cpp", 131 ], 132 133 static_libs: libapplypatch_static_libs + librecovery_static_libs + [ 134 "librecovery_ui", 135 "libfusesideload", 136 "libminui", 137 "librecovery_utils", 138 "libotautil", 139 "libupdater_device", 140 "libupdater_core", 141 "libupdate_verifier", 142 143 "libgtest_prod", 144 "libprotobuf-cpp-lite", 145 ], 146 147 data: [ 148 "testdata/*", 149 ":recovery_image", 150 ":res-testdata", 151 ], 152} 153 154cc_test { 155 name: "recovery_manual_test", 156 isolated: true, 157 158 defaults: [ 159 "recovery_test_defaults", 160 ], 161 162 test_suites: ["device-tests"], 163 164 srcs: [ 165 "manual/recovery_test.cpp", 166 ], 167} 168 169cc_test_host { 170 name: "recovery_host_test", 171 isolated: true, 172 173 defaults: [ 174 "recovery_test_defaults", 175 "libupdater_defaults", 176 ], 177 178 srcs: [ 179 "unit/host/*", 180 ], 181 182 static_libs: [ 183 "libupdater_host", 184 "libupdater_core", 185 "libimgdiff", 186 "libbsdiff", 187 "libdivsufsort64", 188 "libdivsufsort", 189 "libfstab", 190 "libc++fs", 191 ], 192 193 test_suites: ["general-tests"], 194 195 data: ["testdata/*"], 196 197 target: { 198 darwin: { 199 // libapplypatch in "libupdater_defaults" is not available on the Mac. 200 enabled: false, 201 }, 202 }, 203} 204