Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 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 | |
Bob Badour | 9150de6 | 2021-02-26 03:22:24 -0800 | [diff] [blame] | 17 | package { |
| 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 Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 26 | cc_defaults { |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 27 | name: "libnativebridge-test-case-defaults", |
Martin Stjernholm | 2a21cc6 | 2019-10-22 12:14:20 +0100 | [diff] [blame] | 28 | defaults: [ |
| 29 | "art_defaults", |
| 30 | "art_test_defaults", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 31 | ], |
Martin Stjernholm | 2a21cc6 | 2019-10-22 12:14:20 +0100 | [diff] [blame] | 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 | }, |
Orion Hodson | 00cb81d | 2020-04-03 06:47:07 +0100 | [diff] [blame] | 44 | header_libs: [ |
| 45 | "jni_headers", |
| 46 | "libnativebridge-headers", |
| 47 | ], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 48 | cppflags: ["-fvisibility=protected"], |
| 49 | } |
| 50 | |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 51 | cc_test_library { |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 52 | name: "libnativebridge-test-case", |
| 53 | srcs: ["NativeBridgeTestCase.cpp"], |
| 54 | defaults: ["libnativebridge-test-case-defaults"], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 55 | } |
| 56 | |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 57 | cc_test_library { |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 58 | name: "libnativebridge2-test-case", |
| 59 | srcs: ["NativeBridgeTestCase2.cpp"], |
| 60 | defaults: ["libnativebridge-test-case-defaults"], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 61 | } |
| 62 | |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 63 | cc_test_library { |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 64 | name: "libnativebridge3-test-case", |
| 65 | srcs: ["NativeBridgeTestCase3.cpp"], |
| 66 | defaults: ["libnativebridge-test-case-defaults"], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 67 | } |
| 68 | |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 69 | cc_test_library { |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 70 | name: "libnativebridge6-test-case", |
| 71 | srcs: ["NativeBridgeTestCase6.cpp"], |
| 72 | defaults: ["libnativebridge-test-case-defaults"], |
Lev Rumyantsev | abafbe7 | 2019-12-13 15:49:37 -0800 | [diff] [blame] | 73 | shared_libs: [ |
| 74 | "libnativebridge6prezygotefork", |
| 75 | ], |
| 76 | } |
| 77 | |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 78 | // A helper library to produce test-case side effect of PreZygoteForkNativeBridge. |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 79 | cc_test_library { |
Lev Rumyantsev | abafbe7 | 2019-12-13 15:49:37 -0800 | [diff] [blame] | 80 | name: "libnativebridge6prezygotefork", |
| 81 | srcs: ["NativeBridge6PreZygoteFork_lib.cpp"], |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 82 | defaults: ["libnativebridge-test-case-defaults"], |
Lev Rumyantsev | abafbe7 | 2019-12-13 15:49:37 -0800 | [diff] [blame] | 83 | } |
| 84 | |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 85 | cc_defaults { |
| 86 | name: "libnativebridge-tests-defaults", |
Martin Stjernholm | 2a21cc6 | 2019-10-22 12:14:20 +0100 | [diff] [blame] | 87 | defaults: [ |
| 88 | "art_defaults", |
| 89 | "art_test_defaults", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 90 | ], |
Martin Stjernholm | 2a21cc6 | 2019-10-22 12:14:20 +0100 | [diff] [blame] | 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 | }, |
Martin Stjernholm | 19d1feb | 2021-03-30 22:35:24 +0100 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | cc_test { |
| 106 | name: "libnativebridge-tests", |
| 107 | defaults: ["libnativebridge-tests-defaults"], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 108 | |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 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 | |
Roland Levillain | ccf4f91 | 2022-08-04 19:23:37 +0100 | [diff] [blame] | 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 | |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 121 | srcs: [ |
Martin Stjernholm | 6034c07 | 2021-06-02 00:35:39 +0100 | [diff] [blame] | 122 | "NativeBridgeApi.c", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 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", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 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", |
Lev Rumyantsev | abafbe7 | 2019-12-13 15:49:37 -0800 | [diff] [blame] | 142 | "NativeBridge6PreZygoteFork_test.cpp", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 143 | ], |
| 144 | |
| 145 | shared_libs: [ |
| 146 | "liblog", |
Martin Stjernholm | 19d1feb | 2021-03-30 22:35:24 +0100 | [diff] [blame] | 147 | "libnativebridge", |
Orion Hodson | d1ccdfa | 2020-07-27 14:12:46 +0100 | [diff] [blame] | 148 | "libnativebridge-test-case", |
Martin Stjernholm | d90291b | 2021-05-27 20:54:22 +0100 | [diff] [blame] | 149 | "libnativebridge2-test-case", |
| 150 | "libnativebridge3-test-case", |
| 151 | "libnativebridge6-test-case", |
Lev Rumyantsev | abafbe7 | 2019-12-13 15:49:37 -0800 | [diff] [blame] | 152 | "libnativebridge6prezygotefork", |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 153 | ], |
| 154 | header_libs: ["libbase_headers"], |
| 155 | } |
| 156 | |
Martin Stjernholm | d9c6df9 | 2022-02-09 13:08:24 +0000 | [diff] [blame] | 157 | // Variant of libnativebridge-tests that is part of CTS to verify backed-by API |
| 158 | // coverage. |
| 159 | cc_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 Stjernholm | d9c6df9 | 2022-02-09 13:08:24 +0000 | [diff] [blame] | 183 | test_config_template: ":art-gtests-target-standalone-cts-template", |
Roland Levillain | 34aa0da | 2022-02-24 18:03:46 +0000 | [diff] [blame] | 184 | test_suites: [ |
| 185 | "cts", |
| 186 | "general-tests", |
| 187 | "mts-art", |
| 188 | ], |
Martin Stjernholm | d9c6df9 | 2022-02-09 13:08:24 +0000 | [diff] [blame] | 189 | } |
| 190 | |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 191 | cc_test { |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 192 | name: "libnativebridge-lazy-tests", |
| 193 | defaults: ["libnativebridge-tests-defaults"], |
Martin Stjernholm | 2a21cc6 | 2019-10-22 12:14:20 +0100 | [diff] [blame] | 194 | host_supported: false, |
Martin Stjernholm | 19d1feb | 2021-03-30 22:35:24 +0100 | [diff] [blame] | 195 | test_suites: ["device-tests"], |
| 196 | static_libs: [ |
| 197 | "libbase", |
| 198 | "libnativebridge_lazy", |
| 199 | ], |
| 200 | srcs: ["libnativebridge_lazy_test.cpp"], |
Orion Hodson | 9b16e34 | 2019-10-09 13:29:16 +0100 | [diff] [blame] | 201 | } |