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