1// Copyright 2021 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 15package filesystem 16 17import ( 18 "os" 19 "testing" 20 21 "android/soong/android" 22 "android/soong/bpf" 23 "android/soong/cc" 24 "android/soong/etc" 25 "android/soong/java" 26 "android/soong/phony" 27 28 "github.com/google/blueprint/proptools" 29) 30 31func TestMain(m *testing.M) { 32 os.Exit(m.Run()) 33} 34 35var fixture = android.GroupFixturePreparers( 36 android.PrepareForIntegrationTestWithAndroid, 37 android.PrepareForTestWithAndroidBuildComponents, 38 bpf.PrepareForTestWithBpf, 39 cc.PrepareForIntegrationTestWithCc, 40 etc.PrepareForTestWithPrebuiltEtc, 41 java.PrepareForTestWithJavaBuildComponents, 42 java.PrepareForTestWithJavaDefaultModules, 43 phony.PrepareForTestWithPhony, 44 PrepareForTestWithFilesystemBuildComponents, 45) 46 47func TestFileSystemDeps(t *testing.T) { 48 result := fixture.RunTestWithBp(t, ` 49 android_filesystem { 50 name: "myfilesystem", 51 multilib: { 52 common: { 53 deps: [ 54 "bpf.o", 55 "phony", 56 ], 57 }, 58 lib32: { 59 deps: [ 60 "foo", 61 "libbar", 62 ], 63 }, 64 lib64: { 65 deps: [ 66 "libbar", 67 ], 68 }, 69 }, 70 compile_multilib: "both", 71 } 72 73 bpf { 74 name: "bpf.o", 75 srcs: ["bpf.c"], 76 } 77 78 cc_binary { 79 name: "foo", 80 compile_multilib: "prefer32", 81 } 82 83 cc_library { 84 name: "libbar", 85 required: ["libbaz"], 86 target: { 87 platform: { 88 required: ["lib_platform_only"], 89 }, 90 }, 91 } 92 93 cc_library { 94 name: "libbaz", 95 } 96 97 cc_library { 98 name: "lib_platform_only", 99 } 100 101 phony { 102 name: "phony", 103 required: [ 104 "libquz", 105 "myapp", 106 ], 107 } 108 109 cc_library { 110 name: "libquz", 111 } 112 113 android_app { 114 name: "myapp", 115 platform_apis: true, 116 installable: true, 117 } 118 `) 119 120 // produces "myfilesystem.img" 121 result.ModuleForTests(t, "myfilesystem", "android_common").Output("myfilesystem.img") 122 123 fs := result.ModuleForTests(t, "myfilesystem", "android_common").Module().(*filesystem) 124 expected := []string{ 125 "app/myapp/myapp.apk", 126 "bin/foo", 127 "lib/libbar.so", 128 "lib64/libbar.so", 129 "lib64/libbaz.so", 130 "lib64/libquz.so", 131 "lib64/lib_platform_only.so", 132 "etc/bpf/bpf.o", 133 } 134 for _, e := range expected { 135 android.AssertStringListContains(t, "missing entry", fs.entries, e) 136 } 137} 138 139func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { 140 result := fixture.RunTestWithBp(t, ` 141 android_system_image { 142 name: "myfilesystem", 143 base_dir: "system", 144 deps: [ 145 "libfoo", 146 "libbar", 147 ], 148 linker_config: { 149 gen_linker_config: true, 150 linker_config_srcs: ["linker.config.json"], 151 }, 152 } 153 154 cc_library { 155 name: "libfoo", 156 stubs: { 157 symbol_file: "libfoo.map.txt", 158 }, 159 } 160 161 cc_library { 162 name: "libbar", 163 } 164 `) 165 166 module := result.ModuleForTests(t, "myfilesystem", "android_common") 167 output := module.Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb") 168 169 linkerConfigCommand := output.RuleParams.Command 170 171 android.AssertStringDoesContain(t, "linker.config.pb should have libfoo", 172 linkerConfigCommand, "libfoo.so") 173 android.AssertStringDoesNotContain(t, "linker.config.pb should not have libbar", 174 linkerConfigCommand, "libbar.so") 175} 176 177func registerComponent(ctx android.RegistrationContext) { 178 ctx.RegisterModuleType("component", componentFactory) 179} 180 181func componentFactory() android.Module { 182 m := &component{} 183 m.AddProperties(&m.properties) 184 android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) 185 return m 186} 187 188type component struct { 189 android.ModuleBase 190 properties struct { 191 Install_copy_in_data []string 192 } 193} 194 195func (c *component) GenerateAndroidBuildActions(ctx android.ModuleContext) { 196 output := android.PathForModuleOut(ctx, c.Name()) 197 dir := android.PathForModuleInstall(ctx, "components") 198 ctx.InstallFile(dir, c.Name(), output) 199 200 dataDir := android.PathForModuleInPartitionInstall(ctx, "data", "components") 201 for _, d := range c.properties.Install_copy_in_data { 202 ctx.InstallFile(dataDir, d, output) 203 } 204} 205 206func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) { 207 f := android.GroupFixturePreparers(fixture, android.FixtureRegisterWithContext(registerComponent)) 208 result := f.RunTestWithBp(t, ` 209 android_system_image { 210 name: "myfilesystem", 211 multilib: { 212 common: { 213 deps: ["foo"], 214 }, 215 }, 216 linker_config: { 217 gen_linker_config: true, 218 linker_config_srcs: ["linker.config.json"], 219 }, 220 } 221 component { 222 name: "foo", 223 install_copy_in_data: ["bar"], 224 } 225 `) 226 227 module := result.ModuleForTests(t, "myfilesystem", "android_common").Module().(*systemImage) 228 android.AssertDeepEquals(t, "entries should have foo and not bar", []string{"components/foo", "etc/linker.config.pb"}, module.entries) 229} 230 231func TestAvbGenVbmetaImage(t *testing.T) { 232 result := fixture.RunTestWithBp(t, ` 233 avb_gen_vbmeta_image { 234 name: "input_hashdesc", 235 src: "input.img", 236 partition_name: "input_partition_name", 237 salt: "2222", 238 }`) 239 cmd := result.ModuleForTests(t, "input_hashdesc", "android_arm64_armv8-a").Rule("avbGenVbmetaImage").RuleParams.Command 240 android.AssertStringDoesContain(t, "Can't find correct --partition_name argument", 241 cmd, "--partition_name input_partition_name") 242 android.AssertStringDoesContain(t, "Can't find --do_not_append_vbmeta_image", 243 cmd, "--do_not_append_vbmeta_image") 244 android.AssertStringDoesContain(t, "Can't find --output_vbmeta_image", 245 cmd, "--output_vbmeta_image ") 246 android.AssertStringDoesContain(t, "Can't find --salt argument", 247 cmd, "--salt 2222") 248} 249 250func TestAvbAddHashFooter(t *testing.T) { 251 result := fixture.RunTestWithBp(t, ` 252 avb_gen_vbmeta_image { 253 name: "input_hashdesc", 254 src: "input.img", 255 partition_name: "input", 256 salt: "2222", 257 } 258 259 avb_add_hash_footer { 260 name: "myfooter", 261 src: "input.img", 262 filename: "output.img", 263 partition_name: "mypartition", 264 private_key: "mykey", 265 salt: "1111", 266 props: [ 267 { 268 name: "prop1", 269 value: "value1", 270 }, 271 { 272 name: "prop2", 273 file: "value_file", 274 }, 275 ], 276 include_descriptors_from_images: ["input_hashdesc"], 277 } 278 `) 279 cmd := result.ModuleForTests(t, "myfooter", "android_arm64_armv8-a").Rule("avbAddHashFooter").RuleParams.Command 280 android.AssertStringDoesContain(t, "Can't find correct --partition_name argument", 281 cmd, "--partition_name mypartition") 282 android.AssertStringDoesContain(t, "Can't find correct --key argument", 283 cmd, "--key mykey") 284 android.AssertStringDoesContain(t, "Can't find --salt argument", 285 cmd, "--salt 1111") 286 android.AssertStringDoesContain(t, "Can't find --prop argument", 287 cmd, "--prop 'prop1:value1'") 288 android.AssertStringDoesContain(t, "Can't find --prop_from_file argument", 289 cmd, "--prop_from_file 'prop2:value_file'") 290 android.AssertStringDoesContain(t, "Can't find --include_descriptors_from_image", 291 cmd, "--include_descriptors_from_image ") 292} 293 294func TestFileSystemWithCoverageVariants(t *testing.T) { 295 context := android.GroupFixturePreparers( 296 fixture, 297 android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { 298 variables.GcovCoverage = proptools.BoolPtr(true) 299 variables.Native_coverage = proptools.BoolPtr(true) 300 }), 301 ) 302 303 result := context.RunTestWithBp(t, ` 304 prebuilt_etc { 305 name: "prebuilt", 306 src: ":myfilesystem", 307 } 308 309 android_system_image { 310 name: "myfilesystem", 311 deps: [ 312 "libfoo", 313 ], 314 linker_config: { 315 gen_linker_config: true, 316 linker_config_srcs: ["linker.config.json"], 317 }, 318 } 319 320 cc_library { 321 name: "libfoo", 322 shared_libs: [ 323 "libbar", 324 ], 325 stl: "none", 326 } 327 328 cc_library { 329 name: "libbar", 330 stl: "none", 331 } 332 `) 333 334 filesystem := result.ModuleForTests(t, "myfilesystem", "android_common_cov") 335 inputs := filesystem.Output("staging_dir.timestamp").Implicits 336 android.AssertStringListContains(t, "filesystem should have libfoo(cov)", 337 inputs.Strings(), 338 "out/soong/.intermediates/libfoo/android_arm64_armv8-a_shared_cov/libfoo.so") 339 android.AssertStringListContains(t, "filesystem should have libbar(cov)", 340 inputs.Strings(), 341 "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared_cov/libbar.so") 342 343 filesystemOutput := filesystem.OutputFiles(result.TestContext, t, "")[0] 344 prebuiltInput := result.ModuleForTests(t, "prebuilt", "android_arm64_armv8-a").Rule("Cp").Input 345 if filesystemOutput != prebuiltInput { 346 t.Error("prebuilt should use cov variant of filesystem") 347 } 348} 349 350func TestSystemImageDefaults(t *testing.T) { 351 result := fixture.RunTestWithBp(t, ` 352 android_filesystem_defaults { 353 name: "defaults", 354 multilib: { 355 common: { 356 deps: [ 357 "phony", 358 ], 359 }, 360 lib64: { 361 deps: [ 362 "libbar", 363 ], 364 }, 365 }, 366 compile_multilib: "both", 367 } 368 369 android_system_image { 370 name: "system", 371 defaults: ["defaults"], 372 multilib: { 373 lib32: { 374 deps: [ 375 "foo", 376 "libbar", 377 ], 378 }, 379 }, 380 } 381 382 cc_binary { 383 name: "foo", 384 compile_multilib: "prefer32", 385 } 386 387 cc_library { 388 name: "libbar", 389 required: ["libbaz"], 390 } 391 392 cc_library { 393 name: "libbaz", 394 } 395 396 phony { 397 name: "phony", 398 required: ["libquz"], 399 } 400 401 cc_library { 402 name: "libquz", 403 } 404 `) 405 406 fs := result.ModuleForTests(t, "system", "android_common").Module().(*systemImage) 407 expected := []string{ 408 "bin/foo", 409 "lib/libbar.so", 410 "lib64/libbar.so", 411 "lib64/libbaz.so", 412 "lib64/libquz.so", 413 } 414 for _, e := range expected { 415 android.AssertStringListContains(t, "missing entry", fs.entries, e) 416 } 417} 418 419func TestInconsistentPartitionTypesInDefaults(t *testing.T) { 420 fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern( 421 "doesn't match with the partition type")). 422 RunTestWithBp(t, ` 423 android_filesystem_defaults { 424 name: "system_ext_def", 425 partition_type: "system_ext", 426 } 427 428 android_filesystem_defaults { 429 name: "system_def", 430 partition_type: "system", 431 defaults: ["system_ext_def"], 432 } 433 434 android_system_image { 435 name: "system", 436 defaults: ["system_def"], 437 } 438 `) 439} 440 441func TestPreventDuplicatedEntries(t *testing.T) { 442 fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern( 443 "packaging conflict at")). 444 RunTestWithBp(t, ` 445 android_filesystem { 446 name: "fs", 447 deps: [ 448 "foo", 449 "foo_dup", 450 ], 451 } 452 453 cc_binary { 454 name: "foo", 455 } 456 457 cc_binary { 458 name: "foo_dup", 459 stem: "foo", 460 } 461 `) 462} 463 464func TestTrackPhonyAsRequiredDep(t *testing.T) { 465 result := fixture.RunTestWithBp(t, ` 466 android_filesystem { 467 name: "fs", 468 deps: ["foo"], 469 } 470 471 cc_binary { 472 name: "foo", 473 required: ["phony"], 474 } 475 476 phony { 477 name: "phony", 478 required: ["libbar"], 479 } 480 481 cc_library { 482 name: "libbar", 483 } 484 `) 485 486 fs := result.ModuleForTests(t, "fs", "android_common").Module().(*filesystem) 487 expected := []string{ 488 "bin/foo", 489 "lib64/libbar.so", 490 } 491 for _, e := range expected { 492 android.AssertStringListContains(t, "missing entry", fs.entries, e) 493 } 494} 495 496func TestFilterOutUnsupportedArches(t *testing.T) { 497 result := fixture.RunTestWithBp(t, ` 498 android_filesystem { 499 name: "fs_64_only", 500 deps: ["foo"], 501 } 502 503 android_filesystem { 504 name: "fs_64_32", 505 compile_multilib: "both", 506 deps: ["foo"], 507 } 508 509 cc_binary { 510 name: "foo", 511 required: ["phony"], 512 } 513 514 phony { 515 name: "phony", 516 required: [ 517 "libbar", 518 "app", 519 ], 520 } 521 522 cc_library { 523 name: "libbar", 524 } 525 526 android_app { 527 name: "app", 528 srcs: ["a.java"], 529 platform_apis: true, 530 } 531 `) 532 testcases := []struct { 533 fsName string 534 expected []string 535 unexpected []string 536 }{ 537 { 538 fsName: "fs_64_only", 539 expected: []string{"app/app/app.apk", "bin/foo", "lib64/libbar.so"}, 540 unexpected: []string{"lib/libbar.so"}, 541 }, 542 { 543 fsName: "fs_64_32", 544 expected: []string{"app/app/app.apk", "bin/foo", "lib64/libbar.so", "lib/libbar.so"}, 545 unexpected: []string{}, 546 }, 547 } 548 for _, c := range testcases { 549 fs := result.ModuleForTests(t, c.fsName, "android_common").Module().(*filesystem) 550 for _, e := range c.expected { 551 android.AssertStringListContains(t, "missing entry", fs.entries, e) 552 } 553 for _, e := range c.unexpected { 554 android.AssertStringListDoesNotContain(t, "unexpected entry", fs.entries, e) 555 } 556 } 557} 558 559func TestErofsPartition(t *testing.T) { 560 result := fixture.RunTestWithBp(t, ` 561 android_filesystem { 562 name: "erofs_partition", 563 type: "erofs", 564 erofs: { 565 compressor: "lz4hc,9", 566 compress_hints: "compress_hints.txt", 567 }, 568 deps: ["binfoo"], 569 } 570 571 cc_binary { 572 name: "binfoo", 573 } 574 `) 575 576 partition := result.ModuleForTests(t, "erofs_partition", "android_common") 577 buildImageConfig := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("prop_pre_processing")) 578 android.AssertStringDoesContain(t, "erofs fs type", buildImageConfig, "fs_type=erofs") 579 android.AssertStringDoesContain(t, "erofs fs type compress algorithm", buildImageConfig, "erofs_default_compressor=lz4hc,9") 580 android.AssertStringDoesContain(t, "erofs fs type compress hint", buildImageConfig, "erofs_default_compress_hints=compress_hints.txt") 581 android.AssertStringDoesContain(t, "erofs fs type sparse", buildImageConfig, "erofs_sparse_flag=-s") 582} 583 584func TestF2fsPartition(t *testing.T) { 585 result := fixture.RunTestWithBp(t, ` 586 android_filesystem { 587 name: "f2fs_partition", 588 type: "f2fs", 589 } 590 `) 591 592 partition := result.ModuleForTests(t, "f2fs_partition", "android_common") 593 buildImageConfig := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("prop_pre_processing")) 594 android.AssertStringDoesContain(t, "f2fs fs type", buildImageConfig, "fs_type=f2fs") 595 android.AssertStringDoesContain(t, "f2fs fs type sparse", buildImageConfig, "f2fs_sparse_flag=-S") 596} 597 598func TestFsTypesPropertyError(t *testing.T) { 599 fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern( 600 "erofs: erofs is non-empty, but FS type is f2fs\n. Please delete erofs properties if this partition should use f2fs\n")). 601 RunTestWithBp(t, ` 602 android_filesystem { 603 name: "f2fs_partition", 604 type: "f2fs", 605 erofs: { 606 compressor: "lz4hc,9", 607 compress_hints: "compress_hints.txt", 608 }, 609 } 610 `) 611} 612 613// If a system_ext/ module depends on system/ module, the dependency should *not* 614// be installed in system_ext/ 615func TestDoNotPackageCrossPartitionDependencies(t *testing.T) { 616 t.Skip() // TODO (spandandas): Re-enable this 617 result := fixture.RunTestWithBp(t, ` 618 android_filesystem { 619 name: "myfilesystem", 620 deps: ["binfoo"], 621 partition_type: "system_ext", 622 } 623 624 cc_binary { 625 name: "binfoo", 626 shared_libs: ["libfoo"], 627 system_ext_specific: true, 628 } 629 cc_library_shared { 630 name: "libfoo", // installed in system/ 631 } 632 `) 633 634 partition := result.ModuleForTests(t, "myfilesystem", "android_common") 635 fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) 636 android.AssertDeepEquals(t, "filesystem with dependencies on different partition", "bin/binfoo\n", fileList) 637} 638 639// If a cc_library is listed in `deps`, and it has a shared and static variant, then the shared variant 640// should be installed. 641func TestUseSharedVariationOfNativeLib(t *testing.T) { 642 result := fixture.RunTestWithBp(t, ` 643 android_filesystem { 644 name: "myfilesystem", 645 deps: ["libfoo"], 646 } 647 // cc_library will create a static and shared variant. 648 cc_library { 649 name: "libfoo", 650 } 651 `) 652 653 partition := result.ModuleForTests(t, "myfilesystem", "android_common") 654 fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) 655 android.AssertDeepEquals(t, "cc_library listed in deps", 656 "lib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo.so\nlib64/libm.so\n", 657 fileList) 658} 659 660// binfoo1 overrides binbar. transitive deps of binbar should not be installed. 661func TestDoNotInstallTransitiveDepOfOverriddenModule(t *testing.T) { 662 result := fixture.RunTestWithBp(t, ` 663android_filesystem { 664 name: "myfilesystem", 665 deps: ["binfoo1", "libfoo2", "binbar"], 666} 667cc_binary { 668 name: "binfoo1", 669 shared_libs: ["libfoo"], 670 overrides: ["binbar"], 671} 672cc_library { 673 name: "libfoo", 674} 675cc_library { 676 name: "libfoo2", 677 overrides: ["libfoo"], 678} 679// binbar gets overridden by binfoo1 680// therefore, libbar should not be installed 681cc_binary { 682 name: "binbar", 683 shared_libs: ["libbar"] 684} 685cc_library { 686 name: "libbar", 687} 688 `) 689 690 partition := result.ModuleForTests(t, "myfilesystem", "android_common") 691 fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) 692 android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed", 693 "bin/binfoo1\nlib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n", 694 fileList) 695} 696 697func TestInstallLinkerConfigFile(t *testing.T) { 698 result := fixture.RunTestWithBp(t, ` 699android_filesystem { 700 name: "myfilesystem", 701 deps: ["libfoo_has_no_stubs", "libfoo_has_stubs"], 702 linker_config: { 703 gen_linker_config: true, 704 linker_config_srcs: ["linker.config.json"], 705 }, 706 partition_type: "vendor", 707} 708cc_library { 709 name: "libfoo_has_no_stubs", 710 vendor: true, 711} 712cc_library { 713 name: "libfoo_has_stubs", 714 stubs: {symbol_file: "libfoo.map.txt"}, 715 vendor: true, 716} 717 `) 718 719 linkerConfigCmd := result.ModuleForTests(t, "myfilesystem", "android_common").Output("out/soong/.intermediates/myfilesystem/android_common/linker.config.pb").RuleParams.Command 720 android.AssertStringDoesContain(t, "Could not find linker.config.json file in cmd", linkerConfigCmd, "conv_linker_config proto --force -s linker.config.json") 721 android.AssertStringDoesContain(t, "Could not find stub in `provideLibs`", linkerConfigCmd, "--key provideLibs --value libfoo_has_stubs.so") 722} 723 724// override_android_* modules implicitly override their base module. 725// If both of these are listed in `deps`, the base module should not be installed. 726// Also, required deps should be updated too. 727func TestOverrideModulesInDeps(t *testing.T) { 728 result := fixture.RunTestWithBp(t, ` 729 cc_library_shared { 730 name: "libfoo", 731 stl: "none", 732 system_shared_libs: [], 733 } 734 cc_library_shared { 735 name: "libbar", 736 stl: "none", 737 system_shared_libs: [], 738 } 739 phony { 740 name: "myapp_phony", 741 required: ["myapp"], 742 } 743 phony { 744 name: "myoverrideapp_phony", 745 required: ["myoverrideapp"], 746 } 747 android_app { 748 name: "myapp", 749 platform_apis: true, 750 required: ["libfoo"], 751 } 752 override_android_app { 753 name: "myoverrideapp", 754 base: "myapp", 755 required: ["libbar"], 756 } 757 android_filesystem { 758 name: "myfilesystem", 759 deps: ["myapp"], 760 } 761 android_filesystem { 762 name: "myfilesystem_overridden", 763 deps: ["myapp", "myoverrideapp"], 764 } 765 android_filesystem { 766 name: "myfilesystem_overridden_indirect", 767 deps: ["myapp_phony", "myoverrideapp_phony"], 768 } 769 `) 770 771 partition := result.ModuleForTests(t, "myfilesystem", "android_common") 772 fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) 773 android.AssertStringEquals(t, "filesystem without override app", "app/myapp/myapp.apk\nlib64/libfoo.so\n", fileList) 774 775 for _, overridden := range []string{"myfilesystem_overridden", "myfilesystem_overridden_indirect"} { 776 overriddenPartition := result.ModuleForTests(t, overridden, "android_common") 777 overriddenFileList := android.ContentFromFileRuleForTests(t, result.TestContext, overriddenPartition.Output("fileList")) 778 android.AssertStringEquals(t, "filesystem with "+overridden, "app/myoverrideapp/myoverrideapp.apk\nlib64/libbar.so\n", overriddenFileList) 779 } 780} 781 782func TestRamdiskPartitionSetsDevNodes(t *testing.T) { 783 result := android.GroupFixturePreparers( 784 fixture, 785 android.FixtureMergeMockFs(android.MockFS{ 786 "ramdisk_node_list": nil, 787 }), 788 ).RunTestWithBp(t, ` 789 android_filesystem { 790 name: "ramdisk_filesystem", 791 partition_name: "ramdisk", 792 } 793 filegroup { 794 name: "ramdisk_node_list", 795 srcs: ["ramdisk_node_list"], 796 } 797 `) 798 799 android.AssertBoolEquals( 800 t, 801 "Generated ramdisk image expected to depend on \"ramdisk_node_list\" module", 802 true, 803 java.CheckModuleHasDependency(t, result.TestContext, "ramdisk_filesystem", "android_common", "ramdisk_node_list"), 804 ) 805} 806