xref: /aosp_15_r20/system/sepolicy/tests/Android.bp (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workerpackage {
2*e4a36f41SAndroid Build Coastguard Worker    // http://go/android-license-faq
3*e4a36f41SAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
4*e4a36f41SAndroid Build Coastguard Worker    // the below license kinds from "system_sepolicy_license":
5*e4a36f41SAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
6*e4a36f41SAndroid Build Coastguard Worker    default_applicable_licenses: ["system_sepolicy_license"],
7*e4a36f41SAndroid Build Coastguard Worker}
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Workercc_library_host_shared {
10*e4a36f41SAndroid Build Coastguard Worker    name: "libsepolwrap",
11*e4a36f41SAndroid Build Coastguard Worker    srcs: ["sepol_wrap.cpp"],
12*e4a36f41SAndroid Build Coastguard Worker    cflags: [
13*e4a36f41SAndroid Build Coastguard Worker        "-Wall",
14*e4a36f41SAndroid Build Coastguard Worker        "-Werror",
15*e4a36f41SAndroid Build Coastguard Worker    ],
16*e4a36f41SAndroid Build Coastguard Worker    export_include_dirs: ["include"],
17*e4a36f41SAndroid Build Coastguard Worker    stl: "c++_static",
18*e4a36f41SAndroid Build Coastguard Worker
19*e4a36f41SAndroid Build Coastguard Worker    // libsepolwrap gets loaded from the system python, which does not have the
20*e4a36f41SAndroid Build Coastguard Worker    // ASAN runtime. So turn off sanitization for ourself, and  use static
21*e4a36f41SAndroid Build Coastguard Worker    // libraries, since the shared libraries will use ASAN.
22*e4a36f41SAndroid Build Coastguard Worker    static_libs: [
23*e4a36f41SAndroid Build Coastguard Worker        "libbase",
24*e4a36f41SAndroid Build Coastguard Worker        "libsepol",
25*e4a36f41SAndroid Build Coastguard Worker    ],
26*e4a36f41SAndroid Build Coastguard Worker    sanitize: {
27*e4a36f41SAndroid Build Coastguard Worker        never: true,
28*e4a36f41SAndroid Build Coastguard Worker    },
29*e4a36f41SAndroid Build Coastguard Worker}
30*e4a36f41SAndroid Build Coastguard Worker
31*e4a36f41SAndroid Build Coastguard Workerpython_library_host {
32*e4a36f41SAndroid Build Coastguard Worker    name: "mini_cil_parser",
33*e4a36f41SAndroid Build Coastguard Worker    srcs: ["mini_parser.py"],
34*e4a36f41SAndroid Build Coastguard Worker}
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Workerpython_library_host {
37*e4a36f41SAndroid Build Coastguard Worker    name: "pysepolwrap",
38*e4a36f41SAndroid Build Coastguard Worker    srcs: [
39*e4a36f41SAndroid Build Coastguard Worker        "fc_sort.py",
40*e4a36f41SAndroid Build Coastguard Worker        "policy.py",
41*e4a36f41SAndroid Build Coastguard Worker    ],
42*e4a36f41SAndroid Build Coastguard Worker}
43*e4a36f41SAndroid Build Coastguard Worker
44*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
45*e4a36f41SAndroid Build Coastguard Worker    name: "treble_sepolicy_tests",
46*e4a36f41SAndroid Build Coastguard Worker    srcs: [
47*e4a36f41SAndroid Build Coastguard Worker        "treble_sepolicy_tests.py",
48*e4a36f41SAndroid Build Coastguard Worker    ],
49*e4a36f41SAndroid Build Coastguard Worker    version: {
50*e4a36f41SAndroid Build Coastguard Worker        py3: {
51*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
52*e4a36f41SAndroid Build Coastguard Worker        },
53*e4a36f41SAndroid Build Coastguard Worker    },
54*e4a36f41SAndroid Build Coastguard Worker    libs: [
55*e4a36f41SAndroid Build Coastguard Worker        "mini_cil_parser",
56*e4a36f41SAndroid Build Coastguard Worker    ],
57*e4a36f41SAndroid Build Coastguard Worker}
58*e4a36f41SAndroid Build Coastguard Worker
59*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
60*e4a36f41SAndroid Build Coastguard Worker    name: "sepolicy_tests",
61*e4a36f41SAndroid Build Coastguard Worker    srcs: [
62*e4a36f41SAndroid Build Coastguard Worker        "sepolicy_tests.py",
63*e4a36f41SAndroid Build Coastguard Worker    ],
64*e4a36f41SAndroid Build Coastguard Worker    version: {
65*e4a36f41SAndroid Build Coastguard Worker        py3: {
66*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
67*e4a36f41SAndroid Build Coastguard Worker        },
68*e4a36f41SAndroid Build Coastguard Worker    },
69*e4a36f41SAndroid Build Coastguard Worker    libs: ["pysepolwrap"],
70*e4a36f41SAndroid Build Coastguard Worker    data: [":libsepolwrap"],
71*e4a36f41SAndroid Build Coastguard Worker}
72*e4a36f41SAndroid Build Coastguard Worker
73*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
74*e4a36f41SAndroid Build Coastguard Worker    name: "apex_sepolicy_tests",
75*e4a36f41SAndroid Build Coastguard Worker    srcs: [
76*e4a36f41SAndroid Build Coastguard Worker        "apex_sepolicy_tests.py",
77*e4a36f41SAndroid Build Coastguard Worker    ],
78*e4a36f41SAndroid Build Coastguard Worker    version: {
79*e4a36f41SAndroid Build Coastguard Worker        py3: {
80*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
81*e4a36f41SAndroid Build Coastguard Worker        },
82*e4a36f41SAndroid Build Coastguard Worker    },
83*e4a36f41SAndroid Build Coastguard Worker    libs: ["pysepolwrap"],
84*e4a36f41SAndroid Build Coastguard Worker    data: [
85*e4a36f41SAndroid Build Coastguard Worker        ":libsepolwrap",
86*e4a36f41SAndroid Build Coastguard Worker    ],
87*e4a36f41SAndroid Build Coastguard Worker    device_common_data: [
88*e4a36f41SAndroid Build Coastguard Worker        ":precompiled_sepolicy",
89*e4a36f41SAndroid Build Coastguard Worker    ],
90*e4a36f41SAndroid Build Coastguard Worker}
91*e4a36f41SAndroid Build Coastguard Worker
92*e4a36f41SAndroid Build Coastguard Workerpython_test_host {
93*e4a36f41SAndroid Build Coastguard Worker    name: "apex_sepolicy_tests_test",
94*e4a36f41SAndroid Build Coastguard Worker    srcs: [
95*e4a36f41SAndroid Build Coastguard Worker        "apex_sepolicy_tests.py",
96*e4a36f41SAndroid Build Coastguard Worker        "apex_sepolicy_tests_test.py",
97*e4a36f41SAndroid Build Coastguard Worker    ],
98*e4a36f41SAndroid Build Coastguard Worker    libs: ["pysepolwrap"],
99*e4a36f41SAndroid Build Coastguard Worker    data: [
100*e4a36f41SAndroid Build Coastguard Worker        ":libsepolwrap",
101*e4a36f41SAndroid Build Coastguard Worker    ],
102*e4a36f41SAndroid Build Coastguard Worker    device_common_data: [
103*e4a36f41SAndroid Build Coastguard Worker        ":precompiled_sepolicy",
104*e4a36f41SAndroid Build Coastguard Worker    ],
105*e4a36f41SAndroid Build Coastguard Worker    test_options: {
106*e4a36f41SAndroid Build Coastguard Worker        unit_test: true,
107*e4a36f41SAndroid Build Coastguard Worker    },
108*e4a36f41SAndroid Build Coastguard Worker    version: {
109*e4a36f41SAndroid Build Coastguard Worker        py3: {
110*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
111*e4a36f41SAndroid Build Coastguard Worker        },
112*e4a36f41SAndroid Build Coastguard Worker    },
113*e4a36f41SAndroid Build Coastguard Worker}
114*e4a36f41SAndroid Build Coastguard Worker
115*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
116*e4a36f41SAndroid Build Coastguard Worker    name: "searchpolicy",
117*e4a36f41SAndroid Build Coastguard Worker    srcs: [
118*e4a36f41SAndroid Build Coastguard Worker        "searchpolicy.py",
119*e4a36f41SAndroid Build Coastguard Worker    ],
120*e4a36f41SAndroid Build Coastguard Worker    libs: ["pysepolwrap"],
121*e4a36f41SAndroid Build Coastguard Worker    required: ["libsepolwrap"],
122*e4a36f41SAndroid Build Coastguard Worker}
123*e4a36f41SAndroid Build Coastguard Worker
124*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
125*e4a36f41SAndroid Build Coastguard Worker    name: "combine_maps",
126*e4a36f41SAndroid Build Coastguard Worker    srcs: [
127*e4a36f41SAndroid Build Coastguard Worker        "combine_maps.py",
128*e4a36f41SAndroid Build Coastguard Worker    ],
129*e4a36f41SAndroid Build Coastguard Worker    libs: ["mini_cil_parser"],
130*e4a36f41SAndroid Build Coastguard Worker}
131*e4a36f41SAndroid Build Coastguard Worker
132*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
133*e4a36f41SAndroid Build Coastguard Worker    name: "fc_sort",
134*e4a36f41SAndroid Build Coastguard Worker    srcs: [
135*e4a36f41SAndroid Build Coastguard Worker        "fc_sort.py",
136*e4a36f41SAndroid Build Coastguard Worker    ],
137*e4a36f41SAndroid Build Coastguard Worker}
138*e4a36f41SAndroid Build Coastguard Worker
139*e4a36f41SAndroid Build Coastguard Workerpython_test_host {
140*e4a36f41SAndroid Build Coastguard Worker    name: "fc_sort_test",
141*e4a36f41SAndroid Build Coastguard Worker    srcs: [
142*e4a36f41SAndroid Build Coastguard Worker        "fc_sort.py",
143*e4a36f41SAndroid Build Coastguard Worker        "fc_sort_test.py",
144*e4a36f41SAndroid Build Coastguard Worker    ],
145*e4a36f41SAndroid Build Coastguard Worker    test_options: {
146*e4a36f41SAndroid Build Coastguard Worker        unit_test: true,
147*e4a36f41SAndroid Build Coastguard Worker    },
148*e4a36f41SAndroid Build Coastguard Worker}
149*e4a36f41SAndroid Build Coastguard Worker
150*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
151*e4a36f41SAndroid Build Coastguard Worker    name: "check_prop_prefix",
152*e4a36f41SAndroid Build Coastguard Worker    srcs: ["check_prop_prefix.py"],
153*e4a36f41SAndroid Build Coastguard Worker}
154*e4a36f41SAndroid Build Coastguard Worker
155*e4a36f41SAndroid Build Coastguard Workerpython_binary_host {
156*e4a36f41SAndroid Build Coastguard Worker    name: "sepolicy_freeze_test",
157*e4a36f41SAndroid Build Coastguard Worker    srcs: [
158*e4a36f41SAndroid Build Coastguard Worker        "sepolicy_freeze_test.py",
159*e4a36f41SAndroid Build Coastguard Worker    ],
160*e4a36f41SAndroid Build Coastguard Worker    version: {
161*e4a36f41SAndroid Build Coastguard Worker        py3: {
162*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
163*e4a36f41SAndroid Build Coastguard Worker        },
164*e4a36f41SAndroid Build Coastguard Worker    },
165*e4a36f41SAndroid Build Coastguard Worker    libs: [
166*e4a36f41SAndroid Build Coastguard Worker        "mini_cil_parser",
167*e4a36f41SAndroid Build Coastguard Worker    ],
168*e4a36f41SAndroid Build Coastguard Worker}
169*e4a36f41SAndroid Build Coastguard Worker
170*e4a36f41SAndroid Build Coastguard Workerpython_test_host {
171*e4a36f41SAndroid Build Coastguard Worker    name: "policy_test",
172*e4a36f41SAndroid Build Coastguard Worker    srcs: [
173*e4a36f41SAndroid Build Coastguard Worker        "fc_sort.py",
174*e4a36f41SAndroid Build Coastguard Worker        "policy.py",
175*e4a36f41SAndroid Build Coastguard Worker        "policy_test.py",
176*e4a36f41SAndroid Build Coastguard Worker    ],
177*e4a36f41SAndroid Build Coastguard Worker    test_options: {
178*e4a36f41SAndroid Build Coastguard Worker        unit_test: true,
179*e4a36f41SAndroid Build Coastguard Worker    },
180*e4a36f41SAndroid Build Coastguard Worker    version: {
181*e4a36f41SAndroid Build Coastguard Worker        py3: {
182*e4a36f41SAndroid Build Coastguard Worker            embedded_launcher: true,
183*e4a36f41SAndroid Build Coastguard Worker        },
184*e4a36f41SAndroid Build Coastguard Worker    },
185*e4a36f41SAndroid Build Coastguard Worker}
186*e4a36f41SAndroid Build Coastguard Worker
187*e4a36f41SAndroid Build Coastguard Worker// prebuilt files to be included to CTS
188*e4a36f41SAndroid Build Coastguard Workerfilegroup {
189*e4a36f41SAndroid Build Coastguard Worker    name: "prebuilt_sepolicy_cts_data",
190*e4a36f41SAndroid Build Coastguard Worker    srcs: [":202404_sepolicy_cts_data"],
191*e4a36f41SAndroid Build Coastguard Worker    visibility: ["//cts/hostsidetests/security"],
192*e4a36f41SAndroid Build Coastguard Worker}
193