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 = [ |
bigbiff | 673c7ae | 2020-12-02 19:44:56 -0500 | [diff] [blame] | 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 | |
Chih-Hung Hsieh | af6d780 | 2022-02-17 22:03:12 -0800 | [diff] [blame] | 137 | tidy_timeout_srcs: [ |
| 138 | "unit/commands_test.cpp", |
| 139 | ], |
| 140 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 141 | srcs: [ |
Tao Bao | 26b6454 | 2018-08-15 15:18:48 -0700 | [diff] [blame] | 142 | "unit/*.cpp", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 143 | ], |
| 144 | |
Yifan Hong | 67a8fd2 | 2021-11-30 16:39:00 -0800 | [diff] [blame] | 145 | shared_libs: [ |
| 146 | "libbinder_ndk", |
| 147 | ], |
| 148 | |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 149 | static_libs: libapplypatch_static_libs + librecovery_static_libs + [ |
Yifan Hong | 67a8fd2 | 2021-11-30 16:39:00 -0800 | [diff] [blame] | 150 | "android.hardware.health-translate-ndk", |
Jack Wu | 6b39dee | 2022-11-24 20:45:47 +0800 | [diff] [blame] | 151 | "android.hardware.health-V2-ndk", |
Yifan Hong | 67a8fd2 | 2021-11-30 16:39:00 -0800 | [diff] [blame] | 152 | "libhealthshim", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 153 | "librecovery_ui", |
xunchang | 311e6ca | 2019-03-22 08:54:35 -0700 | [diff] [blame] | 154 | "libfusesideload", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 155 | "libminui", |
Tao Bao | e3f09a7 | 2019-10-01 11:55:36 -0700 | [diff] [blame] | 156 | "librecovery_utils", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 157 | "libotautil", |
Tianjie Xu | c1a5e26 | 2019-05-22 14:34:12 -0700 | [diff] [blame] | 158 | "libupdater_device", |
| 159 | "libupdater_core", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 160 | "libupdate_verifier", |
| 161 | |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 162 | "libprotobuf-cpp-lite", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 163 | ], |
Elliott Hughes | a85d7a0 | 2021-04-20 11:58:05 -0700 | [diff] [blame] | 164 | header_libs: [ |
| 165 | "libgtest_prod_headers", |
| 166 | ], |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 167 | |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 168 | data: [ |
| 169 | "testdata/*", |
Tianjie Xu | fa77ee8 | 2020-02-20 23:09:44 -0800 | [diff] [blame] | 170 | ":recovery_image", |
Tao Bao | 4a01f36 | 2019-04-26 23:41:49 -0700 | [diff] [blame] | 171 | ":res-testdata", |
| 172 | ], |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | cc_test { |
| 176 | name: "recovery_manual_test", |
Christopher Ferris | 272467d | 2018-08-22 19:38:49 -0700 | [diff] [blame] | 177 | isolated: true, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 178 | |
| 179 | defaults: [ |
| 180 | "recovery_test_defaults", |
| 181 | ], |
| 182 | |
| 183 | test_suites: ["device-tests"], |
| 184 | |
| 185 | srcs: [ |
| 186 | "manual/recovery_test.cpp", |
| 187 | ], |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 188 | } |
| 189 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 190 | cc_test_host { |
| 191 | name: "recovery_host_test", |
Christopher Ferris | 272467d | 2018-08-22 19:38:49 -0700 | [diff] [blame] | 192 | isolated: true, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 193 | |
| 194 | defaults: [ |
| 195 | "recovery_test_defaults", |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 196 | "libupdater_defaults", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 197 | ], |
| 198 | |
Chih-Hung Hsieh | af6d780 | 2022-02-17 22:03:12 -0800 | [diff] [blame] | 199 | tidy_timeout_srcs: [ |
| 200 | "unit/host/imgdiff_test.cpp", |
| 201 | ], |
| 202 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 203 | srcs: [ |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 204 | "unit/host/*", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 205 | ], |
| 206 | |
| 207 | static_libs: [ |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 208 | "libupdater_host", |
| 209 | "libupdater_core", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 210 | "libimgdiff", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 211 | "libbsdiff", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 212 | "libdivsufsort64", |
| 213 | "libdivsufsort", |
Tianjie Xu | c3a161e | 2019-06-20 18:16:49 -0700 | [diff] [blame] | 214 | "libfstab", |
| 215 | "libc++fs", |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 216 | ], |
| 217 | |
Tao Bao | 83186dd | 2019-04-24 21:34:17 -0700 | [diff] [blame] | 218 | test_suites: ["general-tests"], |
Kelvin Zhang | 9ce9544 | 2022-08-04 10:05:43 -0700 | [diff] [blame] | 219 | test_config: "RecoveryHostTest.xml", |
Tao Bao | 83186dd | 2019-04-24 21:34:17 -0700 | [diff] [blame] | 220 | |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 221 | data: ["testdata/*"], |
Andreas Huber | 435dfac | 2018-08-15 16:11:25 -0700 | [diff] [blame] | 222 | |
| 223 | target: { |
| 224 | darwin: { |
Tianjie Xu | 45c40ec | 2019-07-02 15:09:24 -0700 | [diff] [blame] | 225 | // libapplypatch in "libupdater_defaults" is not available on the Mac. |
Andreas Huber | 435dfac | 2018-08-15 16:11:25 -0700 | [diff] [blame] | 226 | enabled: false, |
| 227 | }, |
| 228 | }, |
Tao Bao | ef5e38f | 2018-07-24 15:34:39 -0700 | [diff] [blame] | 229 | } |
Will Coster | de45570 | 2020-11-10 14:26:17 -0800 | [diff] [blame] | 230 | |
| 231 | cc_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 | } |