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 "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// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't 63// have 32-bit android.hardware.health@2.0.so or libbootloader_message.so on marlin). 64librecovery_static_libs = [ 65 "librecovery", 66 "librecovery_fastboot", 67 "libinstall", 68 "librecovery_ui", 69 "libminui", 70 "libfusesideload", 71 "libbootloader_message", 72 "libotautil", 73 74 "libhealthhalutils", 75 "libvintf", 76 77 "android.hardware.health@2.0", 78 "android.hardware.health@1.0", 79 "libext4_utils", 80 "libfs_mgr", 81 "libhidl-gen-utils", 82 "libhidlbase", 83 "liblp", 84 "libtinyxml2", 85] 86 87// recovery image for unittests. 88// ======================================================== 89genrule { 90 name: "recovery_image", 91 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | gzip) $(location testdata/recovery_tail) > $(out)", 92 srcs: [ 93 "testdata/recovery_head", 94 "testdata/recovery_body", 95 "testdata/recovery_tail", 96 ], 97 out: [ 98 "testdata/recovery.img", 99 ], 100} 101 102cc_test { 103 name: "recovery_unit_test", 104 isolated: true, 105 require_root: true, 106 107 defaults: [ 108 "recovery_test_defaults", 109 ], 110 111 test_suites: ["device-tests"], 112 113 srcs: [ 114 "unit/*.cpp", 115 ], 116 117 shared_libs: [ 118 "libbinder_ndk", 119 ], 120 121 static_libs: librecovery_static_libs + [ 122 "android.hardware.health-translate-ndk", 123 "android.hardware.health-V4-ndk", 124 "libhealthshim", 125 "librecovery_ui", 126 "libfusesideload", 127 "libminui", 128 "librecovery_utils", 129 "libotautil", 130 "libupdate_verifier", 131 132 "libprotobuf-cpp-lite", 133 ], 134 header_libs: [ 135 "libgtest_prod_headers", 136 ], 137 138 data: [ 139 "testdata/*", 140 ":recovery_image", 141 ":res-testdata", 142 ], 143} 144 145cc_test { 146 name: "recovery_manual_test", 147 isolated: true, 148 149 defaults: [ 150 "recovery_test_defaults", 151 ], 152 153 test_suites: ["device-tests"], 154 155 srcs: [ 156 "manual/recovery_test.cpp", 157 ], 158} 159 160cc_fuzz { 161 name: "libinstall_verify_package_fuzzer", 162 defaults: [ 163 "recovery_test_defaults", 164 ], 165 166 srcs: ["fuzz/verify_package_fuzzer.cpp"], 167 168 corpus: [ 169 "testdata/otasigned*.zip", 170 ], 171 172 static_libs: [ 173 "libotautil", 174 "libinstall", 175 "librecovery_ui", 176 "libminui", 177 ], 178} 179