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 min_sdk_version: "31", 59 manifest: "library_container_app_manifest.xml", 60 compile_multilib: "both", 61 jni_libs: [ 62 "libsystem_testlib", 63 "libproduct_testlib", 64 "libvendor_testlib", 65 ], 66} 67 68// Test fixture that represents a shared library in /system/framework. 69java_library { 70 name: "libnativeloader_system_shared_lib", 71 sdk_version: "31", 72 installable: true, 73 srcs: ["src/android/test/systemsharedlib/SystemSharedLib.java"], 74} 75 76// Test fixture that represents a shared library in /system_ext/framework. 77java_library { 78 name: "libnativeloader_system_ext_shared_lib", 79 sdk_version: "31", 80 installable: true, 81 srcs: ["src/android/test/systemextsharedlib/SystemExtSharedLib.java"], 82} 83 84// Test fixture that represents a shared library in /product/framework. 85java_library { 86 name: "libnativeloader_product_shared_lib", 87 product_specific: true, 88 sdk_version: "31", 89 installable: true, 90 srcs: ["src/android/test/productsharedlib/ProductSharedLib.java"], 91} 92 93// Test fixture that represents a shared library in /vendor/framework. 94java_library { 95 name: "libnativeloader_vendor_shared_lib", 96 vendor: true, 97 sdk_version: "31", 98 installable: true, 99 srcs: ["src/android/test/vendorsharedlib/VendorSharedLib.java"], 100} 101 102java_library { 103 name: "loadlibrarytest_testlib", 104 sdk_version: "system_31", 105 static_libs: [ 106 "androidx.test.ext.junit", 107 "androidx.test.ext.truth", 108 "androidx.test.rules", 109 "modules-utils-build_system", 110 ], 111 libs: [ 112 "libnativeloader_system_shared_lib", 113 "libnativeloader_system_ext_shared_lib", 114 "libnativeloader_product_shared_lib", 115 "libnativeloader_vendor_shared_lib", 116 ], 117 srcs: ["src/android/test/lib/*.java"], 118} 119 120java_defaults { 121 name: "loadlibrarytest_app_defaults", 122 min_sdk_version: "31", 123 // Don't let targetSdkVersion become the latest codename, because 124 // PackageManager refuses to install the app on released platform images 125 // then, which makes it fail in MTS runs. Otoh, we don't want app compat 126 // measures getting enabled in these tests, so set some high number. 127 target_sdk_version: "9999", 128 static_libs: [ 129 "loadlibrarytest_testlib", 130 ], 131 libs: [ 132 "libnativeloader_system_shared_lib", 133 "libnativeloader_system_ext_shared_lib", 134 "libnativeloader_product_shared_lib", 135 "libnativeloader_vendor_shared_lib", 136 ], 137} 138 139android_test_helper_app { 140 name: "loadlibrarytest_system_priv_app", 141 defaults: ["loadlibrarytest_app_defaults"], 142 manifest: "loadlibrarytest_system_priv_app_manifest.xml", 143 // /system/priv-app currently reuses the same test as /system/app. 144 srcs: ["src/android/test/app/SystemAppTest.java"], 145} 146 147android_test_helper_app { 148 name: "loadlibrarytest_system_app", 149 defaults: ["loadlibrarytest_app_defaults"], 150 manifest: "loadlibrarytest_system_app_manifest.xml", 151 srcs: ["src/android/test/app/SystemAppTest.java"], 152} 153 154android_test_helper_app { 155 name: "loadlibrarytest_system_ext_app", 156 defaults: ["loadlibrarytest_app_defaults"], 157 system_ext_specific: true, 158 manifest: "loadlibrarytest_system_ext_app_manifest.xml", 159 // /system_ext should behave the same as /system, so use the same test class there. 160 srcs: ["src/android/test/app/SystemAppTest.java"], 161} 162 163android_test_helper_app { 164 name: "loadlibrarytest_product_app", 165 defaults: ["loadlibrarytest_app_defaults"], 166 product_specific: true, 167 manifest: "loadlibrarytest_product_app_manifest.xml", 168 srcs: ["src/android/test/app/ProductAppTest.java"], 169} 170 171android_test_helper_app { 172 name: "loadlibrarytest_vendor_app", 173 defaults: ["loadlibrarytest_app_defaults"], 174 vendor: true, 175 manifest: "loadlibrarytest_vendor_app_manifest.xml", 176 srcs: ["src/android/test/app/VendorAppTest.java"], 177} 178 179// A normal app installed in /data. 180android_test_helper_app { 181 name: "loadlibrarytest_data_app", 182 defaults: ["loadlibrarytest_app_defaults"], 183 manifest: "loadlibrarytest_data_app_manifest.xml", 184 srcs: ["src/android/test/app/DataAppTest.java"], 185} 186 187java_test_host { 188 name: "libnativeloader_e2e_tests", 189 srcs: ["src/android/test/hostside/*.java"], 190 libs: [ 191 "compatibility-tradefed", 192 "tradefed", 193 ], 194 device_common_data: [ 195 ":library_container_app", 196 ":libnativeloader_system_shared_lib", 197 ":libnativeloader_system_ext_shared_lib", 198 ":libnativeloader_product_shared_lib", 199 ":libnativeloader_vendor_shared_lib", 200 ":loadlibrarytest_system_priv_app", 201 ":loadlibrarytest_system_app", 202 ":loadlibrarytest_system_ext_app", 203 ":loadlibrarytest_product_app", 204 ":loadlibrarytest_vendor_app", 205 ":loadlibrarytest_data_app", 206 ], 207 test_config: "libnativeloader_e2e_tests.xml", 208 test_suites: [ 209 "general-tests", 210 "mts-art", 211 ], 212} 213