blob: a9a088a326a75fe6aa9e1c239a337d07303eaf47 [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",
34 "libz",
35 "libziparchive",
36 ],
37
38 target: {
39 android: {
40 shared_libs: [
41 "libutils",
Peter Collingbourne8f2f0d02019-12-17 17:51:42 -080042 "libvndksupport",
Tao Baoef5e38f2018-07-24 15:34:39 -070043 ],
44 },
45
46 host: {
47 static_libs: [
48 "libutils",
49 ],
Jayant Chowdharyd24b0542018-10-01 22:55:56 +000050 },
Tao Baoef5e38f2018-07-24 15:34:39 -070051 },
52}
53
Tianjie Xu45c40ec2019-07-02 15:09:24 -070054// libapplypatch, libapplypatch_modes
Tao Baoef5e38f2018-07-24 15:34:39 -070055libapplypatch_static_libs = [
56 "libapplypatch_modes",
57 "libapplypatch",
58 "libedify",
Tao Baoef5e38f2018-07-24 15:34:39 -070059 "libotautil",
60 "libbsdiff",
61 "libbspatch",
62 "libdivsufsort",
63 "libdivsufsort64",
64 "libutils",
65 "libbase",
66 "libbrotli",
67 "libbz",
Tao Baoef5e38f2018-07-24 15:34:39 -070068 "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).
74librecovery_static_libs = [
75 "librecovery",
76 "librecovery_fastboot",
xunchang24788852019-03-22 16:08:52 -070077 "libinstall",
78 "librecovery_ui",
Tao Baoef5e38f2018-07-24 15:34:39 -070079 "libminui",
Tao Bao4a01f362019-04-26 23:41:49 -070080 "libfusesideload",
81 "libbootloader_message",
Tao Baoef5e38f2018-07-24 15:34:39 -070082 "libotautil",
83
84 "libhealthhalutils",
Tao Baoef5e38f2018-07-24 15:34:39 -070085 "libvintf",
86
87 "android.hardware.health@2.0",
88 "android.hardware.health@1.0",
Tao Baoef5e38f2018-07-24 15:34:39 -070089 "libext4_utils",
90 "libfs_mgr",
Tao Baoef5e38f2018-07-24 15:34:39 -070091 "libhidl-gen-utils",
92 "libhidlbase",
Yifan Hong0f339e22018-12-03 13:44:01 -080093 "liblp",
Tao Baoef5e38f2018-07-24 15:34:39 -070094 "libtinyxml2",
Tianjie Xucd8faf72019-08-06 12:32:05 -070095 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -070096]
97
Tianjie Xufa77ee82020-02-20 23:09:44 -080098// recovery image for unittests.
99// ========================================================
100genrule {
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 Baoef5e38f2018-07-24 15:34:39 -0700116cc_test {
117 name: "recovery_unit_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700118 isolated: true,
Tao Baodfb053e2019-09-19 08:08:54 -0700119 require_root: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700120
121 defaults: [
122 "recovery_test_defaults",
Tao Bao4a01f362019-04-26 23:41:49 -0700123 "libupdater_defaults",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700124 "libupdater_device_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700125 ],
126
127 test_suites: ["device-tests"],
128
129 srcs: [
Tao Bao26b64542018-08-15 15:18:48 -0700130 "unit/*.cpp",
Tao Baoef5e38f2018-07-24 15:34:39 -0700131 ],
132
Tao Bao4a01f362019-04-26 23:41:49 -0700133 static_libs: libapplypatch_static_libs + librecovery_static_libs + [
Tao Baoef5e38f2018-07-24 15:34:39 -0700134 "librecovery_ui",
xunchang311e6ca2019-03-22 08:54:35 -0700135 "libfusesideload",
Tao Baoef5e38f2018-07-24 15:34:39 -0700136 "libminui",
Tao Baoe3f09a72019-10-01 11:55:36 -0700137 "librecovery_utils",
Tao Baoef5e38f2018-07-24 15:34:39 -0700138 "libotautil",
Tianjie Xuc1a5e262019-05-22 14:34:12 -0700139 "libupdater_device",
140 "libupdater_core",
Tao Bao4a01f362019-04-26 23:41:49 -0700141 "libupdate_verifier",
142
Tao Baoef5e38f2018-07-24 15:34:39 -0700143 "libgtest_prod",
Tao Bao4a01f362019-04-26 23:41:49 -0700144 "libprotobuf-cpp-lite",
Tao Baoef5e38f2018-07-24 15:34:39 -0700145 ],
146
Tao Bao4a01f362019-04-26 23:41:49 -0700147 data: [
148 "testdata/*",
Tianjie Xufa77ee82020-02-20 23:09:44 -0800149 ":recovery_image",
Tao Bao4a01f362019-04-26 23:41:49 -0700150 ":res-testdata",
151 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700152}
153
154cc_test {
155 name: "recovery_manual_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700156 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700157
158 defaults: [
159 "recovery_test_defaults",
160 ],
161
162 test_suites: ["device-tests"],
163
164 srcs: [
165 "manual/recovery_test.cpp",
166 ],
Tao Baoef5e38f2018-07-24 15:34:39 -0700167}
168
Tao Baoef5e38f2018-07-24 15:34:39 -0700169cc_test_host {
170 name: "recovery_host_test",
Christopher Ferris272467d2018-08-22 19:38:49 -0700171 isolated: true,
Tao Baoef5e38f2018-07-24 15:34:39 -0700172
173 defaults: [
174 "recovery_test_defaults",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700175 "libupdater_defaults",
Tao Baoef5e38f2018-07-24 15:34:39 -0700176 ],
177
178 srcs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700179 "unit/host/*",
Tao Baoef5e38f2018-07-24 15:34:39 -0700180 ],
181
182 static_libs: [
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700183 "libupdater_host",
184 "libupdater_core",
Tao Baoef5e38f2018-07-24 15:34:39 -0700185 "libimgdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700186 "libbsdiff",
Tao Baoef5e38f2018-07-24 15:34:39 -0700187 "libdivsufsort64",
188 "libdivsufsort",
Tianjie Xuc3a161e2019-06-20 18:16:49 -0700189 "libfstab",
190 "libc++fs",
Tao Baoef5e38f2018-07-24 15:34:39 -0700191 ],
192
Tao Bao83186dd2019-04-24 21:34:17 -0700193 test_suites: ["general-tests"],
194
Tao Baoef5e38f2018-07-24 15:34:39 -0700195 data: ["testdata/*"],
Andreas Huber435dfac2018-08-15 16:11:25 -0700196
197 target: {
198 darwin: {
Tianjie Xu45c40ec2019-07-02 15:09:24 -0700199 // libapplypatch in "libupdater_defaults" is not available on the Mac.
Andreas Huber435dfac2018-08-15 16:11:25 -0700200 enabled: false,
201 },
202 },
Tao Baoef5e38f2018-07-24 15:34:39 -0700203}