diff options
| author | 2023-03-02 09:14:35 +0000 | |
|---|---|---|
| committer | 2023-03-02 09:14:35 +0000 | |
| commit | 7861e65b4811dd51dafad520f2723bca99af56e0 (patch) | |
| tree | 196d4dcea353a693e97f0cd47ed9b6f510ef134b /apex/apex_test.go | |
| parent | ba3a44dd1ceb1f10215a091ee89c23891c57f65a (diff) | |
| parent | af73095979facd1e2b5a5bb4e4c8e485f1d2f204 (diff) | |
Merge "Add apex.use_file_contexts_as_is property"
Diffstat (limited to 'apex/apex_test.go')
| -rw-r--r-- | apex/apex_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go index 53e922cd3..c94bbbb32 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -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 { |