blob: 1fd26c4bfc0e77939f7b25a9d350065c5d0a3758 [file] [log] [blame]
Tao Baoef5e38f2018-07-24 15:34:39 -07001// 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 Badour29be3f62021-02-12 18:00:57 -080015package {
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 Baoef5e38f2018-07-24 15:34:39 -070024cc_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 Baghdasaryan0ca607c2019-01-25 05:33:42 +000041 "libprocessgroup",
Tao Baoef5e38f2018-07-24 15:34:39 -070042 "libselinux",
Tao Baoef5e38f2018-07-24 15:34:39 -070043 "libziparchive",
44 ],
45
46 target: {
47 android: {
48 shared_libs: [
49 "libutils",
Peter Collingbourne8f2f0d02019-12-17 17:51:42 -080050 "libvndksupport",
Tao Baoef5e38f2018-07-24 15:34:39 -070051 ],
52 },
53
54 host: {
55 static_libs: [
56 "libutils",
57 ],
Jayant Chowdharyd24b0542018-10-01 22:55:56 +000058 },
Tao Baoef5e38f2018-07-24 15:34:39 -070059 },
60}
61
Tianjie Xu45c40ec2019-07-02 15:09:24 -070062// libapplypatch, libapplypatch_modes
Tao Baoef5e38f2018-07-24 15:34:39 -070063libapplypatch_static_libs = [
64 "libapplypatch_modes",
65 "libapplypatch",
66 "libedify",
Tao Baoef5e38f2018-07-24 15:34:39 -070067 "libotautil",
68 "libbsdiff",
69 "libbspatch",
70 "libdivsufsort",
71 "libdivsufsort64",
72 "libutils",
73 "libbase",
74 "libbrotli",
75 "libbz",
Kelvin Zhang2f2749f2021-01-12 14:42:56 -050076 "libz_stable",
Tao Baoef5e38f2018-07-24 15:34:39 -070077 "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).
82librecovery_static_libs = [
83 "librecovery",
84 "librecovery_fastboot",
xunchang24788852019-03-22 16:08:52 -070085 "libinstall",
86 "librecovery_ui",
Tao Baoef5e38f2018-07-24 15:34:39 -070087 "libminui",
Tao Bao4a01f362019-04-26 23:41:49 -070088 "libfusesideload",
89 "libbootloader_message",
Tao Baoef5e38f2018-07-24 15:34:39 -070090 "libotautil",
91
92 "libhealthhalutils",
Tao Baoef5e38f2018-07-24 15:34:39 -070093 "libvintf",
94
95 "android.hardware.health@2.0",
96 "android.hardware.health@1.0",
Tao Baoef5e38f2018-07-24 15:34:39 -070097 "libext4_utils",
98 "libfs_mgr",
Tao Baoef5e38f2018-07-24 15:34:39 -070099 "libhidl-gen-utils",
100 "libhidlbase",
Yifan Hong0f339e22018-12-03 13:44:01 -0800101 "liblp",
Tao Baoef5e38f2018-07-24 15:34:39 -0700102 "libtinyxml2",
Tianjie Xucd8faf72019-08-06 12:32:05 -0700103 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -0700104]
105
Tianjie Xufa77ee82020-02-20 23:09:44 -0800106// recovery image for unittests.
107// ========================================================
108genrule {
109 name: "recovery_image",
Elliott Hughesda675a92023-06-20 16:36:41 -0700110 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | gzip) $(location testdata/recovery_tail) > $(out)",
Tianjie Xufa77ee82020-02-20 23:09:44 -0800111 srcs: [
112 "testdata/recovery_head",
113 "testdata/recovery_body",
114 "testdata/recovery_tail",
115 ],
Tianjie Xufa77ee82020-02-20 23:09:44 -0800116 out: [
117 "testdata/recovery.img",
118 ],
119}
120
Tao Baoef5e38f2018-07-24 15:34:39 -0700121cc_test {
122 name: "recovery_unit_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700123 isolated: true,
Tao Baodfb053e2019-09-19 08:08:54 -0700124 require_root: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700125
126 defaults: [
127 "recovery_test_defaults",
Tao Bao4a01f362019-04-26 23:41:49 -0700128 "libupdater_defaults",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700129 "libupdater_device_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700130 ],
131
132 test_suites: ["device-tests"],
133
Chih-Hung Hsiehaf6d7802022-02-17 22:03:12 -0800134 tidy_timeout_srcs: [
135 "unit/commands_test.cpp",
136 ],
137
Tao Baoef5e38f2018-07-24 15:34:39 -0700138 srcs: [
Tao Bao26b64542018-08-15 15:18:48 -0700139 "unit/*.cpp",
Tao Baoef5e38f2018-07-24 15:34:39 -0700140 ],
141
Yifan Hong67a8fd22021-11-30 16:39:00 -0800142 shared_libs: [
143 "libbinder_ndk",
144 ],
145
Tao Bao4a01f362019-04-26 23:41:49 -0700146 static_libs: libapplypatch_static_libs + librecovery_static_libs + [
Yifan Hong67a8fd22021-11-30 16:39:00 -0800147 "android.hardware.health-translate-ndk",
David Anderson8ee048d2023-11-17 20:30:02 -0800148 "android.hardware.health-V3-ndk",
Yifan Hong67a8fd22021-11-30 16:39:00 -0800149 "libhealthshim",
Tao Baoef5e38f2018-07-24 15:34:39 -0700150 "librecovery_ui",
xunchang311e6ca2019-03-22 08:54:35 -0700151 "libfusesideload",
Tao Baoef5e38f2018-07-24 15:34:39 -0700152 "libminui",
Tao Baoe3f09a72019-10-01 11:55:36 -0700153 "librecovery_utils",
Tao Baoef5e38f2018-07-24 15:34:39 -0700154 "libotautil",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700155 "libupdater_device",
156 "libupdater_core",
Tao Bao4a01f362019-04-26 23:41:49 -0700157 "libupdate_verifier",
158
Tao Bao4a01f362019-04-26 23:41:49 -0700159 "libprotobuf-cpp-lite",
Tao Baoef5e38f2018-07-24 15:34:39 -0700160 ],
Elliott Hughesa85d7a02021-04-20 11:58:05 -0700161 header_libs: [
162 "libgtest_prod_headers",
163 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700164
Tao Bao4a01f362019-04-26 23:41:49 -0700165 data: [
166 "testdata/*",
Tianjie Xufa77ee82020-02-20 23:09:44 -0800167 ":recovery_image",
Tao Bao4a01f362019-04-26 23:41:49 -0700168 ":res-testdata",
169 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700170}
171
172cc_test {
173 name: "recovery_manual_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700174 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700175
176 defaults: [
177 "recovery_test_defaults",
178 ],
179
180 test_suites: ["device-tests"],
181
182 srcs: [
183 "manual/recovery_test.cpp",
184 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700185}
186
Tao Baoef5e38f2018-07-24 15:34:39 -0700187cc_test_host {
188 name: "recovery_host_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700189 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700190
191 defaults: [
192 "recovery_test_defaults",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700193 "libupdater_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700194 ],
195
Chih-Hung Hsiehaf6d7802022-02-17 22:03:12 -0800196 tidy_timeout_srcs: [
197 "unit/host/imgdiff_test.cpp",
198 ],
199
Tao Baoef5e38f2018-07-24 15:34:39 -0700200 srcs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700201 "unit/host/*",
Tao Baoef5e38f2018-07-24 15:34:39 -0700202 ],
203
204 static_libs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700205 "libupdater_host",
206 "libupdater_core",
Tao Baoef5e38f2018-07-24 15:34:39 -0700207 "libimgdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700208 "libbsdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700209 "libdivsufsort64",
210 "libdivsufsort",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700211 "libfstab",
212 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -0700213 ],
214
Tao Bao83186dd2019-04-24 21:34:17 -0700215 test_suites: ["general-tests"],
Kelvin Zhang9ce95442022-08-04 10:05:43 -0700216 test_config: "RecoveryHostTest.xml",
Tao Bao83186dd2019-04-24 21:34:17 -0700217
Tao Baoef5e38f2018-07-24 15:34:39 -0700218 data: ["testdata/*"],
Andreas Huber435dfac2018-08-15 16:11:25 -0700219
220 target: {
221 darwin: {
Tianjie Xu45c40ec2019-07-02 15:09:24 -0700222 // libapplypatch in "libupdater_defaults" is not available on the Mac.
Andreas Huber435dfac2018-08-15 16:11:25 -0700223 enabled: false,
224 },
225 },
Tao Baoef5e38f2018-07-24 15:34:39 -0700226}
Will Costerde455702020-11-10 14:26:17 -0800227
228cc_fuzz {
229 name: "libinstall_verify_package_fuzzer",
230 defaults: [
231 "recovery_test_defaults",
232 ],
233
234 srcs: ["fuzz/verify_package_fuzzer.cpp"],
235
236 corpus: [
237 "testdata/otasigned*.zip",
238 ],
239
240 static_libs: [
241 "libotautil",
242 "libinstall",
243 "librecovery_ui",
244 "libminui",
245 ],
246}