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 17cc_defaults { 18 name: "libnativebridge-test-case-defaults", 19 defaults: [ 20 "art_defaults", 21 "art_test_defaults", 22 ], 23 // TODO(mast): Split up art_gtest_defaults so that it can be used for the 24 // following without pulling in lots of libs. 25 target: { 26 linux: { 27 cflags: [ 28 // gtest issue 29 "-Wno-used-but-marked-unused", 30 "-Wno-deprecated", 31 "-Wno-missing-noreturn", 32 ], 33 }, 34 }, 35 header_libs: [ 36 "jni_headers", 37 "libnativebridge-headers", 38 ], 39 cppflags: ["-fvisibility=protected"], 40} 41 42cc_library_shared { 43 name: "libnativebridge-test-case", 44 srcs: ["NativeBridgeTestCase.cpp"], 45 defaults: ["libnativebridge-test-case-defaults"], 46} 47 48cc_library_shared { 49 name: "libnativebridge2-test-case", 50 srcs: ["NativeBridgeTestCase2.cpp"], 51 defaults: ["libnativebridge-test-case-defaults"], 52} 53 54cc_library_shared { 55 name: "libnativebridge3-test-case", 56 srcs: ["NativeBridgeTestCase3.cpp"], 57 defaults: ["libnativebridge-test-case-defaults"], 58} 59 60cc_library_shared { 61 name: "libnativebridge6-test-case", 62 srcs: ["NativeBridgeTestCase6.cpp"], 63 defaults: ["libnativebridge-test-case-defaults"], 64 shared_libs: [ 65 "libnativebridge6prezygotefork", 66 ], 67} 68 69// A helper library to produce test-case side effect of PreZygoteForkNativeBridge. 70cc_library_shared { 71 name: "libnativebridge6prezygotefork", 72 srcs: ["NativeBridge6PreZygoteFork_lib.cpp"], 73 defaults: ["libnativebridge-test-case-defaults"], 74} 75 76// Build the unit tests. 77cc_defaults { 78 name: "libnativebridge-tests-defaults", 79 defaults: [ 80 "art_defaults", 81 "art_test_defaults", 82 ], 83 // TODO(mast): Split up art_gtest_defaults so that it can be used for the 84 // following without pulling in lots of libs. 85 target: { 86 linux: { 87 cflags: [ 88 // gtest issue 89 "-Wno-used-but-marked-unused", 90 "-Wno-deprecated", 91 "-Wno-missing-noreturn", 92 ], 93 }, 94 }, 95 96 srcs: [ 97 "CodeCacheCreate_test.cpp", 98 "CodeCacheExists_test.cpp", 99 "CodeCacheStatFail_test.cpp", 100 "CompleteFlow_test.cpp", 101 "InvalidCharsNativeBridge_test.cpp", 102 "NativeBridge2Signal_test.cpp", 103 "NativeBridgeVersion_test.cpp", 104 "NeedsNativeBridge_test.cpp", 105 "PreInitializeNativeBridge_test.cpp", 106 "PreInitializeNativeBridgeFail1_test.cpp", 107 "PreInitializeNativeBridgeFail2_test.cpp", 108 "ReSetupNativeBridge_test.cpp", 109 "UnavailableNativeBridge_test.cpp", 110 "ValidNameNativeBridge_test.cpp", 111 "NativeBridge3UnloadLibrary_test.cpp", 112 "NativeBridge3GetError_test.cpp", 113 "NativeBridge3IsPathSupported_test.cpp", 114 "NativeBridge3InitAnonymousNamespace_test.cpp", 115 "NativeBridge3CreateNamespace_test.cpp", 116 "NativeBridge3LoadLibraryExt_test.cpp", 117 "NativeBridge6PreZygoteFork_test.cpp", 118 ], 119 120 shared_libs: [ 121 "liblog", 122 "libnativebridge-test-case", 123 "libnativebridge6prezygotefork", 124 ], 125 header_libs: ["libbase_headers"], 126} 127 128cc_test { 129 name: "libnativebridge-tests", 130 defaults: ["libnativebridge-tests-defaults"], 131 shared_libs: ["libnativebridge"], 132} 133 134cc_test { 135 name: "libnativebridge-lazy-tests", 136 defaults: ["libnativebridge-tests-defaults"], 137 host_supported: false, 138 shared_libs: ["libnativebridge_lazy"], 139} 140 141// Build the test for the C API. 142cc_test { 143 name: "libnativebridge-api-tests", 144 defaults: [ 145 "art_defaults", 146 "art_test_defaults", 147 ], 148 // TODO(mast): Split up art_gtest_defaults so that it can be used for the 149 // following without pulling in lots of libs. 150 target: { 151 linux: { 152 cflags: [ 153 // gtest issue 154 "-Wno-used-but-marked-unused", 155 "-Wno-deprecated", 156 "-Wno-missing-noreturn", 157 ], 158 }, 159 }, 160 srcs: [ 161 "NativeBridgeApi.c", 162 ], 163 header_libs: [ 164 "jni_headers", 165 "libnativebridge-headers", 166 ], 167} 168