aboutsummaryrefslogtreecommitdiff
path: root/fsgen/filesystem_creator_test.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /fsgen/filesystem_creator_test.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'fsgen/filesystem_creator_test.go')
-rw-r--r--fsgen/filesystem_creator_test.go134
1 files changed, 133 insertions, 1 deletions
diff --git a/fsgen/filesystem_creator_test.go b/fsgen/filesystem_creator_test.go
index 2c4d3c817..6674dfe4f 100644
--- a/fsgen/filesystem_creator_test.go
+++ b/fsgen/filesystem_creator_test.go
@@ -22,6 +22,7 @@ import (
"android/soong/etc"
"android/soong/filesystem"
"android/soong/java"
+ "android/soong/phony"
"github.com/google/blueprint/proptools"
)
@@ -252,7 +253,7 @@ func TestRemoveOverriddenModulesFromDeps(t *testing.T) {
`),
}),
android.FixtureModifyConfig(func(config android.Config) {
- config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductPackages = []string{"libfoo", "libbar"}
+ config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductPackages = []string{"libfoo", "libbar", "prebuiltA", "prebuiltB"}
}),
).RunTestWithBp(t, `
java_library {
@@ -266,10 +267,19 @@ java_library {
name: "libbaz",
overrides: ["libfoo"], // overrides libfoo
}
+java_import {
+ name: "prebuiltA",
+}
+java_import {
+ name: "prebuiltB",
+ overrides: ["prebuiltA"], // overrides prebuiltA
+}
`)
resolvedSystemDeps := result.TestContext.Config().Get(fsGenStateOnceKey).(*FsGenState).fsDeps["system"]
_, libFooInDeps := (*resolvedSystemDeps)["libfoo"]
android.AssertBoolEquals(t, "libfoo should not appear in deps because it has been overridden by libbaz. The latter is a required dep of libbar, which is listed in PRODUCT_PACKAGES", false, libFooInDeps)
+ _, prebuiltAInDeps := (*resolvedSystemDeps)["prebuiltA"]
+ android.AssertBoolEquals(t, "prebuiltA should not appear in deps because it has been overridden by prebuiltB. The latter is listed in PRODUCT_PACKAGES", false, prebuiltAInDeps)
}
func TestPrebuiltEtcModuleGen(t *testing.T) {
@@ -660,3 +670,125 @@ func TestPrebuiltEtcModuleGen(t *testing.T) {
}),
)
}
+
+func TestPartitionOfOverrideModules(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ android.PrepareForIntegrationTestWithAndroid,
+ android.PrepareForTestWithAndroidBuildComponents,
+ android.PrepareForTestWithAllowMissingDependencies,
+ prepareForTestWithFsgenBuildComponents,
+ java.PrepareForTestWithJavaBuildComponents,
+ prepareMockRamdiksNodeList,
+ android.PrepareForTestWithNamespace,
+ android.FixtureMergeMockFs(android.MockFS{
+ "external/avb/test/data/testkey_rsa4096.pem": nil,
+ "build/soong/fsgen/Android.bp": []byte(`
+ soong_filesystem_creator {
+ name: "foo",
+ }`),
+ "mynamespace/Android.bp": []byte(`
+ soong_namespace{
+ }
+ android_app {
+ name: "system_ext_app_in_namespace",
+ system_ext_specific: true,
+ platform_apis: true,
+ }`),
+ }),
+ android.FixtureModifyConfig(func(config android.Config) {
+ config.TestProductVariables.NamespacesToExport = []string{"mynamespace"}
+ config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductPackages = []string{"system_ext_override_app", "system_ext_override_app_in_namespace"}
+ }),
+ ).RunTestWithBp(t, `
+android_app {
+ name: "system_ext_app",
+ system_ext_specific: true,
+ platform_apis: true,
+}
+override_android_app {
+ name: "system_ext_override_app",
+ base: "system_ext_app",
+}
+override_android_app {
+ name: "system_ext_override_app_in_namespace",
+ base: "//mynamespace:system_ext_app_in_namespace",
+}
+`)
+ resolvedDeps := result.TestContext.Config().Get(fsGenStateOnceKey).(*FsGenState).fsDeps["system_ext"]
+ _, overrideAppInSystemExt := (*resolvedDeps)["system_ext_override_app"]
+ android.AssertBoolEquals(t, "Override app should be added to the same partition as the `base`", true, overrideAppInSystemExt)
+ _, overrideAppInSystemExt = (*resolvedDeps)["system_ext_override_app_in_namespace"]
+ android.AssertBoolEquals(t, "Override app should be added to the same partition as the `base`", true, overrideAppInSystemExt)
+}
+
+func TestCrossPartitionRequiredModules(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ android.PrepareForIntegrationTestWithAndroid,
+ android.PrepareForTestWithAndroidBuildComponents,
+ android.PrepareForTestWithAllowMissingDependencies,
+ prepareForTestWithFsgenBuildComponents,
+ java.PrepareForTestWithJavaBuildComponents,
+ prepareMockRamdiksNodeList,
+ android.PrepareForTestWithNamespace,
+ phony.PrepareForTestWithPhony,
+ etc.PrepareForTestWithPrebuiltEtc,
+ android.FixtureMergeMockFs(android.MockFS{
+ "external/avb/test/data/testkey_rsa4096.pem": nil,
+ "mynamespace/default-permissions.xml": nil,
+ "build/soong/fsgen/Android.bp": []byte(`
+ soong_filesystem_creator {
+ name: "foo",
+ }`),
+ "mynamespace/Android.bp": []byte(`
+ soong_namespace{
+ }
+ android_app {
+ name: "some_app_in_namespace",
+ product_specific: true,
+ required: ["some-permissions"],
+ platform_apis: true,
+ }
+ prebuilt_etc {
+ name: "some-permissions",
+ sub_dir: "default-permissions",
+ src: "default-permissions.xml",
+ filename_from_src: true,
+ system_ext_specific: true,
+ }
+`),
+ }),
+ android.FixtureModifyConfig(func(config android.Config) {
+ config.TestProductVariables.NamespacesToExport = []string{"mynamespace"}
+ config.TestProductVariables.PartitionVarsForSoongMigrationOnlyDoNotUse.ProductPackages = []string{"some_app_in_namespace"}
+ }),
+ ).RunTestWithBp(t, `
+ phony {
+ name: "com.android.vndk.v34",
+ }
+ phony {
+ name: "com.android.vndk.v33",
+ }
+ phony {
+ name: "com.android.vndk.v32",
+ }
+ phony {
+ name: "com.android.vndk.v31",
+ }
+ phony {
+ name: "com.android.vndk.v30",
+ }
+ phony {
+ name: "file_contexts_bin_gen",
+ }
+ phony {
+ name: "notice_xml_system_ext",
+ }
+ `)
+ systemExtFilesystemModule := result.ModuleForTests(t, "test_product_generated_system_ext_image", "android_common")
+ systemExtStagingDirImplicitDeps := systemExtFilesystemModule.Output("staging_dir.timestamp").Implicits
+ android.AssertStringDoesContain(t,
+ "system_ext staging dir expected to contain cross partition require deps",
+ strings.Join(systemExtStagingDirImplicitDeps.Strings(), " "),
+ "mynamespace/some-permissions/android_arm64_armv8-a/default-permissions.xml",
+ )
+}