Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 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 | |
Bob Badour | 29be3f6 | 2021-02-12 18:00:57 -0800 | [diff] [blame] | 15 | package { |
| 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 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 24 | cc_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", |
Suren Baghdasaryan | 0ca607c | 2019-01-25 05:33:42 +0000 | [diff] [blame] | 41 | "libprocessgroup", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 42 | "libselinux", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 43 | "libziparchive", |
| 44 | ], |
| 45 | |
| 46 | target: { |
| 47 | android: { |
| 48 | shared_libs: [ |
| 49 | "libutils", |
Peter Collingbourne | 8f2f0d0 | 2019-12-17 17:51:42 -0800 | [diff] [blame] | 50 | "libvndksupport", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 51 | ], |
| 52 | }, |
| 53 | |
| 54 | host: { |
| 55 | static_libs: [ |
| 56 | "libutils", |
| 57 | ], |
Jayant Chowdhary | d24b054 | 2018-10-01 22:55:56 +0000 | [diff] [blame] | 58 | }, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 59 | }, |
| 60 | } |
| 61 | |
Tianjie Xu | 45c40ec | 2019-07-02 15:09:24 -0700 | [diff] [blame] | 62 | // libapplypatch, libapplypatch_modes |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 63 | libapplypatch_static_libs = [ |
| 64 | "libapplypatch_modes", |
| 65 | "libapplypatch", |
| 66 | "libedify", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 67 | "libotautil", |
| 68 | "libbsdiff", |
| 69 | "libbspatch", |
| 70 | "libdivsufsort", |
| 71 | "libdivsufsort64", |
| 72 | "libutils", |
| 73 | "libbase", |
| 74 | "libbrotli", |
| 75 | "libbz", |
Kelvin Zhang | 2f2749f | 2021-01-12 14:42:56 -0500 | [diff] [blame] | 76 | "libz_stable", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 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). |
| 82 | librecovery_static_libs = [ |
| 83 | "librecovery", |
| 84 | "librecovery_fastboot", |
xunchang | 2478885 | 2019-03-22 16:08:52 -0700 | [diff] [blame] | 85 | "libinstall", |
| 86 | "librecovery_ui", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 87 | "libminui", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 88 | "libfusesideload", |
| 89 | "libbootloader_message", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 90 | "libotautil", |
| 91 | |
| 92 | "libhealthhalutils", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 93 | "libvintf", |
| 94 | |
| 95 | "android.hardware.health@2.0", |
| 96 | "android.hardware.health@1.0", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 97 | "libext4_utils", |
| 98 | "libfs_mgr", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 99 | "libhidl-gen-utils", |
| 100 | "libhidlbase", |
Yifan Hong | 0f339e2 | 2018-12-03 13:44:01 -0800 | [diff] [blame] | 101 | "liblp", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 102 | "libtinyxml2", |
Tianjie Xu | cd8faf7 | 2019-08-06 12:32:05 -0700 | [diff] [blame] | 103 | "libc++fs", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 104 | ] |
| 105 | |
Tianjie Xu | fa77ee8 | 2020-02-20 23:09:44 -0800 | [diff] [blame] | 106 | // recovery image for unittests. |
| 107 | // ======================================================== |
| 108 | genrule { |
| 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 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 124 | cc_test { |
| 125 | name: "recovery_unit_test", |
Christopher Ferris | 272467d | 2018-08-22 19:38:49 -0700 | [diff] [blame] | 126 | isolated: true, |
Tao Bao | dfb053e | 2019-09-19 08:08:54 -0700 | [diff] [blame] | 127 | require_root: true, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 128 | |
| 129 | defaults: [ |
| 130 | "recovery_test_defaults", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 131 | "libupdater_defaults", |
Tianjie Xu | c1a5e26 | 2019-05-22 14:34:12 -0700 | [diff] [blame] | 132 | "libupdater_device_defaults", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 133 | ], |
| 134 | |
| 135 | test_suites: ["device-tests"], |
| 136 | |
| 137 | srcs: [ |
Tao Bao | 26b6454 | 2018-08-15 15:18:48 -0700 | [diff] [blame] | 138 | "unit/*.cpp", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 139 | ], |
| 140 | |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 141 | static_libs: libapplypatch_static_libs + librecovery_static_libs + [ |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 142 | "librecovery_ui", |
xunchang | 311e6ca | 2019-03-22 08:54:35 -0700 | [diff] [blame] | 143 | "libfusesideload", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 144 | "libminui", |
Tao Bao | e3f09a7 | 2019-10-01 11:55:36 -0700 | [diff] [blame] | 145 | "librecovery_utils", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 146 | "libotautil", |
Tianjie Xu | c1a5e26 | 2019-05-22 14:34:12 -0700 | [diff] [blame] | 147 | "libupdater_device", |
| 148 | "libupdater_core", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 149 | "libupdate_verifier", |
| 150 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 151 | "libgtest_prod", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 152 | "libprotobuf-cpp-lite", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 153 | ], |
| 154 | |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 155 | data: [ |
| 156 | "testdata/*", |
Tianjie Xu | fa77ee8 | 2020-02-20 23:09:44 -0800 | [diff] [blame] | 157 | ":recovery_image", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 158 | ":res-testdata", |
| 159 | ], |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | cc_test { |
| 163 | name: "recovery_manual_test", |
Christopher Ferris | 272467d | 2018-08-22 19:38:49 -0700 | [diff] [blame] | 164 | isolated: true, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 165 | |
| 166 | defaults: [ |
| 167 | "recovery_test_defaults", |
| 168 | ], |
| 169 | |
| 170 | test_suites: ["device-tests"], |
| 171 | |
| 172 | srcs: [ |
| 173 | "manual/recovery_test.cpp", |
| 174 | ], |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 175 | } |
| 176 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 177 | cc_test_host { |
| 178 | name: "recovery_host_test", |
Christopher Ferris | 272467d | 2018-08-22 19:38:49 -0700 | [diff] [blame] | 179 | isolated: true, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 180 | |
| 181 | defaults: [ |
| 182 | "recovery_test_defaults", |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 183 | "libupdater_defaults", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 184 | ], |
| 185 | |
| 186 | srcs: [ |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 187 | "unit/host/*", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 188 | ], |
| 189 | |
| 190 | static_libs: [ |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 191 | "libupdater_host", |
| 192 | "libupdater_core", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 193 | "libimgdiff", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 194 | "libbsdiff", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 195 | "libdivsufsort64", |
| 196 | "libdivsufsort", |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 197 | "libfstab", |
| 198 | "libc++fs", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 199 | ], |
| 200 | |
Tao Bao | 83186dd | 2019-04-24 21:34:17 -0700 | [diff] [blame] | 201 | test_suites: ["general-tests"], |
| 202 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 203 | data: ["testdata/*"], |
Andreas Huber | 435dfac | 2018-08-15 16:11:25 -0700 | [diff] [blame] | 204 | |
| 205 | target: { |
| 206 | darwin: { |
Tianjie Xu | 45c40ec | 2019-07-02 15:09:24 -0700 | [diff] [blame] | 207 | // libapplypatch in "libupdater_defaults" is not available on the Mac. |
Andreas Huber | 435dfac | 2018-08-15 16:11:25 -0700 | [diff] [blame] | 208 | enabled: false, |
| 209 | }, |
| 210 | }, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 211 | } |
Will Coster | de45570 | 2020-11-10 14:26:17 -0800 | [diff] [blame] | 212 | |
| 213 | cc_fuzz { |
| 214 | name: "libinstall_verify_package_fuzzer", |
| 215 | defaults: [ |
| 216 | "recovery_test_defaults", |
| 217 | ], |
| 218 | |
| 219 | srcs: ["fuzz/verify_package_fuzzer.cpp"], |
| 220 | |
| 221 | corpus: [ |
| 222 | "testdata/otasigned*.zip", |
| 223 | ], |
| 224 | |
| 225 | static_libs: [ |
| 226 | "libotautil", |
| 227 | "libinstall", |
| 228 | "librecovery_ui", |
| 229 | "libminui", |
| 230 | ], |
| 231 | } |