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 default_team: "trendy_team_android_kernel", 17 // See: http://go/android-license-faq 18 // A large-scale-change added 'default_applicable_licenses' to import 19 // all of the 'license_kinds' from "bootable_recovery_license" 20 // to get the below license kinds: 21 // SPDX-license-identifier-Apache-2.0 22 default_applicable_licenses: ["bootable_recovery_license"], 23} 24 25cc_defaults { 26 name: "recovery_test_defaults", 27 28 defaults: [ 29 "recovery_defaults", 30 ], 31 32 include_dirs: [ 33 "bootable/recovery", 34 ], 35 36 shared_libs: [ 37 "libbase", 38 "libcrypto", 39 "libcutils", 40 "liblog", 41 "libpng", 42 "libprocessgroup", 43 "libselinux", 44 "libziparchive", 45 ], 46 47 target: { 48 android: { 49 shared_libs: [ 50 "libutils", 51 "libvndksupport", 52 ], 53 }, 54 55 host: { 56 static_libs: [ 57 "libutils", 58 ], 59 }, 60 }, 61} 62 63// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't 64// have 32-bit android.hardware.health@2.0.so or libbootloader_message.so on marlin). 65librecovery_static_libs = [ 66 "librecovery", 67 "librecovery_fastboot", 68 "libinstall", 69 "librecovery_ui", 70 "libminui", 71 "libfusesideload", 72 "libbootloader_message", 73 "libotautil", 74 75 "libhealthhalutils", 76 "libvintf", 77 78 "android.hardware.health@2.0", 79 "android.hardware.health@1.0", 80 "libext4_utils", 81 "libfs_mgr", 82 "libhidl-gen-utils", 83 "libhidlbase", 84 "liblp", 85 "libtinyxml2", 86 "libc++fs", 87] 88 89// recovery image for unittests. 90// ======================================================== 91genrule { 92 name: "recovery_image", 93 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | gzip) $(location testdata/recovery_tail) > $(out)", 94 srcs: [ 95 "testdata/recovery_head", 96 "testdata/recovery_body", 97 "testdata/recovery_tail", 98 ], 99 out: [ 100 "testdata/recovery.img", 101 ], 102} 103 104cc_test { 105 name: "recovery_unit_test", 106 isolated: true, 107 require_root: true, 108 109 defaults: [ 110 "recovery_test_defaults", 111 ], 112 113 test_suites: ["device-tests"], 114 115 srcs: [ 116 "unit/*.cpp", 117 ], 118 119 shared_libs: [ 120 "libbinder_ndk", 121 ], 122 123 static_libs: librecovery_static_libs + [ 124 "android.hardware.health-translate-ndk", 125 "android.hardware.health-V3-ndk", 126 "libhealthshim", 127 "librecovery_ui", 128 "libfusesideload", 129 "libminui", 130 "librecovery_utils", 131 "libotautil", 132 "libupdate_verifier", 133 134 "libprotobuf-cpp-lite", 135 ], 136 header_libs: [ 137 "libgtest_prod_headers", 138 ], 139 140 data: [ 141 "testdata/*", 142 ":recovery_image", 143 ":res-testdata", 144 ], 145} 146 147cc_test { 148 name: "recovery_manual_test", 149 isolated: true, 150 151 defaults: [ 152 "recovery_test_defaults", 153 ], 154 155 test_suites: ["device-tests"], 156 157 srcs: [ 158 "manual/recovery_test.cpp", 159 ], 160} 161 162cc_fuzz { 163 name: "libinstall_verify_package_fuzzer", 164 defaults: [ 165 "recovery_test_defaults", 166 ], 167 168 srcs: ["fuzz/verify_package_fuzzer.cpp"], 169 170 corpus: [ 171 "testdata/otasigned*.zip", 172 ], 173 174 static_libs: [ 175 "libotautil", 176 "libinstall", 177 "librecovery_ui", 178 "libminui", 179 ], 180} 181