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