• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21cc_library_headers {
22    name: "libberberis_ndk_program_tests_headers",
23    native_bridge_supported: true,
24    export_include_dirs: ["include"],
25}
26
27filegroup {
28    name: "berberis_ndk_program_tests_srcs",
29    srcs: [
30        "atomics_test.cc",
31        "clone_test.cc",
32        "condvar_test.cc",
33        "cpp_test.cc",
34        "ctype_test.cc",
35        "div_test.cc",
36        "epoll_test.cc",
37        "memory_order_test.cc",
38        "mutex_test.cc",
39        "proc_self_maps_test.cc",
40        "ptrace_test.cc",
41        "resource_test.cc",
42        "sem_test.cc",
43        "setjmp_test.cc",
44        "sigaltstack_test.cc",
45        "signal_test.cc",
46        "string_test.cc",
47        "sysconf_test.cc",
48        "thread_test.cc",
49        "time_test.cc",
50        "user_test.cc",
51        "wchar_test.cc",
52        "zlib_test.cc",
53    ],
54}
55
56filegroup {
57    name: "berberis_ndk_program_tests_riscv64_srcs",
58    srcs: [
59        "riscv64/handle_not_executable_test.cc",
60        "riscv64/runtime_code_patching_test.cc",
61        "riscv64/sigill_test.cc",
62    ],
63}
64
65cc_defaults {
66    name: "berberis_ndk_program_tests_defaults",
67    native_bridge_supported: true,
68    cflags: [
69        "-fexceptions",
70        "-Wunused",
71        "-Wextra",
72        "-Wall",
73        "-Werror",
74        "-Wno-deprecated-declarations",
75    ],
76    srcs: [":berberis_ndk_program_tests_srcs"],
77    arch: {
78        riscv64: {
79            srcs: [":berberis_ndk_program_tests_riscv64_srcs"],
80            // Note: we don't even need to use anything from that library, just need to ensure it
81            // can be compiled successfully: all checks are done with static_asserts.
82            static_libs: ["libberberis_emulated_libvulkan_api_checker"],
83        },
84    },
85    header_libs: ["libberberis_ndk_program_tests_headers"],
86    static_libs: ["libgtest"],
87}
88
89cc_test {
90    name: "berberis_ndk_program_tests",
91    defaults: ["berberis_ndk_program_tests_defaults"],
92    shared_libs: ["libz"],
93    srcs: [
94        // TODO(b/187471779): Signal stress test is unstable with high number of repetitions.
95        // TODO(b/188086209): Errno emulation is not thread-safe - some checks fail.
96        "signal_stress_test.cc",
97        "system_properties_test.cc",
98    ],
99}
100
101cc_test {
102    name: "berberis_ndk_program_tests_static",
103    defaults: ["berberis_ndk_program_tests_defaults"],
104    static_libs: ["libz"],
105    static_executable: true,
106}
107
108//
109// TODO(b/232598137): Merge riscv targets above into general targets with customizations below.
110//
111
112cc_defaults {
113    name: "ndk_program_tests_common_defaults",
114    native_bridge_supported: true,
115    cflags: [
116        "-fexceptions",
117        "-Wunused",
118        "-Wextra",
119        "-Wall",
120        "-Werror",
121        "-Wno-deprecated-declarations",
122    ],
123    srcs: [":berberis_ndk_program_tests_srcs"],
124    arch: {
125        arm: {
126            srcs: [
127                "arm/handle_not_executable_test.cc",
128                "arm/sigill_test.cc",
129            ],
130        },
131        arm64: {
132            srcs: [
133                "arm64/handle_not_executable_test.cc",
134                "arm64/runtime_code_patching_test.cc",
135                "arm64/sigill_test.cc",
136            ],
137        },
138    },
139    header_libs: ["libberberis_ndk_program_tests_headers"],
140}
141
142cc_defaults {
143    name: "ndk_program_tests_dynamic_defaults",
144    defaults: ["ndk_program_tests_common_defaults"],
145    srcs: [
146        "signal_stress_test.cc",
147        "system_properties_test.cc",
148    ],
149    arch: {
150        arm: {
151            srcs: [
152                "arm/arm_test.cc",
153                "arm/cpu_features_test.cc",
154                "arm/neon_test.cc",
155                "arm/runtime_code_patching_test.cc",
156                "arm/syscall_test.cc",
157                "file_test.cc",
158                "futex_test.cc",
159            ],
160        },
161        arm64: {
162            srcs: [
163                "arm64/cpu_features_test.cc",
164            ],
165        },
166    },
167    static_libs: ["cpufeatures"],
168    shared_libs: ["libz"],
169}
170
171cc_test {
172    name: "ndk_program_tests",
173    defaults: ["ndk_program_tests_dynamic_defaults"],
174    arch: {
175        arm: {
176            cflags: [
177                "-march=armv7-a",
178                "-mcpu=cortex-a9",
179                "-mfpu=neon",
180                "-mfloat-abi=softfp",
181            ],
182        },
183    },
184}
185
186cc_test {
187    name: "ndk_program_tests_armv8",
188    defaults: ["ndk_program_tests_dynamic_defaults"],
189    enabled: false,
190    arch: {
191        arm: {
192            enabled: true,
193            cflags: [
194                "-march=armv8-a",
195                "-mcpu=cortex-a57",
196                "-mfpu=neon",
197                "-mfloat-abi=softfp",
198            ],
199        },
200    },
201}
202
203cc_test {
204    name: "ndk_program_tests_static",
205    defaults: ["ndk_program_tests_common_defaults"],
206    srcs: [
207        // TODO(b/187471779): fix for static executable.
208        // "handle_not_executable_test.cc",
209        // TODO(b/187471779): Signal stress test is unstable with high number of repeatitions.
210        // TODO(b/188086209): Errno emulation is not thread-safe - some checks fail.
211        // "signal_stress_test.cc",
212    ],
213    static_libs: ["libz"],
214    static_executable: true,
215}
216