Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 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 | |
| 15 | package filesystem |
| 16 | |
| 17 | import ( |
| 18 | "os" |
Cole Faust | 4a2a7c9 | 2024-03-12 12:44:40 -0700 | [diff] [blame] | 19 | "path/filepath" |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 20 | "testing" |
| 21 | |
| 22 | "android/soong/android" |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 23 | "android/soong/bpf" |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 24 | "android/soong/cc" |
Jooyung Han | e606759 | 2023-03-16 13:11:17 +0900 | [diff] [blame] | 25 | "android/soong/etc" |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 26 | "android/soong/java" |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 27 | "android/soong/phony" |
Jooyung Han | e606759 | 2023-03-16 13:11:17 +0900 | [diff] [blame] | 28 | |
| 29 | "github.com/google/blueprint/proptools" |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 30 | ) |
| 31 | |
| 32 | func TestMain(m *testing.M) { |
| 33 | os.Exit(m.Run()) |
| 34 | } |
| 35 | |
| 36 | var fixture = android.GroupFixturePreparers( |
| 37 | android.PrepareForIntegrationTestWithAndroid, |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 38 | android.PrepareForTestWithAndroidBuildComponents, |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 39 | bpf.PrepareForTestWithBpf, |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 40 | cc.PrepareForIntegrationTestWithCc, |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 41 | etc.PrepareForTestWithPrebuiltEtc, |
| 42 | java.PrepareForTestWithJavaBuildComponents, |
| 43 | java.PrepareForTestWithJavaDefaultModules, |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 44 | phony.PrepareForTestWithPhony, |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 45 | PrepareForTestWithFilesystemBuildComponents, |
| 46 | ) |
| 47 | |
| 48 | func TestFileSystemDeps(t *testing.T) { |
| 49 | result := fixture.RunTestWithBp(t, ` |
| 50 | android_filesystem { |
| 51 | name: "myfilesystem", |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 52 | multilib: { |
| 53 | common: { |
| 54 | deps: [ |
| 55 | "bpf.o", |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 56 | "phony", |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 57 | ], |
| 58 | }, |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 59 | lib32: { |
| 60 | deps: [ |
| 61 | "foo", |
| 62 | "libbar", |
| 63 | ], |
| 64 | }, |
| 65 | lib64: { |
| 66 | deps: [ |
| 67 | "libbar", |
| 68 | ], |
| 69 | }, |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 70 | }, |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 71 | compile_multilib: "both", |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | bpf { |
| 75 | name: "bpf.o", |
| 76 | srcs: ["bpf.c"], |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 77 | } |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 78 | |
| 79 | cc_binary { |
| 80 | name: "foo", |
| 81 | compile_multilib: "prefer32", |
| 82 | } |
| 83 | |
| 84 | cc_library { |
| 85 | name: "libbar", |
Jiyong Park | 8bcf3c6 | 2024-03-18 18:37:10 +0900 | [diff] [blame] | 86 | required: ["libbaz"], |
| 87 | } |
| 88 | |
| 89 | cc_library { |
| 90 | name: "libbaz", |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 91 | } |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 92 | |
| 93 | phony { |
| 94 | name: "phony", |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 95 | required: [ |
| 96 | "libquz", |
| 97 | "myapp", |
| 98 | ], |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | cc_library { |
| 102 | name: "libquz", |
| 103 | } |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 104 | |
| 105 | android_app { |
| 106 | name: "myapp", |
| 107 | platform_apis: true, |
| 108 | installable: true, |
| 109 | } |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 110 | `) |
| 111 | |
| 112 | // produces "myfilesystem.img" |
| 113 | result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img") |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 114 | |
| 115 | fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem) |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 116 | expected := []string{ |
Jiyong Park | 73e5bab | 2024-04-05 13:37:21 +0900 | [diff] [blame] | 117 | "app/myapp/myapp.apk", |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 118 | "bin/foo", |
| 119 | "lib/libbar.so", |
| 120 | "lib64/libbar.so", |
Jiyong Park | 8bcf3c6 | 2024-03-18 18:37:10 +0900 | [diff] [blame] | 121 | "lib64/libbaz.so", |
Jiyong Park | 9c540c8 | 2024-03-26 10:48:27 +0900 | [diff] [blame] | 122 | "lib64/libquz.so", |
Jiyong Park | eec7c38 | 2024-02-16 16:10:13 +0900 | [diff] [blame] | 123 | "etc/bpf/bpf.o", |
| 124 | } |
Jiyong Park | 06c4cdc | 2024-02-16 15:35:03 +0900 | [diff] [blame] | 125 | for _, e := range expected { |
| 126 | android.AssertStringListContains(t, "missing entry", fs.entries, e) |
| 127 | } |
Jooyung Han | 9706cbc | 2021-04-15 22:43:48 +0900 | [diff] [blame] | 128 | } |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 129 | |
Cole Faust | 4a2a7c9 | 2024-03-12 12:44:40 -0700 | [diff] [blame] | 130 | func TestIncludeMakeBuiltFiles(t *testing.T) { |
| 131 | result := fixture.RunTestWithBp(t, ` |
| 132 | android_filesystem { |
| 133 | name: "myfilesystem", |
| 134 | include_make_built_files: "system", |
| 135 | } |
| 136 | `) |
| 137 | |
| 138 | output := result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img") |
| 139 | |
| 140 | stampFile := filepath.Join(result.Config.OutDir(), "target/product/test_device/obj/PACKAGING/system_intermediates/staging_dir.stamp") |
| 141 | fileListFile := filepath.Join(result.Config.OutDir(), "target/product/test_device/obj/PACKAGING/system_intermediates/file_list.txt") |
| 142 | android.AssertStringListContains(t, "deps of filesystem must include the staging dir stamp file", output.Implicits.Strings(), stampFile) |
| 143 | android.AssertStringListContains(t, "deps of filesystem must include the staging dir file list", output.Implicits.Strings(), fileListFile) |
| 144 | } |
| 145 | |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 146 | func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) { |
| 147 | result := fixture.RunTestWithBp(t, ` |
Jooyung Han | 0fbbc2b | 2022-03-25 12:35:46 +0900 | [diff] [blame] | 148 | android_system_image { |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 149 | name: "myfilesystem", |
| 150 | deps: [ |
| 151 | "libfoo", |
Jooyung Han | 0fbbc2b | 2022-03-25 12:35:46 +0900 | [diff] [blame] | 152 | "libbar", |
Jiyong Park | fa61613 | 2021-04-20 11:36:40 +0900 | [diff] [blame] | 153 | ], |
| 154 | linker_config_src: "linker.config.json", |
| 155 | } |
| 156 | |
| 157 | cc_library { |
| 158 | name: "libfoo", |
| 159 | stubs: { |
| 160 | symbol_file: "libfoo.map.txt", |
| 161 | }, |
| 162 | } |
| 163 | |
| 164 | cc_library { |
| 165 | name: "libbar", |
| 166 | } |
| 167 | `) |
| 168 | |
| 169 | module := result.ModuleForTests("myfilesystem", "android_common") |
| 170 | output := module.Output("system/etc/linker.config.pb") |
| 171 | |
| 172 | android.AssertStringDoesContain(t, "linker.config.pb should have libfoo", |
| 173 | output.RuleParams.Command, "libfoo.so") |
| 174 | android.AssertStringDoesNotContain(t, "linker.config.pb should not have libbar", |
| 175 | output.RuleParams.Command, "libbar.so") |
| 176 | } |
Jooyung Han | 0fbbc2b | 2022-03-25 12:35:46 +0900 | [diff] [blame] | 177 | |
| 178 | func registerComponent(ctx android.RegistrationContext) { |
| 179 | ctx.RegisterModuleType("component", componentFactory) |
| 180 | } |
| 181 | |
| 182 | func componentFactory() android.Module { |
| 183 | m := &component{} |
| 184 | m.AddProperties(&m.properties) |
| 185 | android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) |
| 186 | return m |
| 187 | } |
| 188 | |
| 189 | type component struct { |
| 190 | android.ModuleBase |
| 191 | properties struct { |
| 192 | Install_copy_in_data []string |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func (c *component) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 197 | output := android.PathForModuleOut(ctx, c.Name()) |
| 198 | dir := android.PathForModuleInstall(ctx, "components") |
| 199 | ctx.InstallFile(dir, c.Name(), output) |
| 200 | |
| 201 | dataDir := android.PathForModuleInPartitionInstall(ctx, "data", "components") |
| 202 | for _, d := range c.properties.Install_copy_in_data { |
| 203 | ctx.InstallFile(dataDir, d, output) |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | func TestFileSystemGathersItemsOnlyInSystemPartition(t *testing.T) { |
| 208 | f := android.GroupFixturePreparers(fixture, android.FixtureRegisterWithContext(registerComponent)) |
| 209 | result := f.RunTestWithBp(t, ` |
| 210 | android_system_image { |
| 211 | name: "myfilesystem", |
| 212 | multilib: { |
| 213 | common: { |
| 214 | deps: ["foo"], |
| 215 | }, |
| 216 | }, |
| 217 | linker_config_src: "linker.config.json", |
| 218 | } |
| 219 | component { |
| 220 | name: "foo", |
| 221 | install_copy_in_data: ["bar"], |
| 222 | } |
| 223 | `) |
| 224 | |
| 225 | module := result.ModuleForTests("myfilesystem", "android_common").Module().(*systemImage) |
| 226 | android.AssertDeepEquals(t, "entries should have foo only", []string{"components/foo"}, module.entries) |
| 227 | } |
Jiyong Park | bc48548 | 2022-11-15 22:31:49 +0900 | [diff] [blame] | 228 | |
Alice Wang | 000e3a3 | 2023-01-03 16:11:20 +0000 | [diff] [blame] | 229 | func TestAvbGenVbmetaImage(t *testing.T) { |
| 230 | result := fixture.RunTestWithBp(t, ` |
| 231 | avb_gen_vbmeta_image { |
| 232 | name: "input_hashdesc", |
| 233 | src: "input.img", |
| 234 | partition_name: "input_partition_name", |
| 235 | salt: "2222", |
| 236 | }`) |
| 237 | cmd := result.ModuleForTests("input_hashdesc", "android_arm64_armv8-a").Rule("avbGenVbmetaImage").RuleParams.Command |
| 238 | android.AssertStringDoesContain(t, "Can't find correct --partition_name argument", |
| 239 | cmd, "--partition_name input_partition_name") |
| 240 | android.AssertStringDoesContain(t, "Can't find --do_not_append_vbmeta_image", |
| 241 | cmd, "--do_not_append_vbmeta_image") |
| 242 | android.AssertStringDoesContain(t, "Can't find --output_vbmeta_image", |
| 243 | cmd, "--output_vbmeta_image ") |
| 244 | android.AssertStringDoesContain(t, "Can't find --salt argument", |
| 245 | cmd, "--salt 2222") |
| 246 | } |
| 247 | |
Jiyong Park | bc48548 | 2022-11-15 22:31:49 +0900 | [diff] [blame] | 248 | func TestAvbAddHashFooter(t *testing.T) { |
| 249 | result := fixture.RunTestWithBp(t, ` |
Alice Wang | 000e3a3 | 2023-01-03 16:11:20 +0000 | [diff] [blame] | 250 | avb_gen_vbmeta_image { |
| 251 | name: "input_hashdesc", |
| 252 | src: "input.img", |
| 253 | partition_name: "input", |
| 254 | salt: "2222", |
| 255 | } |
| 256 | |
Jiyong Park | bc48548 | 2022-11-15 22:31:49 +0900 | [diff] [blame] | 257 | avb_add_hash_footer { |
| 258 | name: "myfooter", |
| 259 | src: "input.img", |
| 260 | filename: "output.img", |
| 261 | partition_name: "mypartition", |
| 262 | private_key: "mykey", |
| 263 | salt: "1111", |
| 264 | props: [ |
| 265 | { |
| 266 | name: "prop1", |
| 267 | value: "value1", |
| 268 | }, |
| 269 | { |
| 270 | name: "prop2", |
| 271 | file: "value_file", |
| 272 | }, |
| 273 | ], |
Alice Wang | 000e3a3 | 2023-01-03 16:11:20 +0000 | [diff] [blame] | 274 | include_descriptors_from_images: ["input_hashdesc"], |
Jiyong Park | bc48548 | 2022-11-15 22:31:49 +0900 | [diff] [blame] | 275 | } |
| 276 | `) |
| 277 | cmd := result.ModuleForTests("myfooter", "android_arm64_armv8-a").Rule("avbAddHashFooter").RuleParams.Command |
| 278 | android.AssertStringDoesContain(t, "Can't find correct --partition_name argument", |
| 279 | cmd, "--partition_name mypartition") |
| 280 | android.AssertStringDoesContain(t, "Can't find correct --key argument", |
| 281 | cmd, "--key mykey") |
| 282 | android.AssertStringDoesContain(t, "Can't find --salt argument", |
| 283 | cmd, "--salt 1111") |
| 284 | android.AssertStringDoesContain(t, "Can't find --prop argument", |
| 285 | cmd, "--prop 'prop1:value1'") |
| 286 | android.AssertStringDoesContain(t, "Can't find --prop_from_file argument", |
| 287 | cmd, "--prop_from_file 'prop2:value_file'") |
Alice Wang | 000e3a3 | 2023-01-03 16:11:20 +0000 | [diff] [blame] | 288 | android.AssertStringDoesContain(t, "Can't find --include_descriptors_from_image", |
| 289 | cmd, "--include_descriptors_from_image ") |
Jiyong Park | bc48548 | 2022-11-15 22:31:49 +0900 | [diff] [blame] | 290 | } |
Jooyung Han | 54f7805 | 2023-02-20 18:17:47 +0900 | [diff] [blame] | 291 | |
| 292 | func TestFileSystemShouldInstallCoreVariantIfTargetBuildAppsIsSet(t *testing.T) { |
| 293 | context := android.GroupFixturePreparers( |
| 294 | fixture, |
| 295 | android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { |
| 296 | variables.Unbundled_build_apps = []string{"bar"} |
| 297 | }), |
| 298 | ) |
| 299 | result := context.RunTestWithBp(t, ` |
| 300 | android_system_image { |
| 301 | name: "myfilesystem", |
| 302 | deps: [ |
| 303 | "libfoo", |
| 304 | ], |
| 305 | linker_config_src: "linker.config.json", |
| 306 | } |
| 307 | |
| 308 | cc_library { |
| 309 | name: "libfoo", |
| 310 | shared_libs: [ |
| 311 | "libbar", |
| 312 | ], |
| 313 | stl: "none", |
| 314 | } |
| 315 | |
| 316 | cc_library { |
| 317 | name: "libbar", |
| 318 | sdk_version: "9", |
| 319 | stl: "none", |
| 320 | } |
| 321 | `) |
| 322 | |
Cole Faust | 3b806d3 | 2024-03-11 15:15:03 -0700 | [diff] [blame] | 323 | inputs := result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img").Implicits |
Jooyung Han | 54f7805 | 2023-02-20 18:17:47 +0900 | [diff] [blame] | 324 | android.AssertStringListContains(t, "filesystem should have libbar even for unbundled build", |
| 325 | inputs.Strings(), |
| 326 | "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so") |
| 327 | } |
Jooyung Han | e606759 | 2023-03-16 13:11:17 +0900 | [diff] [blame] | 328 | |
| 329 | func TestFileSystemWithCoverageVariants(t *testing.T) { |
| 330 | context := android.GroupFixturePreparers( |
| 331 | fixture, |
| 332 | android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { |
| 333 | variables.GcovCoverage = proptools.BoolPtr(true) |
| 334 | variables.Native_coverage = proptools.BoolPtr(true) |
| 335 | }), |
| 336 | ) |
| 337 | |
| 338 | result := context.RunTestWithBp(t, ` |
| 339 | prebuilt_etc { |
| 340 | name: "prebuilt", |
| 341 | src: ":myfilesystem", |
| 342 | } |
| 343 | |
| 344 | android_system_image { |
| 345 | name: "myfilesystem", |
| 346 | deps: [ |
| 347 | "libfoo", |
| 348 | ], |
| 349 | linker_config_src: "linker.config.json", |
| 350 | } |
| 351 | |
| 352 | cc_library { |
| 353 | name: "libfoo", |
| 354 | shared_libs: [ |
| 355 | "libbar", |
| 356 | ], |
| 357 | stl: "none", |
| 358 | } |
| 359 | |
| 360 | cc_library { |
| 361 | name: "libbar", |
| 362 | stl: "none", |
| 363 | } |
| 364 | `) |
| 365 | |
| 366 | filesystem := result.ModuleForTests("myfilesystem", "android_common_cov") |
Cole Faust | 3b806d3 | 2024-03-11 15:15:03 -0700 | [diff] [blame] | 367 | inputs := filesystem.Output("myfilesystem.img").Implicits |
Jooyung Han | e606759 | 2023-03-16 13:11:17 +0900 | [diff] [blame] | 368 | android.AssertStringListContains(t, "filesystem should have libfoo(cov)", |
| 369 | inputs.Strings(), |
| 370 | "out/soong/.intermediates/libfoo/android_arm64_armv8-a_shared_cov/libfoo.so") |
| 371 | android.AssertStringListContains(t, "filesystem should have libbar(cov)", |
| 372 | inputs.Strings(), |
| 373 | "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared_cov/libbar.so") |
| 374 | |
| 375 | filesystemOutput := filesystem.Output("myfilesystem.img").Output |
| 376 | prebuiltInput := result.ModuleForTests("prebuilt", "android_arm64_armv8-a").Rule("Cp").Input |
| 377 | if filesystemOutput != prebuiltInput { |
| 378 | t.Error("prebuilt should use cov variant of filesystem") |
| 379 | } |
| 380 | } |
Jiyong Park | eaac823 | 2024-03-31 21:27:45 +0900 | [diff] [blame] | 381 | |
| 382 | func TestSystemImageDefaults(t *testing.T) { |
| 383 | result := fixture.RunTestWithBp(t, ` |
Jiyong Park | f46b1af | 2024-04-05 18:13:33 +0900 | [diff] [blame] | 384 | android_filesystem_defaults { |
Jiyong Park | eaac823 | 2024-03-31 21:27:45 +0900 | [diff] [blame] | 385 | name: "defaults", |
| 386 | multilib: { |
| 387 | common: { |
| 388 | deps: [ |
| 389 | "phony", |
| 390 | ], |
| 391 | }, |
| 392 | lib64: { |
| 393 | deps: [ |
| 394 | "libbar", |
| 395 | ], |
| 396 | }, |
| 397 | }, |
| 398 | compile_multilib: "both", |
| 399 | } |
| 400 | |
| 401 | android_system_image { |
| 402 | name: "system", |
| 403 | defaults: ["defaults"], |
| 404 | multilib: { |
| 405 | lib32: { |
| 406 | deps: [ |
| 407 | "foo", |
| 408 | "libbar", |
| 409 | ], |
| 410 | }, |
| 411 | }, |
| 412 | } |
| 413 | |
| 414 | cc_binary { |
| 415 | name: "foo", |
| 416 | compile_multilib: "prefer32", |
| 417 | } |
| 418 | |
| 419 | cc_library { |
| 420 | name: "libbar", |
| 421 | required: ["libbaz"], |
| 422 | } |
| 423 | |
| 424 | cc_library { |
| 425 | name: "libbaz", |
| 426 | } |
| 427 | |
| 428 | phony { |
| 429 | name: "phony", |
| 430 | required: ["libquz"], |
| 431 | } |
| 432 | |
| 433 | cc_library { |
| 434 | name: "libquz", |
| 435 | } |
| 436 | `) |
| 437 | |
| 438 | fs := result.ModuleForTests("system", "android_common").Module().(*systemImage) |
| 439 | expected := []string{ |
| 440 | "bin/foo", |
| 441 | "lib/libbar.so", |
| 442 | "lib64/libbar.so", |
| 443 | "lib64/libbaz.so", |
| 444 | "lib64/libquz.so", |
| 445 | } |
| 446 | for _, e := range expected { |
| 447 | android.AssertStringListContains(t, "missing entry", fs.entries, e) |
| 448 | } |
| 449 | } |
Jiyong Park | f46b1af | 2024-04-05 18:13:33 +0900 | [diff] [blame] | 450 | |
| 451 | func TestInconsistentPartitionTypesInDefaults(t *testing.T) { |
| 452 | fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern( |
| 453 | "doesn't match with the partition type")). |
| 454 | RunTestWithBp(t, ` |
| 455 | android_filesystem_defaults { |
| 456 | name: "system_ext_def", |
| 457 | partition_type: "system_ext", |
| 458 | } |
| 459 | |
| 460 | android_filesystem_defaults { |
| 461 | name: "system_def", |
| 462 | partition_type: "system", |
| 463 | defaults: ["system_ext_def"], |
| 464 | } |
| 465 | |
| 466 | android_system_image { |
| 467 | name: "system", |
| 468 | defaults: ["system_def"], |
| 469 | } |
| 470 | `) |
| 471 | } |