blob: 603f97a82442ace007f1c7e04e06d187acb4f44a [file] [log] [blame]
Orion Hodson9b16e342019-10-09 13:29:16 +01001//
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
Bob Badour9150de62021-02-26 03:22:24 -080017package {
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
Orion Hodson9b16e342019-10-09 13:29:16 +010026cc_defaults {
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010027 name: "libnativebridge-test-case-defaults",
Martin Stjernholm2a21cc62019-10-22 12:14:20 +010028 defaults: [
29 "art_defaults",
30 "art_test_defaults",
Orion Hodson9b16e342019-10-09 13:29:16 +010031 ],
Martin Stjernholm2a21cc62019-10-22 12:14:20 +010032 // TODO(mast): Split up art_gtest_defaults so that it can be used for the
33 // following without pulling in lots of libs.
34 target: {
35 linux: {
36 cflags: [
37 // gtest issue
38 "-Wno-used-but-marked-unused",
39 "-Wno-deprecated",
40 "-Wno-missing-noreturn",
41 ],
42 },
43 },
Orion Hodson00cb81d2020-04-03 06:47:07 +010044 header_libs: [
45 "jni_headers",
46 "libnativebridge-headers",
47 ],
Orion Hodson9b16e342019-10-09 13:29:16 +010048 cppflags: ["-fvisibility=protected"],
49}
50
Martin Stjernholmd90291b2021-05-27 20:54:22 +010051cc_test_library {
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010052 name: "libnativebridge-test-case",
53 srcs: ["NativeBridgeTestCase.cpp"],
54 defaults: ["libnativebridge-test-case-defaults"],
Orion Hodson9b16e342019-10-09 13:29:16 +010055}
56
Martin Stjernholmd90291b2021-05-27 20:54:22 +010057cc_test_library {
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010058 name: "libnativebridge2-test-case",
59 srcs: ["NativeBridgeTestCase2.cpp"],
60 defaults: ["libnativebridge-test-case-defaults"],
Orion Hodson9b16e342019-10-09 13:29:16 +010061}
62
Martin Stjernholmd90291b2021-05-27 20:54:22 +010063cc_test_library {
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010064 name: "libnativebridge3-test-case",
65 srcs: ["NativeBridgeTestCase3.cpp"],
66 defaults: ["libnativebridge-test-case-defaults"],
Orion Hodson9b16e342019-10-09 13:29:16 +010067}
68
Martin Stjernholmd90291b2021-05-27 20:54:22 +010069cc_test_library {
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010070 name: "libnativebridge6-test-case",
71 srcs: ["NativeBridgeTestCase6.cpp"],
72 defaults: ["libnativebridge-test-case-defaults"],
Lev Rumyantsevabafbe72019-12-13 15:49:37 -080073 shared_libs: [
74 "libnativebridge6prezygotefork",
75 ],
76}
77
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010078// A helper library to produce test-case side effect of PreZygoteForkNativeBridge.
Martin Stjernholmd90291b2021-05-27 20:54:22 +010079cc_test_library {
Lev Rumyantsevabafbe72019-12-13 15:49:37 -080080 name: "libnativebridge6prezygotefork",
81 srcs: ["NativeBridge6PreZygoteFork_lib.cpp"],
Orion Hodsond1ccdfa2020-07-27 14:12:46 +010082 defaults: ["libnativebridge-test-case-defaults"],
Lev Rumyantsevabafbe72019-12-13 15:49:37 -080083}
84
Orion Hodson9b16e342019-10-09 13:29:16 +010085cc_defaults {
86 name: "libnativebridge-tests-defaults",
Martin Stjernholm2a21cc62019-10-22 12:14:20 +010087 defaults: [
88 "art_defaults",
89 "art_test_defaults",
Orion Hodson9b16e342019-10-09 13:29:16 +010090 ],
Martin Stjernholm2a21cc62019-10-22 12:14:20 +010091 // TODO(mast): Split up art_gtest_defaults so that it can be used for the
92 // following without pulling in lots of libs.
93 target: {
94 linux: {
95 cflags: [
96 // gtest issue
97 "-Wno-used-but-marked-unused",
98 "-Wno-deprecated",
99 "-Wno-missing-noreturn",
100 ],
101 },
102 },
Martin Stjernholm19d1feb2021-03-30 22:35:24 +0100103}
104
105cc_test {
106 name: "libnativebridge-tests",
107 defaults: ["libnativebridge-tests-defaults"],
Orion Hodson9b16e342019-10-09 13:29:16 +0100108
Martin Stjernholmd90291b2021-05-27 20:54:22 +0100109 // native_bridge.cc doesn't support reloading the native bridge after
110 // unloading, so each test needs to be its own process.
111 test_per_src: true,
112
Roland Levillainccf4f912022-08-04 19:23:37 +0100113 // Disable pre-submit host unit-testing for this test module, as
114 // it is not compatible with TradeFed (because of the use of the
115 // `test_per_src` feature above) and meant to be executed with the
116 // `runtests.sh` script instead.
117 test_options: {
118 unit_test: false,
119 },
120
Orion Hodson9b16e342019-10-09 13:29:16 +0100121 srcs: [
Martin Stjernholm6034c072021-06-02 00:35:39 +0100122 "NativeBridgeApi.c",
Orion Hodson9b16e342019-10-09 13:29:16 +0100123 "CodeCacheCreate_test.cpp",
124 "CodeCacheExists_test.cpp",
125 "CodeCacheStatFail_test.cpp",
126 "CompleteFlow_test.cpp",
127 "InvalidCharsNativeBridge_test.cpp",
128 "NativeBridge2Signal_test.cpp",
129 "NativeBridgeVersion_test.cpp",
130 "NeedsNativeBridge_test.cpp",
131 "PreInitializeNativeBridge_test.cpp",
Orion Hodson9b16e342019-10-09 13:29:16 +0100132 "PreInitializeNativeBridgeFail2_test.cpp",
133 "ReSetupNativeBridge_test.cpp",
134 "UnavailableNativeBridge_test.cpp",
135 "ValidNameNativeBridge_test.cpp",
136 "NativeBridge3UnloadLibrary_test.cpp",
137 "NativeBridge3GetError_test.cpp",
138 "NativeBridge3IsPathSupported_test.cpp",
139 "NativeBridge3InitAnonymousNamespace_test.cpp",
140 "NativeBridge3CreateNamespace_test.cpp",
141 "NativeBridge3LoadLibraryExt_test.cpp",
Lev Rumyantsevabafbe72019-12-13 15:49:37 -0800142 "NativeBridge6PreZygoteFork_test.cpp",
Orion Hodson9b16e342019-10-09 13:29:16 +0100143 ],
144
145 shared_libs: [
146 "liblog",
Martin Stjernholm19d1feb2021-03-30 22:35:24 +0100147 "libnativebridge",
Orion Hodsond1ccdfa2020-07-27 14:12:46 +0100148 "libnativebridge-test-case",
Martin Stjernholmd90291b2021-05-27 20:54:22 +0100149 "libnativebridge2-test-case",
150 "libnativebridge3-test-case",
151 "libnativebridge6-test-case",
Lev Rumyantsevabafbe72019-12-13 15:49:37 -0800152 "libnativebridge6prezygotefork",
Orion Hodson9b16e342019-10-09 13:29:16 +0100153 ],
154 header_libs: ["libbase_headers"],
155}
156
Martin Stjernholmd9c6df92022-02-09 13:08:24 +0000157// Variant of libnativebridge-tests that is part of CTS to verify backed-by API
158// coverage.
159cc_test {
160 name: "art_libnativebridge_cts_tests",
161 defaults: [
162 "art_standalone_test_defaults",
163 "libnativebridge-tests-defaults",
164 ],
165
166 // TODO(b/189484095): Pick only a subset of the tests in
167 // libnativebridge-tests that don't require the native bridge lib to be
168 // loaded, to avoid the problems with test_per_src and pushing the extra
169 // libnativebridge*-test-case.so files to device through tradefed.
170 srcs: [
171 // ValidNameNativeBridge_test.cpp needs to be first due to global state
172 // had_error that isn't reset between tests.
173 "ValidNameNativeBridge_test.cpp",
174 "NeedsNativeBridge_test.cpp",
175 "UnavailableNativeBridge_test.cpp",
176 ],
177 shared_libs: [
178 "liblog",
179 "libnativebridge",
180 ],
181 header_libs: ["libbase_headers"],
182
Martin Stjernholmd9c6df92022-02-09 13:08:24 +0000183 test_config_template: ":art-gtests-target-standalone-cts-template",
Roland Levillain34aa0da2022-02-24 18:03:46 +0000184 test_suites: [
185 "cts",
186 "general-tests",
187 "mts-art",
188 ],
Martin Stjernholmd9c6df92022-02-09 13:08:24 +0000189}
190
Orion Hodson9b16e342019-10-09 13:29:16 +0100191cc_test {
Orion Hodson9b16e342019-10-09 13:29:16 +0100192 name: "libnativebridge-lazy-tests",
193 defaults: ["libnativebridge-tests-defaults"],
Martin Stjernholm2a21cc62019-10-22 12:14:20 +0100194 host_supported: false,
Martin Stjernholm19d1feb2021-03-30 22:35:24 +0100195 test_suites: ["device-tests"],
196 static_libs: [
197 "libbase",
198 "libnativebridge_lazy",
199 ],
200 srcs: ["libnativebridge_lazy_test.cpp"],
Orion Hodson9b16e342019-10-09 13:29:16 +0100201}