xref: /aosp_15_r20/bootable/recovery/tests/Android.bp (revision e7c364b630b241adcb6c7726a21055250b91fdac)
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
15package {
16    default_team: "trendy_team_android_kernel",
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "bootable_recovery_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["bootable_recovery_license"],
23}
24
25cc_defaults {
26    name: "recovery_test_defaults",
27
28    defaults: [
29        "recovery_defaults",
30    ],
31
32    include_dirs: [
33        "bootable/recovery",
34    ],
35
36    shared_libs: [
37        "libbase",
38        "libcrypto",
39        "libcutils",
40        "liblog",
41        "libpng",
42        "libprocessgroup",
43        "libselinux",
44        "libziparchive",
45    ],
46
47    target: {
48        android: {
49            shared_libs: [
50                "libutils",
51                "libvndksupport",
52            ],
53        },
54
55        host: {
56            static_libs: [
57                "libutils",
58            ],
59        },
60    },
61}
62
63// librecovery_defaults uses many shared libs that we want to avoid using in tests (e.g. we don't
64// have 32-bit [email protected] or libbootloader_message.so on marlin).
65librecovery_static_libs = [
66    "librecovery",
67    "librecovery_fastboot",
68    "libinstall",
69    "librecovery_ui",
70    "libminui",
71    "libfusesideload",
72    "libbootloader_message",
73    "libotautil",
74
75    "libhealthhalutils",
76    "libvintf",
77
78    "[email protected]",
79    "[email protected]",
80    "libext4_utils",
81    "libfs_mgr",
82    "libhidl-gen-utils",
83    "libhidlbase",
84    "liblp",
85    "libtinyxml2",
86]
87
88// recovery image for unittests.
89// ========================================================
90genrule {
91    name: "recovery_image",
92    cmd: "cat $(location testdata/recovery_head) <(cat $(location testdata/recovery_body) | gzip) $(location testdata/recovery_tail) > $(out)",
93    srcs: [
94        "testdata/recovery_head",
95        "testdata/recovery_body",
96        "testdata/recovery_tail",
97    ],
98    out: [
99        "testdata/recovery.img",
100    ],
101}
102
103cc_test {
104    name: "recovery_unit_test",
105    isolated: true,
106    require_root: true,
107
108    defaults: [
109        "recovery_test_defaults",
110    ],
111
112    test_suites: ["device-tests"],
113
114    srcs: [
115        "unit/*.cpp",
116    ],
117
118    shared_libs: [
119        "libbinder_ndk",
120    ],
121
122    static_libs: librecovery_static_libs + [
123        "android.hardware.health-translate-ndk",
124        "android.hardware.health-V4-ndk",
125        "libhealthshim",
126        "librecovery_ui",
127        "libfusesideload",
128        "libminui",
129        "librecovery_utils",
130        "libotautil",
131        "libupdate_verifier",
132
133        "libprotobuf-cpp-lite",
134    ],
135    header_libs: [
136        "libgtest_prod_headers",
137    ],
138
139    data: [
140        "testdata/*",
141        ":recovery_image",
142        ":res-testdata",
143    ],
144}
145
146cc_test {
147    name: "recovery_manual_test",
148    isolated: true,
149
150    defaults: [
151        "recovery_test_defaults",
152    ],
153
154    test_suites: ["device-tests"],
155
156    srcs: [
157        "manual/recovery_test.cpp",
158    ],
159}
160
161cc_fuzz {
162    name: "libinstall_verify_package_fuzzer",
163    defaults: [
164        "recovery_test_defaults",
165    ],
166
167    srcs: ["fuzz/verify_package_fuzzer.cpp"],
168
169    corpus: [
170        "testdata/otasigned*.zip",
171    ],
172
173    static_libs: [
174        "libotautil",
175        "libinstall",
176        "librecovery_ui",
177        "libminui",
178    ],
179}
180