summaryrefslogtreecommitdiff
path: root/apex/apex_test.go
diff options
context:
space:
mode:
author Jingwen Chen <jingwen@google.com> 2023-03-28 11:30:50 +0000
committer Jingwen Chen <jingwen@google.com> 2023-03-28 11:32:37 +0000
commitdea7a649acb4f4644c45ecadd5364f176417d48f (patch)
tree9cf0831d542ed710e781fd56aabb73b82661a045 /apex/apex_test.go
parent13ca1a92071c211a239670d0249461ebea84a0e8 (diff)
Add tests for custom canned_fs_config.
There are no tests to verify the generated action for the canned fs config entries, so add some. Also update the prop's docstring to reflect the actual logic. Bug: 275209284 Fixes: 275280970 Test: soong tests Change-Id: I37f2a8640bf4c307068a77db7a635c9bbeb9f38f
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r--apex/apex_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index c9665a4b8..05c888abe 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10105,3 +10105,45 @@ func TestTrimmedApex(t *testing.T) {
android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libbar")
android.AssertStringDoesNotContain(t, "unexpected libs in the libs to trim", libs_to_trim, "libbaz")
}
+
+func TestCannedFsConfig(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }`)
+ mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
+ generateFsRule := mod.Rule("generateFsConfig")
+ cmd := generateFsRule.RuleParams.Command
+
+ ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; ) >`)
+}
+
+func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ canned_fs_config: "my_config",
+ updatable: false,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }`)
+ mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
+ generateFsRule := mod.Rule("generateFsConfig")
+ cmd := generateFsRule.RuleParams.Command
+
+ // Ensure that canned_fs_config has "cat my_config" at the end
+ ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; cat my_config ) >`)
+}