Add apex.use_file_contexts_as_is property
When set true, use file_contexts file as is and do not force-label / and /apex_manifest.pb Bug: 268439003 Test: m (soong tests) Change-Id: I252eef9569deeac87bb71a3425a8eb07bab3c634
This commit is contained in:
@@ -784,6 +784,43 @@ func TestApexManifestMinSdkVersion(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileContexts(t *testing.T) {
|
||||
for _, useFileContextsAsIs := range []bool{true, false} {
|
||||
prop := ""
|
||||
if useFileContextsAsIs {
|
||||
prop = "use_file_contexts_as_is: true,\n"
|
||||
}
|
||||
ctx := testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
file_contexts: "file_contexts",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
`+prop+`
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
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)
|
||||
} else {
|
||||
android.AssertStringDoesContain(t, "shouldn't force-label",
|
||||
rule.RuleParams.Command, forceLabellingCommand)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBasicZipApex(t *testing.T) {
|
||||
ctx := testApex(t, `
|
||||
apex {
|
||||
|
Reference in New Issue
Block a user