• 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    ],
48    // These two host cc_library_* modules cannot be wrapped as java_resources directly into
49    // a .jar due to the "missing variant" issue, see b/197025344 for more details. This workaround
50    // will install these two modules alongside with the .jar file in the testcases directory.
51    jni_libs: [
52        "libsepolwrap",
53        "libc++",
54    ],
55    target_required: ["CtsDeviceInfo"],
56}
57
58genrule {
59    name: "CtsSecurityHostTestCases_LocalGeneratedSources",
60    tools: [
61        "SELinuxNeverallowTestGen",
62        "soong_zip",
63    ],
64    srcs: [":general_sepolicy.conf"],
65    out: ["SELinuxNeverallowRulesTest.srcjar"],
66    cmd: "mkdir -p $(genDir)/android/cts/security && " +
67        "$(location SELinuxNeverallowTestGen) $(in) $(genDir)/android/cts/security/SELinuxNeverallowRulesTest.java && " +
68        "$(location soong_zip) -jar -o $(out) -C $(genDir) -D $(genDir)",
69}
70
71java_genrule_host {
72    name: "CtsSecurityHostTestCases_StaticLibs",
73    tools: [
74        "soong_zip",
75        "checkseapp",
76        "checkfc",
77        "property_info_checker",
78        "searchpolicy",
79        "secilc",
80        "sepolicy-analyze",
81        "sepolicy_tests",
82        "treble_sepolicy_tests",
83    ],
84    out: ["CtsSecurityHostTestCases_StaticLibs.jar"],
85    cmd: "$(location soong_zip) -jar -o $(location CtsSecurityHostTestCases_StaticLibs.jar) -j " +
86        "-f $(location checkseapp) " +
87        "-f $(location checkfc) " +
88        "-f $(location property_info_checker) " +
89        "-f $(location searchpolicy) " +
90        "-f $(location secilc) " +
91        "-f $(location sepolicy-analyze) " +
92        "-f $(location sepolicy_tests) " +
93        "-f $(location treble_sepolicy_tests) ",
94}
95