summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2025-01-14 16:52:14 +0900
committer Jooyung Han <jooyung@google.com> 2025-01-14 16:56:53 +0900
commit5f7fa509484a53b45c564a4068f67c89a5cc1bb5 (patch)
tree2613fe72dc400a3056b85ad9f683972b6dbcfe4f /apex/apex_test.go
parent9eb3f2e1779a6c925c7109636133a47cdf4b5d99 (diff)
apex: use proper partition tag for validations
module.PartitionTag(DeviceConfig) doesn't work for validations because it tells the physical partition where the apex is installed. It returns "system" even for vendor APEXes when "VendorPath" is set to "system/vendor". For validations, we need logical partition tag. So, "vendor:true" apexes should be "vendor" even when it's installed in /system/vendor. Bug: 384988749 Test: m --no-skip-soong-tests Change-Id: Ib478caa62c98808bc94fe350a2f182f1d2b42a46
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e1a958268..c123d0300 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -7090,6 +7090,34 @@ func TestApexAvailable_PrefixMatch(t *testing.T) {
`)
}
+func TestApexValidation_UsesProperPartitionTag(t *testing.T) {
+ t.Parallel()
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ vendor: true,
+ }
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ // vendor path should not affect "partition tag"
+ variables.VendorPath = proptools.StringPtr("system/vendor")
+ }))
+
+ module := ctx.ModuleForTests("myapex", "android_common_myapex")
+ android.AssertStringEquals(t, "partition tag for host_apex_verifier",
+ "vendor",
+ module.Output("host_apex_verifier.timestamp").Args["partition_tag"])
+ android.AssertStringEquals(t, "partition tag for apex_sepolicy_tests",
+ "vendor",
+ module.Output("apex_sepolicy_tests.timestamp").Args["partition_tag"])
+}
+
func TestApexValidation_TestApexCanSkipInitRcCheck(t *testing.T) {
t.Parallel()
ctx := testApex(t, `