summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2020-06-20 12:47:47 +0900
committer Jooyung Han <jooyung@google.com> 2020-06-23 02:10:46 +0900
commit938b59388722a03627afc1a65eb00ef627b8ce0e (patch)
treea4a17ad64eeecfd281c5270a5dfc0245f583f5b1 /apex/apex_test.go
parent34753055d1e3df3f6b7a22996f2d499d70e23b36 (diff)
apex: make allowed_files prop overridable
Because override_apex can modify the contents of the base apex, allowed_files (which describes the contents) should be overridable. Bug: 159503079 Bug: 159392784 Bug: 158169437 Test: m (soong test added) Merged-In: I12744b0465dc3cfc90a66643867e65b4092cd0f7 Change-Id: I12744b0465dc3cfc90a66643867e65b4092cd0f7 (cherry picked from commit faa5399b3f304ab152c39c858d0ca4af8735a750)
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index a7a776561..3d5886ea9 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -5396,6 +5396,61 @@ func TestApexKeysTxt(t *testing.T) {
ensureNotContains(t, content, "myapex.apex")
}
+func TestAllowedFiles(t *testing.T) {
+ ctx, _ := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ apps: ["app"],
+ allowed_files: "allowed.txt",
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ android_app {
+ name: "app",
+ srcs: ["foo/bar/MyClass.java"],
+ package_name: "foo",
+ sdk_version: "none",
+ system_modules: "none",
+ apex_available: [ "myapex" ],
+ }
+ `, withFiles(map[string][]byte{
+ "sub/Android.bp": []byte(`
+ override_apex {
+ name: "override_myapex",
+ base: "myapex",
+ apps: ["override_app"],
+ allowed_files: ":allowed",
+ }
+ // Overridable "path" property should be referenced indirectly
+ filegroup {
+ name: "allowed",
+ srcs: ["allowed.txt"],
+ }
+ override_android_app {
+ name: "override_app",
+ base: "app",
+ package_name: "bar",
+ }
+ `),
+ }))
+
+ rule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("diffApexContentRule")
+ if expected, actual := "allowed.txt", rule.Args["allowed_files_file"]; expected != actual {
+ t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
+ }
+
+ rule2 := ctx.ModuleForTests("myapex", "android_common_override_myapex_myapex_image").Rule("diffApexContentRule")
+ if expected, actual := "sub/allowed.txt", rule2.Args["allowed_files_file"]; expected != actual {
+ t.Errorf("allowed_files_file: expected %q but got %q", expected, actual)
+ }
+}
+
func TestMain(m *testing.M) {
run := func() int {
setUp()