xref: /aosp_15_r20/external/ltp/Android.bp (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1//
2// Copyright (C) 2016 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
17// Include the generated rules
18// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
19//     CONSULT THE OWNERS AND [email protected] BEFORE
20//     DEPENDING ON IT IN YOUR PROJECT. ***
21package {
22    default_applicable_licenses: ["external_ltp_license"],
23    default_team: "trendy_team_android_kernel",
24}
25
26// Added automatically by a large-scale-change that took the approach of
27// 'apply every license found to every target'. While this makes sure we respect
28// every license restriction, it may not be entirely correct.
29//
30// e.g. GPL in an MIT project might only apply to the contrib/ directory.
31//
32// Please consider splitting the single license below into multiple licenses,
33// taking care not to lose any license_kind information, and overriding the
34// default license using the 'licenses: [...]' property on targets as needed.
35//
36// For unused files, consider creating a 'fileGroup' with "//visibility:private"
37// to attach the license to, and including a comment whether the files may be
38// used in the current project.
39//
40// large-scale-change included anything that looked like it might be a license
41// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
42//
43// Please consider removing redundant or irrelevant files from 'license_text:'.
44// See: http://go/android-license-faq
45license {
46    name: "external_ltp_license",
47    visibility: [":__subpackages__"],
48    license_kinds: [
49        "SPDX-license-identifier-APSL-1.1",
50        "SPDX-license-identifier-Apache-2.0",
51        "SPDX-license-identifier-BSD",
52        "SPDX-license-identifier-BSD-2-Clause",
53        "SPDX-license-identifier-BSD-3-Clause",
54        "SPDX-license-identifier-GFDL", // by exception only
55        "SPDX-license-identifier-GPL",
56        "SPDX-license-identifier-GPL-2.0",
57        "SPDX-license-identifier-GPL-3.0",
58        "SPDX-license-identifier-ISC",
59        "SPDX-license-identifier-LGPL",
60    ],
61    license_text: [
62        "COPYING",
63        "NOTICE",
64    ],
65}
66
67build = ["gen.bp"]
68
69// The gen.bp file will be embedded in the gen_ltp_config tool,
70// which reads its data using pkgutil.get_data(). As far as I can
71// tell, there's no way to read a file in the root of the python
72// zip, so we have to use a genrule here to move gen.bp to an
73// arbitrary subfolder first.
74genrule {
75    name: "ltp_gen_bp_file",
76    srcs: ["gen.bp"],
77    out: ["android/tools/gen.bp"],
78    cmd: "cp $(in) $(out)",
79}
80
81filegroup {
82    name: "ltp_runtests",
83    srcs: ["runtest/*"],
84}
85
86filegroup {
87    name: "ltp_disabled_tests",
88    srcs: ["android/tools/disabled_tests.txt"],
89}
90
91genrule {
92    name: "ltp_syscalls_h",
93    tool_files: [
94        "include/lapi/syscalls/order",
95        "include/lapi/syscalls/regen.sh",
96        "include/lapi/syscalls/*.in",
97    ],
98    cmd: "$(location include/lapi/syscalls/regen.sh) $(genDir)/lapi/syscalls.h",
99    out: ["lapi/syscalls.h"],
100}
101
102genrule {
103    name: "ltp_version_h",
104    srcs: [
105        "VERSION",
106    ],
107    cmd: "echo \"#define LTP_VERSION \\\"$$(cat $(in))\\\"\" > $(out)",
108    out: ["ltp-version.h"],
109}
110
111cc_defaults {
112    name: "ltp_defaults",
113
114    // Upstream explicitly chooses this in its makefile.
115    c_std: "gnu99",
116
117    cflags: [
118        // Hacks for bionic compatibility
119        "-include bionic-compat.h",
120        "-fcommon", //ld.lld: error: duplicate symbol use_the_ltp_clone_functions__do_not_use_clone
121        // Too many files import sched.h so we enable -fcommon locally
122        // ltp may get away with this with glibc because of the __USE_GNU guard in glibc's <sched.h>
123        "-Wall",
124        "-Werror",
125        // These warnings should be checked and fixed upstream
126        "-Wno-absolute-value",
127        "-Wno-uninitialized",
128        "-Wno-user-defined-warnings",
129        // Silence noisy warnings
130        "-Wno-constant-conversion",
131        "-Wno-deprecated",
132        "-Wno-duplicate-decl-specifier",
133        "-Wno-empty-body",
134        "-Wno-format",
135        "-Wno-gnu-designator",
136        "-Wno-implicit-function-declaration",
137        "-Wno-incompatible-pointer-types-discards-qualifiers",
138        "-Wno-knr-promoted-parameter",
139        "-Wno-macro-redefined",
140        "-Wno-missing-braces",
141        "-Wno-missing-field-initializers",
142        "-Wno-parentheses-equality",
143        "-Wno-pointer-arith",
144        "-Wno-pointer-sign",
145        "-Wno-sign-compare",
146        "-Wno-tautological-compare",
147        "-Wno-unneeded-internal-declaration",
148        "-Wno-unreachable-code-loop-increment",
149        "-Wno-unused-function",
150        "-Wno-unused-parameter",
151        "-Wno-unused-variable",
152    ],
153
154    local_include_dirs: [
155        "android/include",
156        "include",
157    ],
158
159    target: {
160        // bionic has broken signal handling for signum > 32 on 32-bit ARM and x86
161        // (for ABI reasons this can't be fixed)
162        android_arm: {
163            cflags: ["-DNUMSIGS=32"],
164        },
165        android_x86: {
166            cflags: ["-DNUMSIGS=32"],
167        },
168    },
169
170    generated_headers: [
171        "ltp_syscalls_h",
172        "ltp_version_h",
173    ],
174
175    static_libs: ["libcap"],
176
177    // TODO: recover libaio when the external project created
178    shared_libs: [
179        "libselinux",
180        "libasyncio",
181    ],
182}
183
184cc_defaults {
185    name: "ltp_test_defaults",
186    defaults: ["ltp_defaults"],
187    gtest: false,
188    cflags: ["-Wno-gnu-variable-sized-type-not-at-end"],
189    no_named_install_directory: true,
190    relative_install_path: "vts_ltp_tests/testcases/bin",
191}
192