xref: /aosp_15_r20/art/libnativebridge/tests/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker//
2*795d594fSAndroid Build Coastguard Worker// Copyright (C) 2017 The Android Open Source Project
3*795d594fSAndroid Build Coastguard Worker//
4*795d594fSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
5*795d594fSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
6*795d594fSAndroid Build Coastguard Worker// You may obtain a copy of the License at
7*795d594fSAndroid Build Coastguard Worker//
8*795d594fSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
9*795d594fSAndroid Build Coastguard Worker//
10*795d594fSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
11*795d594fSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
12*795d594fSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*795d594fSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
14*795d594fSAndroid Build Coastguard Worker// limitations under the License.
15*795d594fSAndroid Build Coastguard Worker//
16*795d594fSAndroid Build Coastguard Worker
17*795d594fSAndroid Build Coastguard Workerpackage {
18*795d594fSAndroid Build Coastguard Worker    // See: http://go/android-license-faq
19*795d594fSAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
20*795d594fSAndroid Build Coastguard Worker    // all of the 'license_kinds' from "art_license"
21*795d594fSAndroid Build Coastguard Worker    // to get the below license kinds:
22*795d594fSAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
23*795d594fSAndroid Build Coastguard Worker    default_applicable_licenses: ["art_license"],
24*795d594fSAndroid Build Coastguard Worker}
25*795d594fSAndroid Build Coastguard Worker
26*795d594fSAndroid Build Coastguard Workercc_defaults {
27*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge-test-case-defaults",
28*795d594fSAndroid Build Coastguard Worker    defaults: [
29*795d594fSAndroid Build Coastguard Worker        "art_defaults",
30*795d594fSAndroid Build Coastguard Worker        "art_test_common_defaults",
31*795d594fSAndroid Build Coastguard Worker    ],
32*795d594fSAndroid Build Coastguard Worker    host_supported: true,
33*795d594fSAndroid Build Coastguard Worker    // TODO(mast): Split up art_gtest_defaults so that it can be used for the
34*795d594fSAndroid Build Coastguard Worker    // following without pulling in lots of libs.
35*795d594fSAndroid Build Coastguard Worker    target: {
36*795d594fSAndroid Build Coastguard Worker        linux: {
37*795d594fSAndroid Build Coastguard Worker            cflags: [
38*795d594fSAndroid Build Coastguard Worker                // gtest issue
39*795d594fSAndroid Build Coastguard Worker                "-Wno-used-but-marked-unused",
40*795d594fSAndroid Build Coastguard Worker                "-Wno-deprecated",
41*795d594fSAndroid Build Coastguard Worker                "-Wno-missing-noreturn",
42*795d594fSAndroid Build Coastguard Worker            ],
43*795d594fSAndroid Build Coastguard Worker        },
44*795d594fSAndroid Build Coastguard Worker    },
45*795d594fSAndroid Build Coastguard Worker    header_libs: [
46*795d594fSAndroid Build Coastguard Worker        "jni_headers",
47*795d594fSAndroid Build Coastguard Worker        "libnativebridge-headers",
48*795d594fSAndroid Build Coastguard Worker    ],
49*795d594fSAndroid Build Coastguard Worker    cppflags: ["-fvisibility=protected"],
50*795d594fSAndroid Build Coastguard Worker}
51*795d594fSAndroid Build Coastguard Worker
52*795d594fSAndroid Build Coastguard Workercc_test_library {
53*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge-test-case",
54*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridgeTestCase.cpp"],
55*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
56*795d594fSAndroid Build Coastguard Worker}
57*795d594fSAndroid Build Coastguard Worker
58*795d594fSAndroid Build Coastguard Workercc_test_library {
59*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge2-test-case",
60*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridgeTestCase2.cpp"],
61*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
62*795d594fSAndroid Build Coastguard Worker}
63*795d594fSAndroid Build Coastguard Worker
64*795d594fSAndroid Build Coastguard Workercc_test_library {
65*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge3-test-case",
66*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridgeTestCase3.cpp"],
67*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
68*795d594fSAndroid Build Coastguard Worker}
69*795d594fSAndroid Build Coastguard Worker
70*795d594fSAndroid Build Coastguard Workercc_test_library {
71*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge6-test-case",
72*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridgeTestCase6.cpp"],
73*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
74*795d594fSAndroid Build Coastguard Worker    shared_libs: [
75*795d594fSAndroid Build Coastguard Worker        "libnativebridge6prezygotefork",
76*795d594fSAndroid Build Coastguard Worker    ],
77*795d594fSAndroid Build Coastguard Worker}
78*795d594fSAndroid Build Coastguard Worker
79*795d594fSAndroid Build Coastguard Workercc_test_library {
80*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge7-test-case",
81*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridgeTestCase7.cpp"],
82*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
83*795d594fSAndroid Build Coastguard Worker    shared_libs: [
84*795d594fSAndroid Build Coastguard Worker        "libnativebridge7criticalnative",
85*795d594fSAndroid Build Coastguard Worker    ],
86*795d594fSAndroid Build Coastguard Worker}
87*795d594fSAndroid Build Coastguard Worker
88*795d594fSAndroid Build Coastguard Worker// A helper library to produce test-case side effect of PreZygoteForkNativeBridge.
89*795d594fSAndroid Build Coastguard Workercc_test_library {
90*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge6prezygotefork",
91*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridge6PreZygoteFork_lib.cpp"],
92*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
93*795d594fSAndroid Build Coastguard Worker}
94*795d594fSAndroid Build Coastguard Worker
95*795d594fSAndroid Build Coastguard Workercc_test_library {
96*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge7criticalnative",
97*795d594fSAndroid Build Coastguard Worker    srcs: ["NativeBridge7CriticalNative_lib.cpp"],
98*795d594fSAndroid Build Coastguard Worker    defaults: ["libnativebridge-test-case-defaults"],
99*795d594fSAndroid Build Coastguard Worker}
100*795d594fSAndroid Build Coastguard Worker
101*795d594fSAndroid Build Coastguard Workercc_test {
102*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge-tests",
103*795d594fSAndroid Build Coastguard Worker    defaults: [
104*795d594fSAndroid Build Coastguard Worker        "art_defaults",
105*795d594fSAndroid Build Coastguard Worker        "art_standalone_test_defaults",
106*795d594fSAndroid Build Coastguard Worker    ],
107*795d594fSAndroid Build Coastguard Worker
108*795d594fSAndroid Build Coastguard Worker    isolated: true,
109*795d594fSAndroid Build Coastguard Worker
110*795d594fSAndroid Build Coastguard Worker    srcs: [
111*795d594fSAndroid Build Coastguard Worker        "NativeBridgeTest.cpp",
112*795d594fSAndroid Build Coastguard Worker        "NativeBridgeApi.c",
113*795d594fSAndroid Build Coastguard Worker        "CodeCacheCreate_test.cpp",
114*795d594fSAndroid Build Coastguard Worker        "CodeCacheExists_test.cpp",
115*795d594fSAndroid Build Coastguard Worker        "CodeCacheStatFail_test.cpp",
116*795d594fSAndroid Build Coastguard Worker        "CompleteFlow_test.cpp",
117*795d594fSAndroid Build Coastguard Worker        "InvalidCharsNativeBridge_test.cpp",
118*795d594fSAndroid Build Coastguard Worker        "NativeBridge2Signal_test.cpp",
119*795d594fSAndroid Build Coastguard Worker        "NativeBridgeVersion_test.cpp",
120*795d594fSAndroid Build Coastguard Worker        "NeedsNativeBridge_test.cpp",
121*795d594fSAndroid Build Coastguard Worker        "PreInitializeNativeBridge_test.cpp",
122*795d594fSAndroid Build Coastguard Worker        "PreInitializeNativeBridgeFail2_test.cpp",
123*795d594fSAndroid Build Coastguard Worker        "ReSetupNativeBridge_test.cpp",
124*795d594fSAndroid Build Coastguard Worker        "UnavailableNativeBridge_test.cpp",
125*795d594fSAndroid Build Coastguard Worker        "ValidNameNativeBridge_test.cpp",
126*795d594fSAndroid Build Coastguard Worker        "NativeBridge3UnloadLibrary_test.cpp",
127*795d594fSAndroid Build Coastguard Worker        "NativeBridge3GetError_test.cpp",
128*795d594fSAndroid Build Coastguard Worker        "NativeBridge3IsPathSupported_test.cpp",
129*795d594fSAndroid Build Coastguard Worker        "NativeBridge3CreateNamespace_test.cpp",
130*795d594fSAndroid Build Coastguard Worker        "NativeBridge3LoadLibraryExt_test.cpp",
131*795d594fSAndroid Build Coastguard Worker        "NativeBridge6PreZygoteFork_test.cpp",
132*795d594fSAndroid Build Coastguard Worker        "NativeBridge7CriticalNative_test.cpp",
133*795d594fSAndroid Build Coastguard Worker    ],
134*795d594fSAndroid Build Coastguard Worker
135*795d594fSAndroid Build Coastguard Worker    static_libs: [
136*795d594fSAndroid Build Coastguard Worker        "libbase",
137*795d594fSAndroid Build Coastguard Worker        "libnativebridge",
138*795d594fSAndroid Build Coastguard Worker    ],
139*795d594fSAndroid Build Coastguard Worker    shared_libs: [
140*795d594fSAndroid Build Coastguard Worker        "liblog",
141*795d594fSAndroid Build Coastguard Worker        "libnativebridge6prezygotefork",
142*795d594fSAndroid Build Coastguard Worker        "libnativebridge7criticalnative",
143*795d594fSAndroid Build Coastguard Worker    ],
144*795d594fSAndroid Build Coastguard Worker    data_libs: [
145*795d594fSAndroid Build Coastguard Worker        "libnativebridge6prezygotefork",
146*795d594fSAndroid Build Coastguard Worker        "libnativebridge7criticalnative",
147*795d594fSAndroid Build Coastguard Worker
148*795d594fSAndroid Build Coastguard Worker        // These are dlopen'd by libnativebridge, not libnativebridge-tests, but
149*795d594fSAndroid Build Coastguard Worker        // the former is statically linked into the latter, so the linker will
150*795d594fSAndroid Build Coastguard Worker        // find them next to the test binary.
151*795d594fSAndroid Build Coastguard Worker        "libnativebridge-test-case",
152*795d594fSAndroid Build Coastguard Worker        "libnativebridge2-test-case",
153*795d594fSAndroid Build Coastguard Worker        "libnativebridge3-test-case",
154*795d594fSAndroid Build Coastguard Worker        "libnativebridge6-test-case",
155*795d594fSAndroid Build Coastguard Worker        "libnativebridge7-test-case",
156*795d594fSAndroid Build Coastguard Worker    ],
157*795d594fSAndroid Build Coastguard Worker
158*795d594fSAndroid Build Coastguard Worker    target: {
159*795d594fSAndroid Build Coastguard Worker        linux: {
160*795d594fSAndroid Build Coastguard Worker            cflags: [
161*795d594fSAndroid Build Coastguard Worker                // gtest issue
162*795d594fSAndroid Build Coastguard Worker                "-Wno-used-but-marked-unused",
163*795d594fSAndroid Build Coastguard Worker                "-Wno-deprecated",
164*795d594fSAndroid Build Coastguard Worker                "-Wno-missing-noreturn",
165*795d594fSAndroid Build Coastguard Worker            ],
166*795d594fSAndroid Build Coastguard Worker        },
167*795d594fSAndroid Build Coastguard Worker        android: {
168*795d594fSAndroid Build Coastguard Worker            shared_libs: ["libdl_android"], // libnativebridge dependency
169*795d594fSAndroid Build Coastguard Worker        },
170*795d594fSAndroid Build Coastguard Worker    },
171*795d594fSAndroid Build Coastguard Worker
172*795d594fSAndroid Build Coastguard Worker    test_suites: [
173*795d594fSAndroid Build Coastguard Worker        "general-tests",
174*795d594fSAndroid Build Coastguard Worker    ],
175*795d594fSAndroid Build Coastguard Worker}
176*795d594fSAndroid Build Coastguard Worker
177*795d594fSAndroid Build Coastguard Worker// Very basic tests in CTS/MCTS to verify backed-by API coverage of the exported
178*795d594fSAndroid Build Coastguard Worker// API in libnativebridge.map.txt.
179*795d594fSAndroid Build Coastguard Workercc_test {
180*795d594fSAndroid Build Coastguard Worker    name: "art_libnativebridge_cts_tests",
181*795d594fSAndroid Build Coastguard Worker    defaults: ["art_standalone_test_defaults"],
182*795d594fSAndroid Build Coastguard Worker    shared_libs: ["libnativebridge"],
183*795d594fSAndroid Build Coastguard Worker    static_libs: ["libbase"],
184*795d594fSAndroid Build Coastguard Worker    srcs: ["libnativebridge_api_test.cpp"],
185*795d594fSAndroid Build Coastguard Worker    test_config_template: ":art-gtests-target-standalone-cts-template",
186*795d594fSAndroid Build Coastguard Worker    test_suites: [
187*795d594fSAndroid Build Coastguard Worker        "cts",
188*795d594fSAndroid Build Coastguard Worker        "general-tests",
189*795d594fSAndroid Build Coastguard Worker        "mts-art",
190*795d594fSAndroid Build Coastguard Worker        "mcts-art",
191*795d594fSAndroid Build Coastguard Worker    ],
192*795d594fSAndroid Build Coastguard Worker}
193*795d594fSAndroid Build Coastguard Worker
194*795d594fSAndroid Build Coastguard Workercc_test {
195*795d594fSAndroid Build Coastguard Worker    name: "libnativebridge-lazy-tests",
196*795d594fSAndroid Build Coastguard Worker    defaults: ["art_standalone_test_defaults"],
197*795d594fSAndroid Build Coastguard Worker    static_libs: [
198*795d594fSAndroid Build Coastguard Worker        "libbase",
199*795d594fSAndroid Build Coastguard Worker    ],
200*795d594fSAndroid Build Coastguard Worker    shared_libs: ["libnativebridge_lazy"],
201*795d594fSAndroid Build Coastguard Worker    data_libs: ["libnativebridge_lazy"],
202*795d594fSAndroid Build Coastguard Worker    srcs: ["libnativebridge_api_test.cpp"],
203*795d594fSAndroid Build Coastguard Worker    test_suites: [
204*795d594fSAndroid Build Coastguard Worker        "general-tests",
205*795d594fSAndroid Build Coastguard Worker        "mts-art",
206*795d594fSAndroid Build Coastguard Worker    ],
207*795d594fSAndroid Build Coastguard Worker}
208