Rupert Shuttleworth | eb8c85a | 2021-07-27 07:10:32 -0400 | [diff] [blame] | 1 | // Copyright 2021 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package bp2build |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | "android/soong/apex" |
| 20 | |
| 21 | "testing" |
| 22 | ) |
| 23 | |
| 24 | func runApexKeyTestCase(t *testing.T, tc bp2buildTestCase) { |
| 25 | t.Helper() |
| 26 | runBp2BuildTestCase(t, registerApexKeyModuleTypes, tc) |
| 27 | } |
| 28 | |
| 29 | func registerApexKeyModuleTypes(ctx android.RegistrationContext) { |
| 30 | } |
| 31 | |
| 32 | func TestApexKeySimple(t *testing.T) { |
| 33 | runApexKeyTestCase(t, bp2buildTestCase{ |
Liz Kammer | be46fcc | 2021-11-01 15:32:43 -0400 | [diff] [blame] | 34 | description: "apex key - simple example", |
| 35 | moduleTypeUnderTest: "apex_key", |
| 36 | moduleTypeUnderTestFactory: apex.ApexKeyFactory, |
| 37 | filesystem: map[string]string{}, |
Rupert Shuttleworth | eb8c85a | 2021-07-27 07:10:32 -0400 | [diff] [blame] | 38 | blueprint: ` |
| 39 | apex_key { |
| 40 | name: "com.android.apogee.key", |
| 41 | public_key: "com.android.apogee.avbpubkey", |
| 42 | private_key: "com.android.apogee.pem", |
| 43 | } |
| 44 | `, |
Liz Kammer | 78cfdaa | 2021-11-08 12:56:31 -0500 | [diff] [blame] | 45 | expectedBazelTargets: []string{makeBazelTarget("apex_key", "com.android.apogee.key", attrNameToString{ |
| 46 | "private_key": `"com.android.apogee.pem"`, |
| 47 | "public_key": `"com.android.apogee.avbpubkey"`, |
| 48 | }), |
| 49 | }}) |
Rupert Shuttleworth | eb8c85a | 2021-07-27 07:10:32 -0400 | [diff] [blame] | 50 | } |