xref: /aosp_15_r20/tools/asuite/atest/Android.bp (revision c2e18aaa1096c836b086f94603d04f4eb9cf37f5)
1*c2e18aaaSAndroid Build Coastguard Worker// Copyright 2019 The Android Open Source Project
2*c2e18aaaSAndroid Build Coastguard Worker//
3*c2e18aaaSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*c2e18aaaSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*c2e18aaaSAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*c2e18aaaSAndroid Build Coastguard Worker//
7*c2e18aaaSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*c2e18aaaSAndroid Build Coastguard Worker//
9*c2e18aaaSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*c2e18aaaSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*c2e18aaaSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*c2e18aaaSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*c2e18aaaSAndroid Build Coastguard Worker// limitations under the License.
14*c2e18aaaSAndroid Build Coastguard Worker
15*c2e18aaaSAndroid Build Coastguard Worker// Set of error prone rules to ensure code quality
16*c2e18aaaSAndroid Build Coastguard Worker// PackageLocation check requires the androidCompatible=false otherwise it does not do anything.
17*c2e18aaaSAndroid Build Coastguard Workerpackage {
18*c2e18aaaSAndroid Build Coastguard Worker    default_applicable_licenses: ["Android-Apache-2.0"],
19*c2e18aaaSAndroid Build Coastguard Worker}
20*c2e18aaaSAndroid Build Coastguard Worker
21*c2e18aaaSAndroid Build Coastguard Worker// Attributes common to both atest binaries and unittests.
22*c2e18aaaSAndroid Build Coastguard Workerpython_defaults {
23*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_defaults",
24*c2e18aaaSAndroid Build Coastguard Worker    pkg_path: "atest",
25*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
26*c2e18aaaSAndroid Build Coastguard Worker        "**/*.py",
27*c2e18aaaSAndroid Build Coastguard Worker    ],
28*c2e18aaaSAndroid Build Coastguard Worker    libs: [
29*c2e18aaaSAndroid Build Coastguard Worker        "asuite_proto",
30*c2e18aaaSAndroid Build Coastguard Worker        "tradefed-protos-py",
31*c2e18aaaSAndroid Build Coastguard Worker        "py-google-api-python-client",
32*c2e18aaaSAndroid Build Coastguard Worker        "py-oauth2client",
33*c2e18aaaSAndroid Build Coastguard Worker        "pyyaml",
34*c2e18aaaSAndroid Build Coastguard Worker        "ca_certs_locater",
35*c2e18aaaSAndroid Build Coastguard Worker    ],
36*c2e18aaaSAndroid Build Coastguard Worker    exclude_srcs: [
37*c2e18aaaSAndroid Build Coastguard Worker        "asuite_lib_test/*.py",
38*c2e18aaaSAndroid Build Coastguard Worker        "proto/*.py",
39*c2e18aaaSAndroid Build Coastguard Worker        "tf_proto/*.py",
40*c2e18aaaSAndroid Build Coastguard Worker        "cc_test_filter_generator.py",
41*c2e18aaaSAndroid Build Coastguard Worker        "cc_test_filter_generator_test.py",
42*c2e18aaaSAndroid Build Coastguard Worker        "java_test_filter_generator.py",
43*c2e18aaaSAndroid Build Coastguard Worker        "java_test_filter_generator_test.py",
44*c2e18aaaSAndroid Build Coastguard Worker    ],
45*c2e18aaaSAndroid Build Coastguard Worker    version: {
46*c2e18aaaSAndroid Build Coastguard Worker        py3: {
47*c2e18aaaSAndroid Build Coastguard Worker            embedded_launcher: true,
48*c2e18aaaSAndroid Build Coastguard Worker        },
49*c2e18aaaSAndroid Build Coastguard Worker    },
50*c2e18aaaSAndroid Build Coastguard Worker}
51*c2e18aaaSAndroid Build Coastguard Worker
52*c2e18aaaSAndroid Build Coastguard Worker// Attributes common to atest binaries.
53*c2e18aaaSAndroid Build Coastguard Workerpython_defaults {
54*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_binary_defaults",
55*c2e18aaaSAndroid Build Coastguard Worker    defaults: ["atest_defaults"],
56*c2e18aaaSAndroid Build Coastguard Worker    data: [
57*c2e18aaaSAndroid Build Coastguard Worker        "bazel/resources/**/*",
58*c2e18aaaSAndroid Build Coastguard Worker    ],
59*c2e18aaaSAndroid Build Coastguard Worker    exclude_srcs: [
60*c2e18aaaSAndroid Build Coastguard Worker        "integration_tests/*.py",
61*c2e18aaaSAndroid Build Coastguard Worker        "*_unittest.py",
62*c2e18aaaSAndroid Build Coastguard Worker        "**/*_unittest.py",
63*c2e18aaaSAndroid Build Coastguard Worker    ],
64*c2e18aaaSAndroid Build Coastguard Worker}
65*c2e18aaaSAndroid Build Coastguard Worker
66*c2e18aaaSAndroid Build Coastguard Workerpython_binary_host {
67*c2e18aaaSAndroid Build Coastguard Worker    name: "atest",
68*c2e18aaaSAndroid Build Coastguard Worker    defaults: ["atest_binary_defaults"],
69*c2e18aaaSAndroid Build Coastguard Worker    main: "atest_main.py",
70*c2e18aaaSAndroid Build Coastguard Worker    data: [
71*c2e18aaaSAndroid Build Coastguard Worker        ":adte-owners-files",
72*c2e18aaaSAndroid Build Coastguard Worker        ":atest_flag_list_for_completion",
73*c2e18aaaSAndroid Build Coastguard Worker        ":atest_log_uploader",
74*c2e18aaaSAndroid Build Coastguard Worker    ],
75*c2e18aaaSAndroid Build Coastguard Worker    // Make atest's built name be atest-dev
76*c2e18aaaSAndroid Build Coastguard Worker    stem: "atest-dev",
77*c2e18aaaSAndroid Build Coastguard Worker    dist: {
78*c2e18aaaSAndroid Build Coastguard Worker        targets: ["droidcore"],
79*c2e18aaaSAndroid Build Coastguard Worker    },
80*c2e18aaaSAndroid Build Coastguard Worker}
81*c2e18aaaSAndroid Build Coastguard Worker
82*c2e18aaaSAndroid Build Coastguard Workerpython_binary_host {
83*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_log_uploader",
84*c2e18aaaSAndroid Build Coastguard Worker    defaults: ["atest_binary_defaults"],
85*c2e18aaaSAndroid Build Coastguard Worker    main: "logstorage/log_uploader.py",
86*c2e18aaaSAndroid Build Coastguard Worker}
87*c2e18aaaSAndroid Build Coastguard Worker
88*c2e18aaaSAndroid Build Coastguard Worker// A helper binary used to generate the atest_flag_list_for_completion.txt
89*c2e18aaaSAndroid Build Coastguard Worker// file, it should never be run outside of the build. It's the same
90*c2e18aaaSAndroid Build Coastguard Worker// as atest except it has atest_flag_list_generator.py as it's main python
91*c2e18aaaSAndroid Build Coastguard Worker// file. The atest_flag_list_for_completion.txt file is extracted from the
92*c2e18aaaSAndroid Build Coastguard Worker// atest binary during autocompletion.
93*c2e18aaaSAndroid Build Coastguard Workerpython_binary_host {
94*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_flag_list_generator",
95*c2e18aaaSAndroid Build Coastguard Worker    defaults: ["atest_binary_defaults"],
96*c2e18aaaSAndroid Build Coastguard Worker    main: "atest_flag_list_generator.py",
97*c2e18aaaSAndroid Build Coastguard Worker}
98*c2e18aaaSAndroid Build Coastguard Worker
99*c2e18aaaSAndroid Build Coastguard Workergenrule {
100*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_flag_list_for_completion",
101*c2e18aaaSAndroid Build Coastguard Worker    out: ["atest_flag_list_for_completion.txt"],
102*c2e18aaaSAndroid Build Coastguard Worker    tools: ["atest_flag_list_generator"],
103*c2e18aaaSAndroid Build Coastguard Worker    cmd: "$(location atest_flag_list_generator) > $(out)",
104*c2e18aaaSAndroid Build Coastguard Worker}
105*c2e18aaaSAndroid Build Coastguard Worker
106*c2e18aaaSAndroid Build Coastguard Workerpython_library_host {
107*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_module_info",
108*c2e18aaaSAndroid Build Coastguard Worker    pkg_path: "atest",
109*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
110*c2e18aaaSAndroid Build Coastguard Worker        "atest_error.py",
111*c2e18aaaSAndroid Build Coastguard Worker        "atest_decorator.py",
112*c2e18aaaSAndroid Build Coastguard Worker        "atest_utils.py",
113*c2e18aaaSAndroid Build Coastguard Worker        "constants.py",
114*c2e18aaaSAndroid Build Coastguard Worker        "constants_default.py",
115*c2e18aaaSAndroid Build Coastguard Worker        "module_info.py",
116*c2e18aaaSAndroid Build Coastguard Worker    ],
117*c2e18aaaSAndroid Build Coastguard Worker    libs: [
118*c2e18aaaSAndroid Build Coastguard Worker        "tradefed-protos-py",
119*c2e18aaaSAndroid Build Coastguard Worker    ],
120*c2e18aaaSAndroid Build Coastguard Worker}
121*c2e18aaaSAndroid Build Coastguard Worker
122*c2e18aaaSAndroid Build Coastguard Workerpython_library_host {
123*c2e18aaaSAndroid Build Coastguard Worker    name: "asuite_cc_client",
124*c2e18aaaSAndroid Build Coastguard Worker    pkg_path: "atest",
125*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
126*c2e18aaaSAndroid Build Coastguard Worker        "atest_enum.py",
127*c2e18aaaSAndroid Build Coastguard Worker        "metrics/*.py",
128*c2e18aaaSAndroid Build Coastguard Worker        "coverage/*.py",
129*c2e18aaaSAndroid Build Coastguard Worker    ],
130*c2e18aaaSAndroid Build Coastguard Worker    libs: [
131*c2e18aaaSAndroid Build Coastguard Worker        "asuite_proto",
132*c2e18aaaSAndroid Build Coastguard Worker        "atest_module_info",
133*c2e18aaaSAndroid Build Coastguard Worker    ],
134*c2e18aaaSAndroid Build Coastguard Worker}
135*c2e18aaaSAndroid Build Coastguard Worker
136*c2e18aaaSAndroid Build Coastguard Workerpython_test_host {
137*c2e18aaaSAndroid Build Coastguard Worker    name: "atest_unittests",
138*c2e18aaaSAndroid Build Coastguard Worker    main: "atest_run_unittests.py",
139*c2e18aaaSAndroid Build Coastguard Worker    defaults: ["atest_defaults"],
140*c2e18aaaSAndroid Build Coastguard Worker    test_options: {
141*c2e18aaaSAndroid Build Coastguard Worker        unit_test: true,
142*c2e18aaaSAndroid Build Coastguard Worker    },
143*c2e18aaaSAndroid Build Coastguard Worker    data: [
144*c2e18aaaSAndroid Build Coastguard Worker        "unittest_data/**/*",
145*c2e18aaaSAndroid Build Coastguard Worker        "unittest_data/**/.*",
146*c2e18aaaSAndroid Build Coastguard Worker    ],
147*c2e18aaaSAndroid Build Coastguard Worker    exclude_srcs: [
148*c2e18aaaSAndroid Build Coastguard Worker        "tools/atest_updatedb_unittest.py",
149*c2e18aaaSAndroid Build Coastguard Worker    ],
150*c2e18aaaSAndroid Build Coastguard Worker    libs: [
151*c2e18aaaSAndroid Build Coastguard Worker        "pyfakefs",
152*c2e18aaaSAndroid Build Coastguard Worker        "py-httplib2",
153*c2e18aaaSAndroid Build Coastguard Worker    ],
154*c2e18aaaSAndroid Build Coastguard Worker    test_config: "atest_unittests.xml",
155*c2e18aaaSAndroid Build Coastguard Worker    test_suites: ["general-tests"],
156*c2e18aaaSAndroid Build Coastguard Worker}
157