summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
AgeCommit message (Collapse)Author
2025-03-20Fix overridden deps to be skipped correctly Inseob Kim
Current implementation only checks the name of the direct child and the owner of the packaging spec. But this can cause unintentionally installing unnecessary dependencies of overridden modules. This can be fixed by 1) gathering all overridden modules, 2) walking deps with skipping overridden modules, and 3) installing packages from visitied modules only. Bug: 330141242 Test: TH Test: try building pixel system image Change-Id: I4a646941b61e890b5cd2c9aa137e74c80777f837
2025-03-14Move requiredDeps to OverridableDepsMutator Inseob Kim
Required properties can be overridden too. This adds requiredDeps in OverridablePropertiesDepsMutator for modules like override_apex. Bug: 398089235 Test: m nothing --no-skip-soong-tests Test: boot cuttlefish, TH Change-Id: I996543764b86136b8f8ae4427f5f977c7ac6553b
2025-02-12Don't panic in ModuleForTests and friends Colin Cross
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
2025-02-12Include hermetic .img files in target_files.zip Spandan Das
https://r.android.com/3470135 disabled target_files.zip generation since the previous implementation built two copies of .img files when building droid. This increased full build times slightly. This CL adds the build rule for creating the hermetic version of .img files, but keeps it outside the transitive closure of droid. Implementation details - Split the monolithic cmd into three - cmd1 assembles the staging dir and creates a timestamp file - cmd2 depends on timestamp file and creates .img file using build_image - cmd3 depends on timestamp file and creates a hermetic .img file using build_image. It does so by creating an intermediate propfile with `use_fixed_timestamp=true` Bug: 393203512 Test: Built the soong target_files.zip locally (There are some preexisting diffs with the make target_files.zip, which I will resolve in ongoing work) Change-Id: Ibd14da93a6534d5544deffa2c44bac3fb97052ad
2025-01-15Remove Include_make_built_files Cole Faust
We're not using this anytime soon, so just remove it for now. Bug: 390269431 Test: m nothing Change-Id: I51bbf104dceabafc08d562cfecb31a845cb88d12
2025-01-15Create build rules for hermetic .img files Spandan Das
Make packaging generates build rules for two $partition.img files 1. Containing inodes with build timestamps 2. Containing inodes with pinned timestamps The former is useful for adb sync. The latter is used for target_files.zip. This CL creates a build rule to generate (2) with soong `filesystem` modules. The propFile for (2) will be created by concat'ing the propFile for (1) with `use_fixed_timestamp=true` Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_device/android_x86_64_silvermont/target_files.zip out/target/product/vsoc_x86_64/obj/PACKAGING/target_files_intermediates/aosp_cf_x86_64_phone-target_files.zip Test: diff -r out/target/product/vsoc_x86_64/obj/PACKAGING/target_files_intermediates/aosp_cf_x86_64_phone-target_files/ out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_device/android_x86_64_silvermont/target_files_dir/ --no-dereference - super_empty.img and system_other.img are missing - vbmeta*, boot* and userdata have binary diffs - the rest are identical Change-Id: If078220f215693660796090eb9b690b0ad41fd38
2024-12-13Make BuildLinkerConfig run in its own action Cole Faust
We should probably do this change for more parts of the filesystem RuleBuilder. Moving the linker config action out of the filesystem rulebuilder allows it to run in parallel with opther actions, and not rerun every time the filesystem is rebuilt. Bug: 384091387 Test: Presubmits Change-Id: Ic7305c555260fb5d9900c6c709b6c81dc0708d2b
2024-12-11Reapply "Use partition intead of "root" to assemble filesystem artifacts" Spandan Das
This reverts commit 135904463f96f81bd7ef7696569b02ebb61c8195. The revert will be applied alongside a change in build/make that ensures that the correct intermediates dir for aosp_shared_system_image is packged into target_files.zip Test: Previously failing OTA test now passes https://android-build.corp.google.com/builds/abtd/run/L04100030008317770 Change-Id: Ibdf3ae42348ec5840dcada8ce3182f87d4619cac
2024-12-10Revert "Use partition intead of "root" to assemble filesystem artifacts" Liana Kazanova
This reverts commit 95db4499428f421571819699d92581e7422e7659. Reason for revert: DroidMonitor: Potential culprit for http://b/383376688 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I0d15b234381278f54e0504473d82ec4f14f81fac
2024-12-10Use partition intead of "root" to assemble filesystem artifacts Spandan Das
The artifacts for filesystem packaging are currently assembled in ``` $intermediates/$module/android_common/root/$base_dir ``` This CL changes this to ``` $intermediates/$module/android_common/$partition/$base_dir e.g. $intermediates/$module/android_common/system/system (system) $intermediates/$module/android_common/system_ext (system_ext) ``` The motivatiton for this change is to fix diffs in BuildManifestSystemExt.apk. The build_manifest.pb of this apk is generated from the base of $PRODUCT_OUT. This means that the paths of the artifacts contains the partition prefix. diff https://diff.googleplex.com/#key=9xuSx7nvP251 An alternative would be to use partition as the `Base_dir`, but this would create an additional top-level directory in the soong img files (make img files do not have a top-level partition directory for non system images) Test: 383144733 Bug: Built and mounted make and soong system_ext.img for AOSP CP. NOTICE is the last diff Change-Id: Iee53113a7e00dcda9d987f2aabf9605740bbe7fe
2024-12-05Remove Base_dir from non system non recovery filesystem Spandan Das
vendor.img/product.img... built by make do not assemble the artifacts in a $partition subdirectory. This CL adds this to soong built img files, and updates the symmlinks. Test: soong_generated_system_filesystem_test m soong_generated_vendor_filesystem_test soong_generated_product_filesystem_test Change-Id: Ia5feaf85bb49d552b93698c50998d8df7575e44a
2024-12-04Fixes for avb flags in soong-generated partitions Cole Faust
The logic for what variables control what aspect of AVB is pretty complicated, this brings make and soong closer together. Bug: 381120092 Test: m out/soong/.intermediates/build/soong/fsgen/aosp_cf_x86_64_phone_generated_system_image/android_common/prop, diff with make's prop file Change-Id: I6ada90262f4578d120c35b7f8d38c06c2b1d9c27
2024-12-02Support long commands in RuleBuilder Cole Faust
If a command exceeds the linux max command line length, it will be put into a script instead. Fixes: 380945706 Test: Presubmits Change-Id: I9bc4b293d6d638b38e7fb11e6c2bc35196306d9f
2024-11-18Specify dev nodes list file for ramdisk partition generation Jihoon Kang
Ramdisk partition requires "-n" argument to be passed when generating the image file. Given that the value is agnostic to the target product and is set to a constant value, this is implicitly set internally in filesystem module. Test: inspect ramdisk.img build command Bug: 379190521 Change-Id: I01d0c1bf06e087ab49c71bdb0cfe48a08b9c7fc9
2024-11-15Don't use ctx.directlyInAnyApex for bootstrap libraries Colin Cross
The check for directlyInAnyApex is redundant for bootstrap libraries, they are already explicitly enumerated in InstallToBootstrap, and they are all directly in an apex. Replace the check with !ctx.isSdkVariant(), since ctx.directlyInAnyApex() was returning false for the sdk variants. Bug: 372543712 Test: no change to build.ninja Test: all Soong tests pass Change-Id: I00f63757bc93e50affcc54577393e34a5625154e
2024-11-11Remove linkerconfig prop to linker_config Spandan Das
This makes this consistent with its inner props `gen_linker_config` and `linker_config_srcs` Test: m nothing --no-skip-soong-tests Change-Id: I6efee5cc2d182af9c600ec80e3b02d1776ba8eb9
2024-11-11Merge "Use common interface to build linker configuration" into main Treehugger Robot
2024-11-08Use common interface to build linker configuration Kiyoung Kim
Current filesystem logic is quite separated with systemimage, so it can end up generating linker configuration twice which can end up an error case. This change creates a common interface and let both filesystem and systemimage can implement their own function to generate linker configuration. Bug: 324995772 Test: Compared linker.config.pb of generic_system_image with this patch Change-Id: Ic515e54deeafbae74fd02bb023661606aa7e0b7c
2024-11-07Add f2fs support to Soong filesystem modules mrziwang
Test: CI and unit tests Bug: 372522486 Change-Id: I4dd5efb6e81018903def05908dbdd71b11500fe7
2024-11-04Support override_android_(app|apex) in deps of android_filesystem Spandan Das
These modules implicitly override their base module. e.g. if com.android.foo and com.company.android.foo are listed in deps, only the latter should be installed. Override modules are implemented as an "override" variant of the base module, and all the build actions are generated there. To not install the overridden app/apex, the following properties are updated in the _overriding_ PackagingSpec variant of the base apex 1. overrides: base apex (e.g. com.android.foo) 2. owner: overriding apex (e.g. com.company.android.foo) Test: go test ./filesystem Change-Id: I59f17134dc6ed99a252977c3615b1be5d6d746ba
2024-11-01Use a boolean to determine if linker.config.pb should be generated Spandan Das
vendor and product generate a linker.config.pb even if `PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS` or `PRODUCT_PRODUCT_LINKER_CONFIG_FRAGMENTS` are empty respectively. This CL introduces a new property to determine if a filesystem should generate a linker.config.pb. The autogenerated vendor and product filesystem modules will set this property to true. Test: go test ./filesystem Bug: 376515221 Change-Id: Ibd007df0d287034f4d227a6054bd83937570ec27
2024-10-31Dedupe logic to generate linker.config.pb Spandan Das
Between android_filesystem and generic_system_image. `getLibsForLinkerConfig` will return a list of provideLibs and requireLibs for the fileystem. `linkerConfig.BuildLinkerConfig` will then filer out the non-stub libraries. For `android_filesystem`, requireLibs is ignored for now to match the logic in the kati built vendor.img Test: m nothing --no-skip-soong-tests Test: no diff in out/soong/.intermediates/build/make/target/product/generic/generic_system_image/android_common/gen/root-extra/system/etc/linker.config.pb paste of cmd: https://diff.googleplex.com/#key=KAqqP9bhKZMD Change-Id: I1f1d626a3a161fb2e12597909fd287533cbb8482
2024-10-31Add linker.config.pb support to android_filesystem Spandan Das
As part of the mk->bp conversion, all modules and partitions will eventually be built with Soong. vendor.img (built with kati) uses some rules in build/make/core to install a /etc/linker.config.pb file. This CL adds this logic to `android_filesystem`. This soong module will eventually be used to build vendor.img There are two main inputs to linker.config.pb generation for vendor. 1. PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS, a list of json files 2. List of stub libraries installed in vendor (1) will be passed to `android_filesystem` as `Linker_config_srcs`. (2) has a subtle difference between kati and soong implementation. Kati uses `SOONG_STUB_VENDOR_LIBRARIES` to determine the list of all vendor stub libraries in the tree, and then uses `--system $TARGET_OUT/vendor` to filter in the libraries which are actually installed. For the Soong implementation, this will be replaced with ctx.VisitDirectDeps, followed by child.HasStubVariants Test: go test ./filesystem Bug: 375686533 Change-Id: I6f9130d2aa866dcac9272b71939e40ed50a952ac
2024-10-23Do not install transitive packaging specs of overriden modules Spandan Das
e.g. if a cc_binary is overriden, its shared_libs should not be installed. To do, a new `depNames` array is introduced to track the top-level module which requested the packaging spec. If the top-level module has been overridden, the packaging spec will not be installed. Test: go test ./filesystem Test: vendor partition diffs for aosp cf https://diff.googleplex.com/#key=276Je74QO1VE Change-Id: I1c8df831c696990bb0982e4537129b8e85abeda6
2024-10-22Use shared variant of dep for packaging Spandan Das
For native modules that have both static and shared variants (e.g. cc_library), the deps mutator of android_filesystem would always create a dep to the static variant. This is likely due to the fact that `AddFarVariationDependencies` creates a dependency on the first variant of the dep which matches the requested variations. `static` appears before `shared` in linkMutator, and therefore android_filesystem would always create a dep to the static variant. This CL uses `OtherModuleFarDependencyVariantExists` to create a dep to the shared variant. If a cc_library is listed in `PRODUCT_PACKAGES`, it always means the shared variant. Test: go test./filesystem Test: diff in kati install files of vendor/ before and after this CL https://diff.googleplex.com/#key=qrY73chVkwff Change-Id: Iea9d6fde199ef95d43da2c041e2f84e5a7951285
2024-10-21Use a partition filter only for autogenerated partition modules Spandan Das
Using it for everything breaks some tests for compos (an apex). Test: go build ./filesystem Change-Id: I40de8678d0b5861317fa269df9c62b9823b1c87b
2024-10-21Revert^2 "Use a partition packaging spec filter for android_filesystem" Hugo Drumond Jacob
This reverts commit 02adec80da9796d685765dfb2ee8e96518072d3c. Reason for revert: b/374239899 Bug: 374239899 Change-Id: I263c11d02d26ea150484c185745cf58253352769
2024-10-21Revert "Use a partition packaging spec filter for android_filesystem" Pechetty Sravani (xWF)
This reverts commit 8a49643e6b727490898ea94b41667eecf24685f2. Reason for revert: <DroidMonitor created revert due to b/374395492.Will be verified through ABTD for standard investigation> Change-Id: I4494f15f1681bf2456439151771e84c7d1f221b7
2024-10-18Use a partition packaging spec filter for android_filesystem Spandan Das
This revives https://r.android.com/3308803. The use case for this filter is 1. To remove the transitive shared library dependencies of `system_ext` binaries that are intended to be installed in `system`. Without this filter, we get two copies of libc.so, libz.so, ... on device 2. To filter out dexpreopt files of apps. Even if an app is installed in `/system_ext`, its dexpreopt files will be installed in `system_other`. Kati allows this by allowing ctx.InstallFile to specify the path relative to device root. Diff in autogenerated `system_ext` partition for aosp cf before and after this CL https://diff.googleplex.com/#key=6ekb09PtreNh Test: go test ./filesystem Bug: 372487849 Change-Id: Ie52723be2469d3b210ee1ebb62997d378d44788b
2024-10-10Add erofs support to Soong filesystem modules Spandan Das
Test: go test ./filesystem Bug: 372522486 Change-Id: I57c5a15a225e9e02ebec188d45b640f4185a33c0
2024-07-29Make PathForArbitraryOutput return an OutputPath Colin Cross
The only place basePath is used as a Path is when being returned from PathForArbitraryOutput. Using it as a Path requires implementing the RelativeToTop() method on it, which then allowed that method to be inherited by SourcePath, breaking the contract on RelativeToTop that specifies that the returned Path is of the same concrete type as the input Path. Make PathForArbitraryOutput return an OutputPath, and update OutputPath to support base paths that are not out/soong. This also fixes RelativeToTop, which was previously not working for PathForArbitraryOutput paths. Test: all soong tests pass Flag: EXEMPT refactor Change-Id: Ie8d8e2290961f35280e97137d2bd641c4d57ab87
2024-05-16filesystem modules gathers first target only Jiyong Park
With this change, the deps property in filesystem modules gather the first target of the filesystem module only. To gather dependencies across both targets, use multilib.both.deps instead. Bug: N/A Test: go test ./... Change-Id: Ie2ff0c48f08c61c8b219fc2c1540476ff8e4b1fc
2024-05-14Filter-out deps of unsupported arch Jiyong Park
When a common-arch module (ex: phony) has the "required" dependencies on native modules (ex: cc_library), both 32 and 64-bit variants of the native modules are added as dependencies. This by itself is fine and actually is intended, otherwise there's no way for us to install both arch variants via required deps. However, this imposes a problem when the common-arch module is depended on by a filesystem module with compile_multilib: "first". Here, the expectation is that only the first variant (64-bit) of the native module is instaled, but in reality both variants are installed. To handle this situation, make sure that the packaging routine filters out packaging specs from unsupported architecture. Bug: N/A Test: go test ./... under soong/filesyste Change-Id: Ie1ad5ace2e5d88e00183a115f4a76e5df87a8166
2024-05-13Fix: required deps from native module to phony module is respected Jiyong Park
This change fixes a bug that required deps from native module to phony module was ignored. It happened because addRequireDeps incorrectly thought that both are native modules with different bitness (32->64), which isn't. Fix this by doing the bitness check only when both the current module and the required module are native modules. Bug: N/A Test: go test ./... under build/soong/filesystem Change-Id: I494ebc47e29001f174fa44d72809041f8ceffb0b
2024-05-01Revert "Revert "Prevent multiple PackagingSpecs having same inst..." Jiyong Park
Revert submission 3069323-revert-3066748-duplicate_entry_fs-CIBDJQYRHU Reason for revert: relanding with forward fix Reverted changes: /q/submissionid:3069323-revert-3066748-duplicate_entry_fs-CIBDJQYRHU Change-Id: Ica5a126446ca2dc07a40e4ff9866389b5d164eab
2024-05-01Revert "Prevent multiple PackagingSpecs having same installation..." Jiyong Park
Revert submission 3066748-duplicate_entry_fs Reason for revert: b/338159248 Reverted changes: /q/submissionid:3066748-duplicate_entry_fs Change-Id: I89906e160f62f1bf84eb65a1b99940f139626786
2024-04-30Prevent multiple PackagingSpecs having same installation path Jiyong Park
This fixes a bug that different PackagingSpecs having the same installation path were silently allowed. Previously, a PackagingSpec that comes the first for the given installation path won, effectively eclipsing other PackagingSpecs destined for the same installation path. Bug: 335506668 Test: go test ./... Change-Id: Ia36f656e8364f95c4be78fff6e9dc16966307526
2024-04-30Remove an unnecessary test in filesystem Jiyong Park
TestFileSystemShouldInstalCoreVariantIfTargetBuildAppIsSet is removed. The test was originally introduced with aosp/2445946, but the change was effectively reverted by aosp/2562192. The test however has been green as a side effect of a bug (b/335506668) which will be fixed soon. Bug: 335506668 Bug: 268582372 Test: N/A Change-Id: I62f4746c605eba0b2f0037089a53d65922d65ef3
2024-04-17Revert^2 "Use Module interface in addRequiredDeps" Jiyong Park
This reverts commit bbcdaa0c32498d212e2af65984b0180bfbf3925b. Reason for revert: relanding with a forward fix Change-Id: I14b83010a4b8d9cb9cb317f2aa07875c17f6cdaa
2024-04-17Revert "Use Module interface in addRequiredDeps" Daren Liao
This reverts commit de18a3d55a46c5647039f8fe38ff13a9372e7b1b. Reason for revert: b/335332155 Change-Id: Ib5b74b1704c1446713466e8617c42b212c960d49
2024-04-13Use Module interface in addRequiredDeps Jiyong Park
Previously, addRequiredDeps directly called RequiredModuleNames directly on ModuleBase. As a result, it failed to correctly track the dependencies for the modules which are overriding RequiredModuleNames. cc_* were those. Fixing this by calling RequiredModuleNames via the Module interface. Bug: 321626681 Test: go test ./... under filesystem Change-Id: I79de616606b88277da0b3e86b21316ee83e0ec71
2024-04-09Merge "android_filesystem_defaults and visibility rule" into main Jiyong Park
2024-04-09android_filesystem_defaults and visibility rule Jiyong Park
android_systemimage_defaults is deleted and android_filesystem_defaults is created so that we can have defaults not only for android_system_image, but also all android_filesystem modules and its derivatives. Also, change adds a check which ensures that the partition_type of the filesystem and its defaults are the same. Bug: 330665150 Test: m Change-Id: If635c794534ed89d264eaf7dfc406a8245b8e9f0
2024-04-05fix: required property doesn't track deps to java, apex, ... Jiyong Park
This change fixes a bug that the required property doesn't track dependencies to modules whose arch is common. Bug: 321000103 Bug: 321626681 Test: go test ./... Change-Id: I3d2b3ad8cb2a9f1c5c3d5345bf05402a787f011a
2024-03-31Add android_system_image_defaults Jiyong Park
Bug: 330665150 Test: go test ./... under filesystem Change-Id: Id32e6563491a3d129042de4a9517c545543a022d
2024-03-29fix: required deps of phony modules are correctly tracked Jiyong Park
ArchType.Multilib of native modules are either lib32 or lib64. Arch-neural modules have "" not "common". Bug: 321626681 Test: go test ./... Change-Id: Ie7e6a5203e9f671487dbf32ea2343ada7407a28f
2024-03-20Add required, host_required, and target_required as dependencies Jiyong Park
So far, the installation of required modules were handled by Make. This prevents us from implementing the module installation and packaging entirely in Soong. This CL is the first step towards that goal. Soong now correctly tracks the dependencies and they are correctly returned by TransitivePackagingSpecs(), which is used by packaging modules like android_system_image. Bug: 321626681 Test: build Change-Id: I9192b5333ceaa0b7d1c5c4abeec2af62febcd976
2024-03-14Add include_make_built_files Cole Faust
If `include_make_built_files` is set to the name of a partition, the make-built files from that partition will be incorperated into this soong module. This is to ease the transition to soong built filesystems. If any files are present in both the soong-built file list and the make-built one, the soong ones will be preferred. Bug: 329146343 Test: go test Change-Id: I456b283e1189116e699ed75357cc056f5d217688
2024-03-14Don't use zip files when creating filesystems Cole Faust
The end result is a directory that's passed to build_image, so zipping and then unzipping image contents will unnecessarily slow things down. Bug: 329146343 Test: m microdroid --no-skip-soong-tests Change-Id: I98223c60e8144d6c707832fcc03ba8fe94467e7b
2024-02-16Ensure that filesystem module can track modules with prefer32 Jiyong Park
Bug: 321854616 Test: go test ./... Change-Id: I67893f8c32bd913ec6066e7055e1758a5bddb9a0