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
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",
32        "libprocessgroup",
33        "libselinux",
34        "libz",
35        "libziparchive",
36    ],
37
38    target: {
39        android: {
40            shared_libs: [
41                "libutils",
42                "libvndksupport",
43            ],
44        },
45
46        host: {
47            static_libs: [
48                "libutils",
49            ],
50        },
51    },
52}
53
54// libapplypatch, libapplypatch_modes
55libapplypatch_static_libs = [
56    "libapplypatch_modes",
57    "libapplypatch",
58    "libedify",
59    "libotautil",
60    "libbsdiff",
61    "libbspatch",
62    "libdivsufsort",
63    "libdivsufsort64",
64    "libutils",
65    "libbase",
66    "libbrotli",
67    "libbz",
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).
74librecovery_static_libs = [
75    "librecovery",
76    "librecovery_fastboot",
77    "libinstall",
78    "librecovery_ui",
79    "libminui",
80    "libfusesideload",
81    "libbootloader_message",
82    "libotautil",
83
84    "libhealthhalutils",
85    "libvintf",
86
87    "android.hardware.health@2.0",
88    "android.hardware.health@1.0",
89    "libext4_utils",
90    "libfs_mgr",
91    "libhidl-gen-utils",
92    "libhidlbase",
93    "liblp",
94    "libtinyxml2",
95    "libc++fs",
96]
97
98cc_test {
99    name: "recovery_unit_test",
100    isolated: true,
101    require_root: true,
102
103    defaults: [
104        "recovery_test_defaults",
105        "libupdater_defaults",
106        "libupdater_device_defaults",
107    ],
108
109    test_suites: ["device-tests"],
110
111    srcs: [
112        "unit/*.cpp",
113    ],
114
115    static_libs: libapplypatch_static_libs + librecovery_static_libs + [
116        "librecovery_ui",
117        "libfusesideload",
118        "libminui",
119        "librecovery_utils",
120        "libotautil",
121        "libupdater_device",
122        "libupdater_core",
123        "libupdate_verifier",
124
125        "libgtest_prod",
126        "libprotobuf-cpp-lite",
127    ],
128
129    data: [
130        "testdata/*",
131        ":res-testdata",
132    ],
133}
134
135cc_test {
136    name: "recovery_manual_test",
137    isolated: true,
138
139    defaults: [
140        "recovery_test_defaults",
141    ],
142
143    test_suites: ["device-tests"],
144
145    srcs: [
146        "manual/recovery_test.cpp",
147    ],
148}
149
150cc_test_host {
151    name: "recovery_host_test",
152    isolated: true,
153
154    defaults: [
155        "recovery_test_defaults",
156        "libupdater_defaults",
157    ],
158
159    srcs: [
160        "unit/host/*",
161    ],
162
163    static_libs: [
164        "libupdater_host",
165        "libupdater_core",
166        "libimgdiff",
167        "libbsdiff",
168        "libdivsufsort64",
169        "libdivsufsort",
170        "libfstab",
171        "libc++fs",
172    ],
173
174    test_suites: ["general-tests"],
175
176    data: ["testdata/*"],
177
178    target: {
179        darwin: {
180            // libapplypatch in "libupdater_defaults" is not available on the Mac.
181            enabled: false,
182        },
183    },
184}
185