diff options
author | Jiyong Park <jiyong@google.com> | 2019-03-21 01:11:21 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-03-22 11:41:09 +0900 |
commit | 6788256d09f3fe29e790751f9b57be4387cc7a0c (patch) | |
tree | a9a450126b343d48ec49fad0e1bdd2d4250297d9 /apex/apex_test.go | |
parent | 21c81326ff4ee6420e73077ce0f05e3cf5565e29 (diff) | |
download | build_soong-6788256d09f3fe29e790751f9b57be4387cc7a0c.tar.gz build_soong-6788256d09f3fe29e790751f9b57be4387cc7a0c.tar.bz2 build_soong-6788256d09f3fe29e790751f9b57be4387cc7a0c.zip |
:module syntax support properties in apex_key
public_key and private_key properties support :module syntax so that the
key pairs can be dynamically created during the build, which is useful
for one-time keys.
Bug: 128960614
Test: m (apex_test amended)
Change-Id: I249b1d29f247784193b0d733a7b6a20274ece105
Diffstat (limited to 'apex/apex_test.go')
-rw-r--r-- | apex/apex_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go index ac2701f7..8a2e55af 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -161,6 +161,8 @@ func testApex(t *testing.T, bp string) *android.TestContext { "vendor/foo/devkeys/testkey.pem": nil, "NOTICE": nil, "custom_notice": nil, + "testkey2.avbpubkey": nil, + "testkey2.pem": nil, }) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) android.FailIfErrored(t, errs) @@ -1194,3 +1196,36 @@ func TestApexInProductPartition(t *testing.T) { } } + +func TestApexKeyFromOtherModule(t *testing.T) { + ctx := testApex(t, ` + apex_key { + name: "myapex.key", + public_key: ":my.avbpubkey", + private_key: ":my.pem", + product_specific: true, + } + + filegroup { + name: "my.avbpubkey", + srcs: ["testkey2.avbpubkey"], + } + + filegroup { + name: "my.pem", + srcs: ["testkey2.pem"], + } + `) + + apex_key := ctx.ModuleForTests("myapex.key", "android_common").Module().(*apexKey) + expected_pubkey := "testkey2.avbpubkey" + actual_pubkey := apex_key.public_key_file.String() + if actual_pubkey != expected_pubkey { + t.Errorf("wrong public key path. expected %q. actual %q", expected_pubkey, actual_pubkey) + } + expected_privkey := "testkey2.pem" + actual_privkey := apex_key.private_key_file.String() + if actual_privkey != expected_privkey { + t.Errorf("wrong private key path. expected %q. actual %q", expected_privkey, actual_privkey) + } +} |