Check if vintf_fragment modules' target partition
Current implementation allows vintf_fragment to be installed in the
different partition of a module referenced it via
vintf_fragment_modules, but this is unexpected behavior and should be
caught from the build system to avoid any unintended mistakes. This
change checks target parition of vintf_fragment module and any modules
referencing it, and fails if there is any mismatch found.
Bug: 322089980
Test: aosp_cf_x86_64_phone build succeeded
Change-Id: Ie8152d2f2616726e44a99fb1261be292f2b9ad54
diff --git a/android/module_test.go b/android/module_test.go
index d64e3a5..d76d9b3 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -1080,3 +1080,29 @@
})
}
}
+
+func TestVintfFragmentModulesChecksPartition(t *testing.T) {
+ bp := `
+ vintf_fragment {
+ name: "vintfModA",
+ src: "test_vintf_file",
+ vendor: true,
+ }
+ deps {
+ name: "modA",
+ vintf_fragment_modules: [
+ "vintfModA",
+ ]
+ }
+ `
+
+ testPreparer := GroupFixturePreparers(
+ PrepareForTestWithAndroidBuildComponents,
+ prepareForModuleTests,
+ )
+
+ testPreparer.
+ ExtendWithErrorHandler(FixtureExpectsOneErrorPattern(
+ "Module .+ and Vintf_fragment .+ are installed to different partitions.")).
+ RunTestWithBp(t, bp)
+}