1// Copyright (C) 2019 The Android Open Source Project
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
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "frameworks_base_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_base_license"],
22}
23
24android_test {
25    name: "RollbackTest",
26    manifest: "RollbackTest/AndroidManifest.xml",
27    platform_apis: true,
28    srcs: ["RollbackTest/src/**/*.java"],
29    static_libs: ["androidx.test.rules", "cts-rollback-lib", "cts-install-lib"],
30    test_suites: ["general-tests"],
31    test_config: "RollbackTest.xml",
32    java_resources: [
33        ":com.android.apex.apkrollback.test_v2",
34        ":com.android.apex.apkrollback.test_v2Crashing"
35    ],
36}
37
38java_test_host {
39    name: "StagedRollbackTest",
40    srcs: ["StagedRollbackTest/src/**/*.java"],
41    libs: ["tradefed"],
42    static_libs: [
43        "compatibility-tradefed",
44        "frameworks-base-hostutils",
45        "RollbackTestLib",
46        "testng",
47    ],
48    test_suites: ["general-tests"],
49    test_config: "StagedRollbackTest.xml",
50    data: [":com.android.apex.apkrollback.test_v1"],
51}
52
53java_test_host {
54    name: "NetworkStagedRollbackTest",
55    srcs: ["NetworkStagedRollbackTest/src/**/*.java"],
56    libs: ["tradefed"],
57    static_libs: ["RollbackTestLib", "frameworks-base-hostutils"],
58    test_suites: ["general-tests"],
59    test_config: "NetworkStagedRollbackTest.xml",
60}
61
62java_test_host {
63    name: "MultiUserRollbackTest",
64    srcs: ["MultiUserRollbackTest/src/**/*.java"],
65    libs: ["tradefed"],
66    static_libs: [
67        "frameworks-base-hostutils",
68    ],
69    test_suites: ["general-tests"],
70    test_config: "MultiUserRollbackTest.xml",
71}
72
73java_library_host {
74    name: "RollbackTestLib",
75    srcs: ["lib/src/**/*.java"],
76    libs: ["tradefed"],
77}
78
79genrule {
80  name: "com.android.apex.apkrollback.test.pem",
81  out: ["com.android.apex.apkrollback.test.pem"],
82  cmd: "openssl genrsa -out $(out) 4096",
83}
84
85genrule {
86  name: "com.android.apex.apkrollback.test.pubkey",
87  srcs: [":com.android.apex.apkrollback.test.pem"],
88  out: ["com.android.apex.apkrollback.test.pubkey"],
89  tools: ["avbtool"],
90  cmd: "$(location avbtool) extract_public_key --key $(in) --output $(out)",
91}
92
93apex_key {
94  name: "com.android.apex.apkrollback.test.key",
95  private_key: ":com.android.apex.apkrollback.test.pem",
96  public_key: ":com.android.apex.apkrollback.test.pubkey",
97  installable: false,
98}
99
100apex {
101  name: "com.android.apex.apkrollback.test_v1",
102  manifest: "testdata/manifest_v1.json",
103  androidManifest: "testdata/AndroidManifest.xml",
104  file_contexts: ":apex.test-file_contexts",
105  key: "com.android.apex.apkrollback.test.key",
106  apps: ["TestAppAv1"],
107  installable: false,
108  updatable: false,
109}
110
111apex {
112  name: "com.android.apex.apkrollback.test_v2",
113  manifest: "testdata/manifest_v2.json",
114  androidManifest: "testdata/AndroidManifest.xml",
115  file_contexts: ":apex.test-file_contexts",
116  key: "com.android.apex.apkrollback.test.key",
117  apps: ["TestAppAv2"],
118  installable: false,
119  updatable: false,
120}
121
122apex {
123  name: "com.android.apex.apkrollback.test_v2Crashing",
124  manifest: "testdata/manifest_v2.json",
125  androidManifest: "testdata/AndroidManifest.xml",
126  file_contexts: ":apex.test-file_contexts",
127  key: "com.android.apex.apkrollback.test.key",
128  apps: ["TestAppACrashingV2"],
129  installable: false,
130  updatable: false,
131}
132