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