Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 1 | // Copyright 2019 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package java |
| 16 | |
| 17 | import ( |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 18 | "reflect" |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 19 | "testing" |
Jaewoong Jung | f9a0443 | 2019-07-17 11:15:09 -0700 | [diff] [blame] | 20 | |
| 21 | "android/soong/android" |
Jihoon Kang | f78a890 | 2022-09-01 22:47:07 +0000 | [diff] [blame] | 22 | "android/soong/cc" |
| 23 | |
| 24 | "github.com/google/blueprint/proptools" |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 25 | ) |
| 26 | |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 27 | func TestRequired(t *testing.T) { |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 28 | ctx, _ := testJava(t, ` |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 29 | java_library { |
| 30 | name: "foo", |
| 31 | srcs: ["a.java"], |
| 32 | required: ["libfoo"], |
| 33 | } |
Jaewoong Jung | f9a0443 | 2019-07-17 11:15:09 -0700 | [diff] [blame] | 34 | `) |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 35 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 36 | mod := ctx.ModuleForTests("foo", "android_common").Module() |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 37 | entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 38 | |
| 39 | expected := []string{"libfoo"} |
| 40 | actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"] |
| 41 | if !reflect.DeepEqual(expected, actual) { |
| 42 | t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual) |
| 43 | } |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | func TestHostdex(t *testing.T) { |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 47 | ctx, _ := testJava(t, ` |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 48 | java_library { |
| 49 | name: "foo", |
| 50 | srcs: ["a.java"], |
| 51 | hostdex: true, |
| 52 | } |
Jaewoong Jung | f9a0443 | 2019-07-17 11:15:09 -0700 | [diff] [blame] | 53 | `) |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 54 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 55 | mod := ctx.ModuleForTests("foo", "android_common").Module() |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 56 | entriesList := android.AndroidMkEntriesForTest(t, ctx, mod) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 57 | if len(entriesList) != 2 { |
| 58 | t.Errorf("two entries are expected, but got %d", len(entriesList)) |
| 59 | } |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 60 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 61 | mainEntries := &entriesList[0] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 62 | expected := []string{"foo"} |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 63 | actual := mainEntries.EntryMap["LOCAL_MODULE"] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 64 | if !reflect.DeepEqual(expected, actual) { |
| 65 | t.Errorf("Unexpected module name - expected: %q, actual: %q", expected, actual) |
| 66 | } |
| 67 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 68 | subEntries := &entriesList[1] |
| 69 | expected = []string{"foo-hostdex"} |
| 70 | actual = subEntries.EntryMap["LOCAL_MODULE"] |
| 71 | if !reflect.DeepEqual(expected, actual) { |
| 72 | t.Errorf("Unexpected module name - expected: %q, actual: %q", expected, actual) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 73 | } |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | func TestHostdexRequired(t *testing.T) { |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 77 | ctx, _ := testJava(t, ` |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 78 | java_library { |
| 79 | name: "foo", |
| 80 | srcs: ["a.java"], |
| 81 | hostdex: true, |
| 82 | required: ["libfoo"], |
| 83 | } |
Jaewoong Jung | f9a0443 | 2019-07-17 11:15:09 -0700 | [diff] [blame] | 84 | `) |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 85 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 86 | mod := ctx.ModuleForTests("foo", "android_common").Module() |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 87 | entriesList := android.AndroidMkEntriesForTest(t, ctx, mod) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 88 | if len(entriesList) != 2 { |
| 89 | t.Errorf("two entries are expected, but got %d", len(entriesList)) |
| 90 | } |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 91 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 92 | mainEntries := &entriesList[0] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 93 | expected := []string{"libfoo"} |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 94 | actual := mainEntries.EntryMap["LOCAL_REQUIRED_MODULES"] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 95 | if !reflect.DeepEqual(expected, actual) { |
| 96 | t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual) |
| 97 | } |
| 98 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 99 | subEntries := &entriesList[1] |
| 100 | expected = []string{"libfoo"} |
| 101 | actual = subEntries.EntryMap["LOCAL_REQUIRED_MODULES"] |
| 102 | if !reflect.DeepEqual(expected, actual) { |
| 103 | t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 104 | } |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | func TestHostdexSpecificRequired(t *testing.T) { |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 108 | ctx, _ := testJava(t, ` |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 109 | java_library { |
| 110 | name: "foo", |
| 111 | srcs: ["a.java"], |
| 112 | hostdex: true, |
| 113 | target: { |
| 114 | hostdex: { |
| 115 | required: ["libfoo"], |
| 116 | }, |
| 117 | }, |
| 118 | } |
Jaewoong Jung | f9a0443 | 2019-07-17 11:15:09 -0700 | [diff] [blame] | 119 | `) |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 120 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 121 | mod := ctx.ModuleForTests("foo", "android_common").Module() |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 122 | entriesList := android.AndroidMkEntriesForTest(t, ctx, mod) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 123 | if len(entriesList) != 2 { |
| 124 | t.Errorf("two entries are expected, but got %d", len(entriesList)) |
| 125 | } |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 126 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 127 | mainEntries := &entriesList[0] |
| 128 | if r, ok := mainEntries.EntryMap["LOCAL_REQUIRED_MODULES"]; ok { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 129 | t.Errorf("Unexpected required modules: %q", r) |
| 130 | } |
| 131 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 132 | subEntries := &entriesList[1] |
| 133 | expected := []string{"libfoo"} |
| 134 | actual := subEntries.EntryMap["LOCAL_REQUIRED_MODULES"] |
| 135 | if !reflect.DeepEqual(expected, actual) { |
| 136 | t.Errorf("Unexpected required modules - expected: %q, actual: %q", expected, actual) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 137 | } |
Jooyung Han | 12df5fb | 2019-07-11 16:18:47 +0900 | [diff] [blame] | 138 | } |
Anton Hansson | 78156ef | 2020-03-27 19:39:48 +0000 | [diff] [blame] | 139 | |
Yo Chiang | 07d7507 | 2020-06-05 17:43:19 +0800 | [diff] [blame] | 140 | func TestJavaSdkLibrary_RequireXmlPermissionFile(t *testing.T) { |
Paul Duffin | 71ae594 | 2021-03-22 15:36:52 +0000 | [diff] [blame] | 141 | result := android.GroupFixturePreparers( |
| 142 | prepareForJavaTest, |
Paul Duffin | 163043d | 2021-03-12 19:18:49 +0000 | [diff] [blame] | 143 | PrepareForTestWithJavaSdkLibraryFiles, |
| 144 | FixtureWithLastReleaseApis("foo-shared_library", "foo-no_shared_library"), |
| 145 | ).RunTestWithBp(t, ` |
Yo Chiang | 07d7507 | 2020-06-05 17:43:19 +0800 | [diff] [blame] | 146 | java_sdk_library { |
| 147 | name: "foo-shared_library", |
| 148 | srcs: ["a.java"], |
| 149 | } |
| 150 | java_sdk_library { |
| 151 | name: "foo-no_shared_library", |
| 152 | srcs: ["a.java"], |
| 153 | shared_library: false, |
| 154 | } |
| 155 | `) |
| 156 | |
| 157 | // Verify the existence of internal modules |
Paul Duffin | 22b77cd | 2021-03-12 19:15:01 +0000 | [diff] [blame] | 158 | result.ModuleForTests("foo-shared_library.xml", "android_common") |
Yo Chiang | 07d7507 | 2020-06-05 17:43:19 +0800 | [diff] [blame] | 159 | |
| 160 | testCases := []struct { |
| 161 | moduleName string |
| 162 | expected []string |
| 163 | }{ |
| 164 | {"foo-shared_library", []string{"foo-shared_library.xml"}}, |
| 165 | {"foo-no_shared_library", nil}, |
| 166 | } |
| 167 | for _, tc := range testCases { |
Paul Duffin | 22b77cd | 2021-03-12 19:15:01 +0000 | [diff] [blame] | 168 | mod := result.ModuleForTests(tc.moduleName, "android_common").Module() |
| 169 | entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0] |
Yo Chiang | 07d7507 | 2020-06-05 17:43:19 +0800 | [diff] [blame] | 170 | actual := entries.EntryMap["LOCAL_REQUIRED_MODULES"] |
| 171 | if !reflect.DeepEqual(tc.expected, actual) { |
| 172 | t.Errorf("Unexpected required modules - expected: %q, actual: %q", tc.expected, actual) |
| 173 | } |
| 174 | } |
| 175 | } |
Bill Peckham | fb04df4 | 2021-01-11 12:27:24 -0800 | [diff] [blame] | 176 | |
| 177 | func TestImportSoongDexJar(t *testing.T) { |
Paul Duffin | f04311c | 2021-03-22 17:31:51 +0000 | [diff] [blame] | 178 | result := PrepareForTestWithJavaDefaultModules.RunTestWithBp(t, ` |
Bill Peckham | fb04df4 | 2021-01-11 12:27:24 -0800 | [diff] [blame] | 179 | java_import { |
| 180 | name: "my-java-import", |
| 181 | jars: ["a.jar"], |
| 182 | prefer: true, |
| 183 | compile_dex: true, |
| 184 | } |
| 185 | `) |
| 186 | |
Paul Duffin | f04311c | 2021-03-22 17:31:51 +0000 | [diff] [blame] | 187 | mod := result.Module("my-java-import", "android_common") |
| 188 | entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0] |
| 189 | expectedSoongDexJar := "out/soong/.intermediates/my-java-import/android_common/dex/my-java-import.jar" |
Bill Peckham | fb04df4 | 2021-01-11 12:27:24 -0800 | [diff] [blame] | 190 | actualSoongDexJar := entries.EntryMap["LOCAL_SOONG_DEX_JAR"] |
| 191 | |
Paul Duffin | f04311c | 2021-03-22 17:31:51 +0000 | [diff] [blame] | 192 | android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_SOONG_DEX_JAR", result.Config, []string{expectedSoongDexJar}, actualSoongDexJar) |
Bill Peckham | fb04df4 | 2021-01-11 12:27:24 -0800 | [diff] [blame] | 193 | } |
Yuntao Xu | 7a31855 | 2021-05-27 10:30:26 -0700 | [diff] [blame] | 194 | |
| 195 | func TestAndroidTestHelperApp_LocalDisableTestConfig(t *testing.T) { |
| 196 | ctx, _ := testJava(t, ` |
| 197 | android_test_helper_app { |
| 198 | name: "foo", |
| 199 | srcs: ["a.java"], |
| 200 | } |
| 201 | `) |
| 202 | |
| 203 | mod := ctx.ModuleForTests("foo", "android_common").Module() |
| 204 | entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] |
| 205 | |
| 206 | expected := []string{"true"} |
| 207 | actual := entries.EntryMap["LOCAL_DISABLE_TEST_CONFIG"] |
| 208 | if !reflect.DeepEqual(expected, actual) { |
| 209 | t.Errorf("Unexpected flag value - expected: %q, actual: %q", expected, actual) |
| 210 | } |
| 211 | } |
zhidou | 198f589 | 2022-02-17 02:33:12 +0000 | [diff] [blame] | 212 | |
| 213 | func TestGetOverriddenPackages(t *testing.T) { |
| 214 | ctx, _ := testJava( |
| 215 | t, ` |
| 216 | android_app { |
| 217 | name: "foo", |
| 218 | srcs: ["a.java"], |
| 219 | sdk_version: "current", |
| 220 | overrides: ["qux"] |
| 221 | } |
| 222 | |
| 223 | override_android_app { |
| 224 | name: "foo_override", |
| 225 | base: "foo", |
| 226 | overrides: ["bar"] |
| 227 | } |
| 228 | `) |
| 229 | |
| 230 | expectedVariants := []struct { |
| 231 | name string |
| 232 | moduleName string |
| 233 | variantName string |
| 234 | overrides []string |
| 235 | }{ |
| 236 | { |
| 237 | name: "foo", |
| 238 | moduleName: "foo", |
| 239 | variantName: "android_common", |
| 240 | overrides: []string{"qux"}, |
| 241 | }, |
| 242 | { |
| 243 | name: "foo", |
| 244 | moduleName: "foo_override", |
| 245 | variantName: "android_common_foo_override", |
| 246 | overrides: []string{"bar", "foo"}, |
| 247 | }, |
| 248 | } |
| 249 | |
| 250 | for _, expected := range expectedVariants { |
| 251 | mod := ctx.ModuleForTests(expected.name, expected.variantName).Module() |
| 252 | entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] |
| 253 | actual := entries.EntryMap["LOCAL_OVERRIDES_PACKAGES"] |
| 254 | |
| 255 | android.AssertDeepEquals(t, "overrides property", expected.overrides, actual) |
| 256 | } |
| 257 | } |
Jihoon Kang | f78a890 | 2022-09-01 22:47:07 +0000 | [diff] [blame] | 258 | |
| 259 | func TestJniPartition(t *testing.T) { |
| 260 | bp := ` |
| 261 | cc_library { |
| 262 | name: "libjni_system", |
| 263 | system_shared_libs: [], |
| 264 | sdk_version: "current", |
| 265 | stl: "none", |
| 266 | } |
| 267 | |
| 268 | cc_library { |
| 269 | name: "libjni_system_ext", |
| 270 | system_shared_libs: [], |
| 271 | sdk_version: "current", |
| 272 | stl: "none", |
| 273 | system_ext_specific: true, |
| 274 | } |
| 275 | |
| 276 | cc_library { |
| 277 | name: "libjni_odm", |
| 278 | system_shared_libs: [], |
| 279 | sdk_version: "current", |
| 280 | stl: "none", |
| 281 | device_specific: true, |
| 282 | } |
| 283 | |
| 284 | cc_library { |
| 285 | name: "libjni_product", |
| 286 | system_shared_libs: [], |
| 287 | sdk_version: "current", |
| 288 | stl: "none", |
| 289 | product_specific: true, |
| 290 | } |
| 291 | |
| 292 | cc_library { |
| 293 | name: "libjni_vendor", |
| 294 | system_shared_libs: [], |
| 295 | sdk_version: "current", |
| 296 | stl: "none", |
| 297 | soc_specific: true, |
| 298 | } |
| 299 | |
| 300 | android_app { |
| 301 | name: "test_app_system_jni_system", |
| 302 | privileged: true, |
| 303 | platform_apis: true, |
| 304 | certificate: "platform", |
| 305 | jni_libs: ["libjni_system"], |
| 306 | } |
| 307 | |
| 308 | android_app { |
| 309 | name: "test_app_system_jni_system_ext", |
| 310 | privileged: true, |
| 311 | platform_apis: true, |
| 312 | certificate: "platform", |
| 313 | jni_libs: ["libjni_system_ext"], |
| 314 | } |
| 315 | |
| 316 | android_app { |
| 317 | name: "test_app_system_ext_jni_system", |
| 318 | privileged: true, |
| 319 | platform_apis: true, |
| 320 | certificate: "platform", |
| 321 | jni_libs: ["libjni_system"], |
| 322 | system_ext_specific: true |
| 323 | } |
| 324 | |
| 325 | android_app { |
| 326 | name: "test_app_system_ext_jni_system_ext", |
| 327 | sdk_version: "core_platform", |
| 328 | jni_libs: ["libjni_system_ext"], |
| 329 | system_ext_specific: true |
| 330 | } |
| 331 | |
| 332 | android_app { |
| 333 | name: "test_app_product_jni_product", |
| 334 | sdk_version: "core_platform", |
| 335 | jni_libs: ["libjni_product"], |
| 336 | product_specific: true |
| 337 | } |
| 338 | |
| 339 | android_app { |
| 340 | name: "test_app_vendor_jni_odm", |
| 341 | sdk_version: "core_platform", |
| 342 | jni_libs: ["libjni_odm"], |
| 343 | soc_specific: true |
| 344 | } |
| 345 | |
| 346 | android_app { |
| 347 | name: "test_app_odm_jni_vendor", |
| 348 | sdk_version: "core_platform", |
| 349 | jni_libs: ["libjni_vendor"], |
| 350 | device_specific: true |
| 351 | } |
| 352 | android_app { |
| 353 | name: "test_app_system_jni_multiple", |
| 354 | privileged: true, |
| 355 | platform_apis: true, |
| 356 | certificate: "platform", |
| 357 | jni_libs: ["libjni_system", "libjni_system_ext"], |
| 358 | } |
| 359 | android_app { |
| 360 | name: "test_app_vendor_jni_multiple", |
| 361 | sdk_version: "core_platform", |
| 362 | jni_libs: ["libjni_odm", "libjni_vendor"], |
| 363 | soc_specific: true |
| 364 | } |
| 365 | ` |
| 366 | arch := "arm64" |
| 367 | ctx := android.GroupFixturePreparers( |
| 368 | PrepareForTestWithJavaDefaultModules, |
| 369 | cc.PrepareForTestWithCcDefaultModules, |
| 370 | android.PrepareForTestWithAndroidMk, |
| 371 | android.FixtureModifyConfig(func(config android.Config) { |
| 372 | config.TestProductVariables.DeviceArch = proptools.StringPtr(arch) |
| 373 | }), |
| 374 | ). |
| 375 | RunTestWithBp(t, bp) |
| 376 | testCases := []struct { |
| 377 | name string |
| 378 | partitionNames []string |
| 379 | partitionTags []string |
| 380 | }{ |
| 381 | {"test_app_system_jni_system", []string{"libjni_system"}, []string{""}}, |
| 382 | {"test_app_system_jni_system_ext", []string{"libjni_system_ext"}, []string{"_SYSTEM_EXT"}}, |
| 383 | {"test_app_system_ext_jni_system", []string{"libjni_system"}, []string{""}}, |
| 384 | {"test_app_system_ext_jni_system_ext", []string{"libjni_system_ext"}, []string{"_SYSTEM_EXT"}}, |
| 385 | {"test_app_product_jni_product", []string{"libjni_product"}, []string{"_PRODUCT"}}, |
| 386 | {"test_app_vendor_jni_odm", []string{"libjni_odm"}, []string{"_ODM"}}, |
| 387 | {"test_app_odm_jni_vendor", []string{"libjni_vendor"}, []string{"_VENDOR"}}, |
| 388 | {"test_app_system_jni_multiple", []string{"libjni_system", "libjni_system_ext"}, []string{"", "_SYSTEM_EXT"}}, |
| 389 | {"test_app_vendor_jni_multiple", []string{"libjni_odm", "libjni_vendor"}, []string{"_ODM", "_VENDOR"}}, |
| 390 | } |
| 391 | |
| 392 | for _, test := range testCases { |
| 393 | t.Run(test.name, func(t *testing.T) { |
| 394 | mod := ctx.ModuleForTests(test.name, "android_common").Module() |
| 395 | entry := android.AndroidMkEntriesForTest(t, ctx.TestContext, mod)[0] |
| 396 | for i := range test.partitionNames { |
| 397 | actual := entry.EntryMap["LOCAL_SOONG_JNI_LIBS_PARTITION_"+arch][i] |
| 398 | expected := test.partitionNames[i] + ":" + test.partitionTags[i] |
| 399 | android.AssertStringEquals(t, "Expected and actual differ", expected, actual) |
| 400 | } |
| 401 | }) |
| 402 | } |
| 403 | } |