• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2014 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    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20java_test_host {
21    // Must match the package name in CtsTestCaseList.mk
22    name: "CtsSecurityHostTestCases",
23    defaults: ["cts_defaults"],
24    srcs: [
25        "src/**/*.java",
26        ":CtsSecurityHostTestCases_LocalGeneratedSources",
27    ],
28    // tag this module as a cts test artifact
29    test_suites: [
30        "cts",
31        "general-tests",
32    ],
33    libs: [
34        "cts-tradefed",
35        "tradefed",
36        "compatibility-host-util",
37    ],
38    java_resources: [
39        ":plat_seapp_contexts",
40        ":plat_seapp_neverallows",
41        ":plat_file_contexts",
42        ":plat_property_contexts",
43        ":plat_service_contexts",
44    ],
45    static_libs: [
46        "CtsSecurityHostTestCases_StaticLibs",
47        "diffutils-prebuilt-jar",
48        "CompatChangeGatingTestBase",
49    ],
50    data: [
51        ":CtsZipValidateApp",
52    ],
53    // These two host cc_library_* modules cannot be wrapped as java_resources directly into
54    // a .jar due to the "missing variant" issue, see b/197025344 for more details. This workaround
55    // will install these two modules alongside with the .jar file in the testcases directory.
56    jni_libs: [
57        "libsepolwrap",
58        "libc++",
59    ],
60    target_required: ["CtsDeviceInfo"],
61}
62
63genrule {
64    name: "CtsSecurityHostTestCases_LocalGeneratedSources",
65    tools: [
66        "SELinuxNeverallowTestGen",
67        "soong_zip",
68    ],
69    srcs: [":general_sepolicy.conf"],
70    out: ["SELinuxNeverallowRulesTest.srcjar"],
71    cmd: "mkdir -p $(genDir)/android/cts/security && " +
72        "$(location SELinuxNeverallowTestGen) $(in) $(genDir)/android/cts/security/SELinuxNeverallowRulesTest.java && " +
73        "$(location soong_zip) -jar -o $(out) -C $(genDir) -D $(genDir)",
74}
75
76java_genrule_host {
77    name: "CtsSecurityHostTestCases_StaticLibs",
78    tools: [
79        "soong_zip",
80        "checkseapp",
81        "checkfc",
82        "property_info_checker",
83        "searchpolicy",
84        "seamendc",
85        "secilc",
86        "sepolicy-analyze",
87        "sepolicy_tests",
88        "treble_sepolicy_tests",
89    ],
90    tool_files: [
91        ":apex_sepolicy-33.cil",
92        ":apex_sepolicy-33.decompiled.cil",
93    ],
94    out: ["CtsSecurityHostTestCases_StaticLibs.jar"],
95    cmd: "$(location soong_zip) -jar -o $(location CtsSecurityHostTestCases_StaticLibs.jar) -j " +
96        "-f $(location checkseapp) " +
97        "-f $(location checkfc) " +
98        "-f $(location property_info_checker) " +
99        "-f $(location searchpolicy) " +
100        "-f $(location seamendc) " +
101        "-f $(location secilc) " +
102        "-f $(location sepolicy-analyze) " +
103        "-f $(location sepolicy_tests) " +
104        "-f $(location treble_sepolicy_tests) " +
105        "-f $(location :apex_sepolicy-33.cil) " +
106        "-f $(location :apex_sepolicy-33.decompiled.cil)",
107}
108