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_defaults", 31 ], 32 // 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 }, 44 header_libs: [ 45 "jni_headers", 46 "libnativebridge-headers", 47 ], 48 cppflags: ["-fvisibility=protected"], 49} 50 51cc_test_library { 52 name: "libnativebridge-test-case", 53 srcs: ["NativeBridgeTestCase.cpp"], 54 defaults: ["libnativebridge-test-case-defaults"], 55} 56 57cc_test_library { 58 name: "libnativebridge2-test-case", 59 srcs: ["NativeBridgeTestCase2.cpp"], 60 defaults: ["libnativebridge-test-case-defaults"], 61} 62 63cc_test_library { 64 name: "libnativebridge3-test-case", 65 srcs: ["NativeBridgeTestCase3.cpp"], 66 defaults: ["libnativebridge-test-case-defaults"], 67} 68 69cc_test_library { 70 name: "libnativebridge6-test-case", 71 srcs: ["NativeBridgeTestCase6.cpp"], 72 defaults: ["libnativebridge-test-case-defaults"], 73 shared_libs: [ 74 "libnativebridge6prezygotefork", 75 ], 76} 77 78// A helper library to produce test-case side effect of PreZygoteForkNativeBridge. 79cc_test_library { 80 name: "libnativebridge6prezygotefork", 81 srcs: ["NativeBridge6PreZygoteFork_lib.cpp"], 82 defaults: ["libnativebridge-test-case-defaults"], 83} 84 85cc_defaults { 86 name: "libnativebridge-tests-defaults", 87 defaults: [ 88 "art_defaults", 89 "art_test_defaults", 90 ], 91 // 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 }, 103} 104 105cc_test { 106 name: "libnativebridge-tests", 107 defaults: ["libnativebridge-tests-defaults"], 108 109 // 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 113 // 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 121 srcs: [ 122 "NativeBridgeApi.c", 123 "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", 132 "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", 142 "NativeBridge6PreZygoteFork_test.cpp", 143 ], 144 145 shared_libs: [ 146 "liblog", 147 "libnativebridge", 148 "libnativebridge-test-case", 149 "libnativebridge2-test-case", 150 "libnativebridge3-test-case", 151 "libnativebridge6-test-case", 152 "libnativebridge6prezygotefork", 153 ], 154 header_libs: ["libbase_headers"], 155} 156 157// 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 static_libs: [ 178 "libdl_android", 179 "libnativebridge", 180 ], 181 shared_libs: [ 182 "liblog", 183 ], 184 header_libs: ["libbase_headers"], 185 186 test_config_template: ":art-gtests-target-standalone-cts-template", 187 test_suites: [ 188 "cts", 189 "general-tests", 190 "mts-art", 191 ], 192} 193 194cc_test { 195 name: "libnativebridge-lazy-tests", 196 defaults: ["libnativebridge-tests-defaults"], 197 host_supported: false, 198 test_suites: ["device-tests"], 199 static_libs: [ 200 "libbase", 201 "libnativebridge_lazy", 202 ], 203 srcs: ["libnativebridge_lazy_test.cpp"], 204} 205