blob: d2179e494780ce32e508befa4e9250dddf3eae81 [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
15cc_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 Baghdasaryan0ca607c2019-01-25 05:33:42 +000032 "libprocessgroup",
Tao Baoef5e38f2018-07-24 15:34:39 -070033 "libselinux",
Tao Baoef5e38f2018-07-24 15:34:39 -070034 "libziparchive",
35 ],
36
37 target: {
38 android: {
39 shared_libs: [
40 "libutils",
Peter Collingbourne8f2f0d02019-12-17 17:51:42 -080041 "libvndksupport",
Tao Baoef5e38f2018-07-24 15:34:39 -070042 ],
43 },
44
45 host: {
46 static_libs: [
47 "libutils",
48 ],
Jayant Chowdharyd24b0542018-10-01 22:55:56 +000049 },
Tao Baoef5e38f2018-07-24 15:34:39 -070050 },
51}
52
Tianjie Xu45c40ec2019-07-02 15:09:24 -070053// libapplypatch, libapplypatch_modes
Tao Baoef5e38f2018-07-24 15:34:39 -070054libapplypatch_static_libs = [
55 "libapplypatch_modes",
56 "libapplypatch",
57 "libedify",
Tao Baoef5e38f2018-07-24 15:34:39 -070058 "libotautil",
59 "libbsdiff",
60 "libbspatch",
61 "libdivsufsort",
62 "libdivsufsort64",
63 "libutils",
64 "libbase",
65 "libbrotli",
66 "libbz",
Kelvin Zhang2f2749f2021-01-12 14:42:56 -050067 "libz_stable",
Tao Baoef5e38f2018-07-24 15:34:39 -070068 "libziparchive",
69]
70
71// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't
72// have 32-bit android.hardware.health@2.0.so or libbootloader_message.so on marlin).
73librecovery_static_libs = [
74 "librecovery",
75 "librecovery_fastboot",
xunchang24788852019-03-22 16:08:52 -070076 "libinstall",
77 "librecovery_ui",
Tao Baoef5e38f2018-07-24 15:34:39 -070078 "libminui",
Tao Bao4a01f362019-04-26 23:41:49 -070079 "libfusesideload",
80 "libbootloader_message",
Tao Baoef5e38f2018-07-24 15:34:39 -070081 "libotautil",
82
83 "libhealthhalutils",
Tao Baoef5e38f2018-07-24 15:34:39 -070084 "libvintf",
85
86 "android.hardware.health@2.0",
87 "android.hardware.health@1.0",
Tao Baoef5e38f2018-07-24 15:34:39 -070088 "libext4_utils",
89 "libfs_mgr",
Tao Baoef5e38f2018-07-24 15:34:39 -070090 "libhidl-gen-utils",
91 "libhidlbase",
Yifan Hong0f339e22018-12-03 13:44:01 -080092 "liblp",
Tao Baoef5e38f2018-07-24 15:34:39 -070093 "libtinyxml2",
Tianjie Xucd8faf72019-08-06 12:32:05 -070094 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -070095]
96
Tianjie Xufa77ee82020-02-20 23:09:44 -080097// recovery image for unittests.
98// ========================================================
99genrule {
100 name: "recovery_image",
101 cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | $(location minigzip)) $(location testdata/recovery_tail) > $(out)",
102 srcs: [
103 "testdata/recovery_head",
104 "testdata/recovery_body",
105 "testdata/recovery_tail",
106 ],
107 tools: [
108 "minigzip",
109 ],
110 out: [
111 "testdata/recovery.img",
112 ],
113}
114
Tao Baoef5e38f2018-07-24 15:34:39 -0700115cc_test {
116 name: "recovery_unit_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700117 isolated: true,
Tao Baodfb053e2019-09-19 08:08:54 -0700118 require_root: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700119
120 defaults: [
121 "recovery_test_defaults",
Tao Bao4a01f362019-04-26 23:41:49 -0700122 "libupdater_defaults",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700123 "libupdater_device_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700124 ],
125
126 test_suites: ["device-tests"],
127
128 srcs: [
Tao Bao26b64542018-08-15 15:18:48 -0700129 "unit/*.cpp",
Tao Baoef5e38f2018-07-24 15:34:39 -0700130 ],
131
Tao Bao4a01f362019-04-26 23:41:49 -0700132 static_libs: libapplypatch_static_libs + librecovery_static_libs + [
Tao Baoef5e38f2018-07-24 15:34:39 -0700133 "librecovery_ui",
xunchang311e6ca2019-03-22 08:54:35 -0700134 "libfusesideload",
Tao Baoef5e38f2018-07-24 15:34:39 -0700135 "libminui",
Tao Baoe3f09a72019-10-01 11:55:36 -0700136 "librecovery_utils",
Tao Baoef5e38f2018-07-24 15:34:39 -0700137 "libotautil",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700138 "libupdater_device",
139 "libupdater_core",
Tao Bao4a01f362019-04-26 23:41:49 -0700140 "libupdate_verifier",
141
Tao Baoef5e38f2018-07-24 15:34:39 -0700142 "libgtest_prod",
Tao Bao4a01f362019-04-26 23:41:49 -0700143 "libprotobuf-cpp-lite",
Tao Baoef5e38f2018-07-24 15:34:39 -0700144 ],
145
Tao Bao4a01f362019-04-26 23:41:49 -0700146 data: [
147 "testdata/*",
Tianjie Xufa77ee82020-02-20 23:09:44 -0800148 ":recovery_image",
Tao Bao4a01f362019-04-26 23:41:49 -0700149 ":res-testdata",
150 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700151}
152
153cc_test {
154 name: "recovery_manual_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700155 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700156
157 defaults: [
158 "recovery_test_defaults",
159 ],
160
161 test_suites: ["device-tests"],
162
163 srcs: [
164 "manual/recovery_test.cpp",
165 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700166}
167
Tao Baoef5e38f2018-07-24 15:34:39 -0700168cc_test_host {
169 name: "recovery_host_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700170 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700171
172 defaults: [
173 "recovery_test_defaults",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700174 "libupdater_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700175 ],
176
177 srcs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700178 "unit/host/*",
Tao Baoef5e38f2018-07-24 15:34:39 -0700179 ],
180
181 static_libs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700182 "libupdater_host",
183 "libupdater_core",
Tao Baoef5e38f2018-07-24 15:34:39 -0700184 "libimgdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700185 "libbsdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700186 "libdivsufsort64",
187 "libdivsufsort",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700188 "libfstab",
189 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -0700190 ],
191
Tao Bao83186dd2019-04-24 21:34:17 -0700192 test_suites: ["general-tests"],
193
Tao Baoef5e38f2018-07-24 15:34:39 -0700194 data: ["testdata/*"],
Andreas Huber435dfac2018-08-15 16:11:25 -0700195
196 target: {
197 darwin: {
Tianjie Xu45c40ec2019-07-02 15:09:24 -0700198 // libapplypatch in "libupdater_defaults" is not available on the Mac.
Andreas Huber435dfac2018-08-15 16:11:25 -0700199 enabled: false,
200 },
201 },
Tao Baoef5e38f2018-07-24 15:34:39 -0700202}
Will Costerde455702020-11-10 14:26:17 -0800203
204cc_fuzz {
205 name: "libinstall_verify_package_fuzzer",
206 defaults: [
207 "recovery_test_defaults",
208 ],
209
210 srcs: ["fuzz/verify_package_fuzzer.cpp"],
211
212 corpus: [
213 "testdata/otasigned*.zip",
214 ],
215
216 static_libs: [
217 "libotautil",
218 "libinstall",
219 "librecovery_ui",
220 "libminui",
221 ],
222}