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 26// A native library that goes into /system or /system_ext and that depends on 27// a non-public library that is linked from the system namespace. 28cc_library { 29 name: "libsystem_testlib", 30 min_sdk_version: "31", 31 stl: "libc++_static", 32 shared_libs: ["liblog"], 33 // It's difficult to add a shared_lib dependency on a non-public library 34 // here, so it dlopens one instead. 35 srcs: ["libsystem_testlib.cc"], 36} 37 38// A native library that goes into /product. 39cc_library { 40 name: "libproduct_testlib", 41 min_sdk_version: "31", 42 stl: "none", 43 srcs: [], 44} 45 46// A native library that goes into /vendor. 47cc_library { 48 name: "libvendor_testlib", 49 min_sdk_version: "31", 50 stl: "none", 51 srcs: [], 52} 53 54// This app is just an intermediate container to be able to include the .so 55// library in the host test. It's not actually installed or started. 56android_test_helper_app { 57 name: "library_container_app", 58 defaults: ["art_module_source_build_java_defaults"], 59 min_sdk_version: "31", 60 manifest: "library_container_app_manifest.xml", 61 compile_multilib: "both", 62 jni_libs: [ 63 "libsystem_testlib", 64 "libproduct_testlib", 65 "libvendor_testlib", 66 ], 67} 68 69java_library { 70 name: "loadlibrarytest_test_utils", 71 sdk_version: "31", 72 static_libs: [ 73 "androidx.test.ext.junit", 74 "androidx.test.ext.truth", 75 ], 76 srcs: ["src/android/test/lib/TestUtils.java"], 77} 78 79// Test fixture that represents a shared library in /system/framework. 80java_library { 81 name: "libnativeloader_system_shared_lib", 82 sdk_version: "31", 83 installable: true, 84 srcs: ["src/android/test/systemsharedlib/SystemSharedLib.java"], 85} 86 87// Test fixture that represents a shared library in /system_ext/framework. 88java_library { 89 name: "libnativeloader_system_ext_shared_lib", 90 sdk_version: "31", 91 installable: true, 92 srcs: ["src/android/test/systemextsharedlib/SystemExtSharedLib.java"], 93} 94 95// Test fixture that represents a shared library in /product/framework. 96java_library { 97 name: "libnativeloader_product_shared_lib", 98 product_specific: true, 99 sdk_version: "31", 100 installable: true, 101 srcs: ["src/android/test/productsharedlib/ProductSharedLib.java"], 102} 103 104// Test fixture that represents a shared library in /vendor/framework. 105java_library { 106 name: "libnativeloader_vendor_shared_lib", 107 vendor: true, 108 sdk_version: "31", 109 installable: true, 110 srcs: ["src/android/test/vendorsharedlib/VendorSharedLib.java"], 111} 112 113java_defaults { 114 name: "loadlibrarytest_app_defaults", 115 defaults: ["art_module_source_build_java_defaults"], 116 sdk_version: "31", 117 static_libs: [ 118 "androidx.test.ext.junit", 119 "androidx.test.rules", 120 "loadlibrarytest_test_utils", 121 ], 122 libs: [ 123 "libnativeloader_system_shared_lib", 124 "libnativeloader_system_ext_shared_lib", 125 "libnativeloader_product_shared_lib", 126 "libnativeloader_vendor_shared_lib", 127 ], 128} 129 130android_test_helper_app { 131 name: "loadlibrarytest_system_priv_app", 132 defaults: ["loadlibrarytest_app_defaults"], 133 manifest: "loadlibrarytest_system_priv_app_manifest.xml", 134 // /system/priv-app currently reuses the same test as /system/app. 135 srcs: ["src/android/test/app/SystemAppTest.java"], 136} 137 138android_test_helper_app { 139 name: "loadlibrarytest_system_app", 140 defaults: ["loadlibrarytest_app_defaults"], 141 manifest: "loadlibrarytest_system_app_manifest.xml", 142 srcs: ["src/android/test/app/SystemAppTest.java"], 143} 144 145android_test_helper_app { 146 name: "loadlibrarytest_system_ext_app", 147 defaults: ["loadlibrarytest_app_defaults"], 148 system_ext_specific: true, 149 manifest: "loadlibrarytest_system_ext_app_manifest.xml", 150 // /system_ext should behave the same as /system, so use the same test class there. 151 srcs: ["src/android/test/app/SystemAppTest.java"], 152} 153 154android_test_helper_app { 155 name: "loadlibrarytest_product_app", 156 defaults: ["loadlibrarytest_app_defaults"], 157 product_specific: true, 158 manifest: "loadlibrarytest_product_app_manifest.xml", 159 srcs: ["src/android/test/app/ProductAppTest.java"], 160} 161 162android_test_helper_app { 163 name: "loadlibrarytest_vendor_app", 164 defaults: ["loadlibrarytest_app_defaults"], 165 vendor: true, 166 manifest: "loadlibrarytest_vendor_app_manifest.xml", 167 srcs: ["src/android/test/app/VendorAppTest.java"], 168} 169 170// A normal app installed in /data. 171android_test_helper_app { 172 name: "loadlibrarytest_data_app", 173 defaults: ["loadlibrarytest_app_defaults"], 174 manifest: "loadlibrarytest_data_app_manifest.xml", 175 srcs: ["src/android/test/app/DataAppTest.java"], 176} 177 178java_test_host { 179 name: "libnativeloader_e2e_tests", 180 defaults: ["art_module_source_build_java_defaults"], 181 srcs: ["src/android/test/hostside/*.java"], 182 libs: [ 183 "compatibility-tradefed", 184 "tradefed", 185 ], 186 data: [ 187 ":library_container_app", 188 ":libnativeloader_system_shared_lib", 189 ":libnativeloader_system_ext_shared_lib", 190 ":libnativeloader_product_shared_lib", 191 ":libnativeloader_vendor_shared_lib", 192 ":loadlibrarytest_system_priv_app", 193 ":loadlibrarytest_system_app", 194 ":loadlibrarytest_system_ext_app", 195 ":loadlibrarytest_product_app", 196 ":loadlibrarytest_vendor_app", 197 ":loadlibrarytest_data_app", 198 ], 199 test_config: "libnativeloader_e2e_tests.xml", 200 test_suites: ["general-tests"], 201} 202