Merge "vendor apex: label apex_manifest as vendor_apex_metadata_file"

This commit is contained in:
Jooyung Han
2023-06-07 23:59:59 +00:00
committed by Gerrit Code Review
2 changed files with 25 additions and 21 deletions

View File

@@ -786,18 +786,16 @@ func TestApexManifestMinSdkVersion(t *testing.T) {
}
func TestFileContexts(t *testing.T) {
for _, useFileContextsAsIs := range []bool{true, false} {
for _, vendor := range []bool{true, false} {
prop := ""
if useFileContextsAsIs {
prop = "use_file_contexts_as_is: true,\n"
if vendor {
prop = "vendor: true,\n"
}
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
file_contexts: "file_contexts",
updatable: false,
vendor: true,
`+prop+`
}
@@ -806,18 +804,17 @@ func TestFileContexts(t *testing.T) {
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
`, withFiles(map[string][]byte{
"file_contexts": nil,
}))
`)
rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("file_contexts")
forceLabellingCommand := "apex_manifest\\\\.pb u:object_r:system_file:s0"
if useFileContextsAsIs {
android.AssertStringDoesNotContain(t, "should force-label",
rule.RuleParams.Command, forceLabellingCommand)
if vendor {
android.AssertStringDoesContain(t, "should force-label as vendor_apex_metadata_file",
rule.RuleParams.Command,
"apex_manifest\\\\.pb u:object_r:vendor_apex_metadata_file:s0")
} else {
android.AssertStringDoesContain(t, "shouldn't force-label",
rule.RuleParams.Command, forceLabellingCommand)
android.AssertStringDoesContain(t, "should force-label as system_file",
rule.RuleParams.Command,
"apex_manifest\\\\.pb u:object_r:system_file:s0")
}
}
}