xref: /aosp_15_r20/tools/asuite/atest/unittest_constants.py (revision c2e18aaa1096c836b086f94603d04f4eb9cf37f5)
1*c2e18aaaSAndroid Build Coastguard Worker# Copyright 2018, 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"""Unittest constants.
16*c2e18aaaSAndroid Build Coastguard Worker
17*c2e18aaaSAndroid Build Coastguard WorkerUnittest constants get their own file since they're used purely for testing and
18*c2e18aaaSAndroid Build Coastguard Workershould not be combined with constants_defaults as part of normal atest
19*c2e18aaaSAndroid Build Coastguard Workeroperation. These constants are used commonly as test data so when updating a
20*c2e18aaaSAndroid Build Coastguard Workerconstant, do so with care and run all unittests to make sure nothing breaks.
21*c2e18aaaSAndroid Build Coastguard Worker"""
22*c2e18aaaSAndroid Build Coastguard Worker
23*c2e18aaaSAndroid Build Coastguard Workerimport os
24*c2e18aaaSAndroid Build Coastguard Workerfrom pathlib import Path
25*c2e18aaaSAndroid Build Coastguard Workerimport zipfile
26*c2e18aaaSAndroid Build Coastguard Worker
27*c2e18aaaSAndroid Build Coastguard Workerfrom atest import constants
28*c2e18aaaSAndroid Build Coastguard Workerfrom atest.test_finders import test_info
29*c2e18aaaSAndroid Build Coastguard Workerfrom atest.test_runners import atest_tf_test_runner as atf_tr
30*c2e18aaaSAndroid Build Coastguard Worker
31*c2e18aaaSAndroid Build Coastguard WorkerROOT = '/'
32*c2e18aaaSAndroid Build Coastguard WorkerMODULE_DIR = 'foo/bar/jank'
33*c2e18aaaSAndroid Build Coastguard WorkerMODULE2_DIR = 'foo/bar/hello'
34*c2e18aaaSAndroid Build Coastguard WorkerMODULE_NAME = 'CtsJankDeviceTestCases'
35*c2e18aaaSAndroid Build Coastguard WorkerMODULE_CONFIG_NAME = 'CtsJankDeviceTestCases2'
36*c2e18aaaSAndroid Build Coastguard WorkerHOST_UNIT_TEST_NAME_1 = 'host_unit_test1'
37*c2e18aaaSAndroid Build Coastguard WorkerHOST_UNIT_TEST_NAME_2 = 'host_unit_test2'
38*c2e18aaaSAndroid Build Coastguard WorkerTYPO_MODULE_NAME = 'CtsJankDeviceTestCase'
39*c2e18aaaSAndroid Build Coastguard WorkerMODULE2_NAME = 'HelloWorldTests'
40*c2e18aaaSAndroid Build Coastguard WorkerCLASS_NAME = 'CtsDeviceJankUi'
41*c2e18aaaSAndroid Build Coastguard WorkerFULL_CLASS_NAME = 'android.jank.cts.ui.CtsDeviceJankUi'
42*c2e18aaaSAndroid Build Coastguard WorkerPACKAGE = 'android.jank.cts.ui'
43*c2e18aaaSAndroid Build Coastguard WorkerFIND_ONE = ROOT + 'foo/bar/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java\n'
44*c2e18aaaSAndroid Build Coastguard WorkerFIND_TWO = ROOT + 'other/dir/test.java\n' + FIND_ONE
45*c2e18aaaSAndroid Build Coastguard WorkerFIND_PKG = ROOT + 'foo/bar/jank/src/android/jank/cts/ui\n'
46*c2e18aaaSAndroid Build Coastguard WorkerINT_NAME = 'example/reboot'
47*c2e18aaaSAndroid Build Coastguard WorkerGTF_INT_NAME = 'some/gtf_int_test'
48*c2e18aaaSAndroid Build Coastguard Worker
49*c2e18aaaSAndroid Build Coastguard Worker
50*c2e18aaaSAndroid Build Coastguard Workerdef get_atest_package():
51*c2e18aaaSAndroid Build Coastguard Worker  """Get Atest directory."""
52*c2e18aaaSAndroid Build Coastguard Worker  package = os.path.dirname(os.path.realpath(__file__))
53*c2e18aaaSAndroid Build Coastguard Worker  if not os.path.isdir(package):
54*c2e18aaaSAndroid Build Coastguard Worker    par_file_path = os.path.dirname(package)
55*c2e18aaaSAndroid Build Coastguard Worker
56*c2e18aaaSAndroid Build Coastguard Worker    if os.path.isfile(par_file_path):
57*c2e18aaaSAndroid Build Coastguard Worker      destination_path = os.path.join(
58*c2e18aaaSAndroid Build Coastguard Worker          '/tmp/atest_extract/', str(os.path.getmtime(par_file_path))
59*c2e18aaaSAndroid Build Coastguard Worker      )
60*c2e18aaaSAndroid Build Coastguard Worker
61*c2e18aaaSAndroid Build Coastguard Worker      if not os.path.isdir(destination_path):
62*c2e18aaaSAndroid Build Coastguard Worker        Path(destination_path).mkdir(parents=True, exist_ok=True)
63*c2e18aaaSAndroid Build Coastguard Worker
64*c2e18aaaSAndroid Build Coastguard Worker      with zipfile.ZipFile(par_file_path, 'r') as zip_ref:
65*c2e18aaaSAndroid Build Coastguard Worker        zip_ref.extractall(destination_path)
66*c2e18aaaSAndroid Build Coastguard Worker      package = os.path.join(destination_path, 'atest')
67*c2e18aaaSAndroid Build Coastguard Worker
68*c2e18aaaSAndroid Build Coastguard Worker  return package
69*c2e18aaaSAndroid Build Coastguard Worker
70*c2e18aaaSAndroid Build Coastguard Worker
71*c2e18aaaSAndroid Build Coastguard WorkerATEST_PKG_DIR = get_atest_package()
72*c2e18aaaSAndroid Build Coastguard WorkerTEST_DATA_DIR = os.path.join(ATEST_PKG_DIR, 'unittest_data')
73*c2e18aaaSAndroid Build Coastguard WorkerTEST_CONFIG_DATA_DIR = os.path.join(TEST_DATA_DIR, 'test_config')
74*c2e18aaaSAndroid Build Coastguard Worker
75*c2e18aaaSAndroid Build Coastguard WorkerINT_DIR = 'tf/contrib/res/config'
76*c2e18aaaSAndroid Build Coastguard WorkerGTF_INT_DIR = 'gtf/core/res/config'
77*c2e18aaaSAndroid Build Coastguard Worker
78*c2e18aaaSAndroid Build Coastguard WorkerCONFIG_FILE = os.path.join(MODULE_DIR, constants.MODULE_CONFIG)
79*c2e18aaaSAndroid Build Coastguard WorkerEXTRA_CONFIG_FILE = os.path.join(MODULE_DIR, MODULE_CONFIG_NAME + '.xml')
80*c2e18aaaSAndroid Build Coastguard WorkerCONFIG2_FILE = os.path.join(MODULE2_DIR, constants.MODULE_CONFIG)
81*c2e18aaaSAndroid Build Coastguard WorkerJSON_FILE = 'module-info.json'
82*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_TARGET = '/out/%s' % JSON_FILE
83*c2e18aaaSAndroid Build Coastguard WorkerCC_DEP_FILE = 'module_bp_cc_deps.json'
84*c2e18aaaSAndroid Build Coastguard WorkerJAVA_DEP_FILE = 'module_bp_java_deps.json'
85*c2e18aaaSAndroid Build Coastguard WorkerMERGED_DEP_FILE = 'atest_merged_dep.json'
86*c2e18aaaSAndroid Build Coastguard WorkerMODULE_BUILD_TARGETS = {
87*c2e18aaaSAndroid Build Coastguard Worker    'tradefed-core',
88*c2e18aaaSAndroid Build Coastguard Worker    MODULE_INFO_TARGET,
89*c2e18aaaSAndroid Build Coastguard Worker    'MODULES-IN-%s' % MODULE_DIR.replace('/', '-'),
90*c2e18aaaSAndroid Build Coastguard Worker    'module-specific-target',
91*c2e18aaaSAndroid Build Coastguard Worker}
92*c2e18aaaSAndroid Build Coastguard WorkerMODULE_BUILD_TARGETS_W_DALVIK = MODULE_BUILD_TARGETS | {
93*c2e18aaaSAndroid Build Coastguard Worker    'cts-dalvik-device-test-runner',
94*c2e18aaaSAndroid Build Coastguard Worker    'cts-dalvik-host-test-runner',
95*c2e18aaaSAndroid Build Coastguard Worker    'cts-tradefed',
96*c2e18aaaSAndroid Build Coastguard Worker}
97*c2e18aaaSAndroid Build Coastguard WorkerMODULE_BUILD_TARGETS2 = {'build-target2'}
98*c2e18aaaSAndroid Build Coastguard WorkerMODULE_DATA = {
99*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CONFIG_FILE,
100*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
101*c2e18aaaSAndroid Build Coastguard Worker}
102*c2e18aaaSAndroid Build Coastguard WorkerMODULE_DATA2 = {
103*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CONFIG_FILE,
104*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
105*c2e18aaaSAndroid Build Coastguard Worker}
106*c2e18aaaSAndroid Build Coastguard WorkerMODULE_DATA_W_CONFIG = {
107*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: EXTRA_CONFIG_FILE,
108*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
109*c2e18aaaSAndroid Build Coastguard Worker}
110*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO = test_info.TestInfo(
111*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
112*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
113*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
114*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA,
115*c2e18aaaSAndroid Build Coastguard Worker)
116*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_W_DALVIK = test_info.TestInfo(
117*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
118*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
119*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS_W_DALVIK,
120*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA,
121*c2e18aaaSAndroid Build Coastguard Worker    module_class=[constants.MODULE_CLASS_JAVA_LIBRARIES],
122*c2e18aaaSAndroid Build Coastguard Worker)
123*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_W_CONFIG = test_info.TestInfo(
124*c2e18aaaSAndroid Build Coastguard Worker    MODULE_CONFIG_NAME,
125*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
126*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
127*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA_W_CONFIG,
128*c2e18aaaSAndroid Build Coastguard Worker)
129*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO2 = test_info.TestInfo(
130*c2e18aaaSAndroid Build Coastguard Worker    MODULE2_NAME,
131*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
132*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS2,
133*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA2,
134*c2e18aaaSAndroid Build Coastguard Worker)
135*c2e18aaaSAndroid Build Coastguard WorkerTEST_CONFIG_MODULE_INFO = test_info.TestInfo(
136*c2e18aaaSAndroid Build Coastguard Worker    MODULE_CONFIG_NAME,
137*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
138*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
139*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA_W_CONFIG,
140*c2e18aaaSAndroid Build Coastguard Worker)
141*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_HOST_1 = test_info.TestInfo(
142*c2e18aaaSAndroid Build Coastguard Worker    HOST_UNIT_TEST_NAME_1,
143*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
144*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
145*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA,
146*c2e18aaaSAndroid Build Coastguard Worker)
147*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_HOST_2 = test_info.TestInfo(
148*c2e18aaaSAndroid Build Coastguard Worker    HOST_UNIT_TEST_NAME_2,
149*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
150*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
151*c2e18aaaSAndroid Build Coastguard Worker    MODULE_DATA,
152*c2e18aaaSAndroid Build Coastguard Worker)
153*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFOS = [MODULE_INFO]
154*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFOS2 = [MODULE_INFO, MODULE_INFO2]
155*c2e18aaaSAndroid Build Coastguard WorkerCLASS_FILTER = test_info.TestFilter(FULL_CLASS_NAME, frozenset())
156*c2e18aaaSAndroid Build Coastguard WorkerCLASS_DATA = {
157*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CONFIG_FILE,
158*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([CLASS_FILTER]),
159*c2e18aaaSAndroid Build Coastguard Worker}
160*c2e18aaaSAndroid Build Coastguard WorkerPACKAGE_FILTER = test_info.TestFilter(PACKAGE, frozenset())
161*c2e18aaaSAndroid Build Coastguard WorkerPACKAGE_DATA = {
162*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CONFIG_FILE,
163*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([PACKAGE_FILTER]),
164*c2e18aaaSAndroid Build Coastguard Worker}
165*c2e18aaaSAndroid Build Coastguard WorkerTEST_DATA_CONFIG = os.path.relpath(
166*c2e18aaaSAndroid Build Coastguard Worker    os.path.join(TEST_DATA_DIR, constants.MODULE_CONFIG), ROOT
167*c2e18aaaSAndroid Build Coastguard Worker)
168*c2e18aaaSAndroid Build Coastguard WorkerPATH_DATA = {
169*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: TEST_DATA_CONFIG,
170*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([PACKAGE_FILTER]),
171*c2e18aaaSAndroid Build Coastguard Worker}
172*c2e18aaaSAndroid Build Coastguard WorkerEMPTY_PATH_DATA = {
173*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: TEST_DATA_CONFIG,
174*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
175*c2e18aaaSAndroid Build Coastguard Worker}
176*c2e18aaaSAndroid Build Coastguard Worker
177*c2e18aaaSAndroid Build Coastguard WorkerCLASS_BUILD_TARGETS = {'class-specific-target'}
178*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INFO = test_info.TestInfo(
179*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
180*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
181*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS,
182*c2e18aaaSAndroid Build Coastguard Worker    CLASS_DATA,
183*c2e18aaaSAndroid Build Coastguard Worker)
184*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INFOS = [CLASS_INFO]
185*c2e18aaaSAndroid Build Coastguard Worker
186*c2e18aaaSAndroid Build Coastguard WorkerCLASS_BUILD_TARGETS2 = {'class-specific-target2'}
187*c2e18aaaSAndroid Build Coastguard WorkerCLASS_DATA2 = {
188*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CONFIG_FILE,
189*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([CLASS_FILTER]),
190*c2e18aaaSAndroid Build Coastguard Worker}
191*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INFO2 = test_info.TestInfo(
192*c2e18aaaSAndroid Build Coastguard Worker    MODULE2_NAME,
193*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
194*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS2,
195*c2e18aaaSAndroid Build Coastguard Worker    CLASS_DATA2,
196*c2e18aaaSAndroid Build Coastguard Worker)
197*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INFOS = [CLASS_INFO]
198*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INFOS2 = [CLASS_INFO, CLASS_INFO2]
199*c2e18aaaSAndroid Build Coastguard WorkerPACKAGE_INFO = test_info.TestInfo(
200*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
201*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
202*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS,
203*c2e18aaaSAndroid Build Coastguard Worker    PACKAGE_DATA,
204*c2e18aaaSAndroid Build Coastguard Worker)
205*c2e18aaaSAndroid Build Coastguard WorkerPATH_INFO = test_info.TestInfo(
206*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
207*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
208*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
209*c2e18aaaSAndroid Build Coastguard Worker    PATH_DATA,
210*c2e18aaaSAndroid Build Coastguard Worker)
211*c2e18aaaSAndroid Build Coastguard WorkerEMPTY_PATH_INFO = test_info.TestInfo(
212*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
213*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
214*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
215*c2e18aaaSAndroid Build Coastguard Worker    EMPTY_PATH_DATA,
216*c2e18aaaSAndroid Build Coastguard Worker)
217*c2e18aaaSAndroid Build Coastguard WorkerMODULE_CLASS_COMBINED_BUILD_TARGETS = MODULE_BUILD_TARGETS | CLASS_BUILD_TARGETS
218*c2e18aaaSAndroid Build Coastguard WorkerINT_CONFIG = os.path.join(INT_DIR, INT_NAME + '.xml')
219*c2e18aaaSAndroid Build Coastguard WorkerGTF_INT_CONFIG = os.path.join(GTF_INT_DIR, GTF_INT_NAME + '.xml')
220*c2e18aaaSAndroid Build Coastguard WorkerMETHOD_NAME = 'method1'
221*c2e18aaaSAndroid Build Coastguard WorkerMETHOD_FILTER = test_info.TestFilter(FULL_CLASS_NAME, frozenset([METHOD_NAME]))
222*c2e18aaaSAndroid Build Coastguard WorkerMETHOD_INFO = test_info.TestInfo(
223*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
224*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
225*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
226*c2e18aaaSAndroid Build Coastguard Worker    data={
227*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([METHOD_FILTER]),
228*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CONFIG_FILE,
229*c2e18aaaSAndroid Build Coastguard Worker    },
230*c2e18aaaSAndroid Build Coastguard Worker)
231*c2e18aaaSAndroid Build Coastguard WorkerMETHOD2_NAME = 'method2'
232*c2e18aaaSAndroid Build Coastguard WorkerFLAT_METHOD_FILTER = test_info.TestFilter(
233*c2e18aaaSAndroid Build Coastguard Worker    FULL_CLASS_NAME, frozenset([METHOD_NAME, METHOD2_NAME])
234*c2e18aaaSAndroid Build Coastguard Worker)
235*c2e18aaaSAndroid Build Coastguard WorkerINT_INFO = test_info.TestInfo(
236*c2e18aaaSAndroid Build Coastguard Worker    INT_NAME,
237*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
238*c2e18aaaSAndroid Build Coastguard Worker    set(),
239*c2e18aaaSAndroid Build Coastguard Worker    data={
240*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: INT_CONFIG,
241*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset(),
242*c2e18aaaSAndroid Build Coastguard Worker    },
243*c2e18aaaSAndroid Build Coastguard Worker)
244*c2e18aaaSAndroid Build Coastguard Worker# Golden sample test filter for method under parameterized java.
245*c2e18aaaSAndroid Build Coastguard WorkerPARAMETERIZED_METHOD_FILTER = test_info.TestFilter(
246*c2e18aaaSAndroid Build Coastguard Worker    FULL_CLASS_NAME, frozenset([METHOD_NAME + '*'])
247*c2e18aaaSAndroid Build Coastguard Worker)
248*c2e18aaaSAndroid Build Coastguard WorkerPARAMETERIZED_METHOD_INFO = test_info.TestInfo(
249*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
250*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
251*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
252*c2e18aaaSAndroid Build Coastguard Worker    data={
253*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([PARAMETERIZED_METHOD_FILTER]),
254*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CONFIG_FILE,
255*c2e18aaaSAndroid Build Coastguard Worker    },
256*c2e18aaaSAndroid Build Coastguard Worker)
257*c2e18aaaSAndroid Build Coastguard WorkerPARAMETERIZED_FLAT_METHOD_FILTER = test_info.TestFilter(
258*c2e18aaaSAndroid Build Coastguard Worker    FULL_CLASS_NAME, frozenset([METHOD_NAME + '*', METHOD2_NAME + '*'])
259*c2e18aaaSAndroid Build Coastguard Worker)
260*c2e18aaaSAndroid Build Coastguard WorkerPARAMETERIZED_FLAT_METHOD_INFO = test_info.TestInfo(
261*c2e18aaaSAndroid Build Coastguard Worker    MODULE_NAME,
262*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
263*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
264*c2e18aaaSAndroid Build Coastguard Worker    data={
265*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([PARAMETERIZED_FLAT_METHOD_FILTER]),
266*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CONFIG_FILE,
267*c2e18aaaSAndroid Build Coastguard Worker    },
268*c2e18aaaSAndroid Build Coastguard Worker)
269*c2e18aaaSAndroid Build Coastguard WorkerGTF_INT_INFO = test_info.TestInfo(
270*c2e18aaaSAndroid Build Coastguard Worker    GTF_INT_NAME,
271*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
272*c2e18aaaSAndroid Build Coastguard Worker    set(),
273*c2e18aaaSAndroid Build Coastguard Worker    data={
274*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset(),
275*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: GTF_INT_CONFIG,
276*c2e18aaaSAndroid Build Coastguard Worker    },
277*c2e18aaaSAndroid Build Coastguard Worker)
278*c2e18aaaSAndroid Build Coastguard Worker
279*c2e18aaaSAndroid Build Coastguard Worker# Sample test configurations in TEST_MAPPING file.
280*c2e18aaaSAndroid Build Coastguard WorkerTEST_MAPPING_TEST = {'name': MODULE_NAME, 'host': True}
281*c2e18aaaSAndroid Build Coastguard WorkerTEST_MAPPING_TEST_WITH_OPTION = {
282*c2e18aaaSAndroid Build Coastguard Worker    'name': CLASS_NAME,
283*c2e18aaaSAndroid Build Coastguard Worker    'options': [{'arg1': 'val1'}, {'arg2': ''}],
284*c2e18aaaSAndroid Build Coastguard Worker}
285*c2e18aaaSAndroid Build Coastguard WorkerTEST_MAPPING_TEST_WITH_OPTION_STR = '%s (arg1: val1, arg2:)' % CLASS_NAME
286*c2e18aaaSAndroid Build Coastguard WorkerTEST_MAPPING_TEST_WITH_BAD_OPTION = {
287*c2e18aaaSAndroid Build Coastguard Worker    'name': CLASS_NAME,
288*c2e18aaaSAndroid Build Coastguard Worker    'options': [{'arg1': 'val1', 'arg2': ''}],
289*c2e18aaaSAndroid Build Coastguard Worker}
290*c2e18aaaSAndroid Build Coastguard WorkerTEST_MAPPING_TEST_WITH_BAD_HOST_VALUE = {'name': CLASS_NAME, 'host': 'true'}
291*c2e18aaaSAndroid Build Coastguard Worker# Constrants of cc test unittest
292*c2e18aaaSAndroid Build Coastguard WorkerFIND_CC_ONE = ROOT + 'foo/bt/hci/test/pf_test.cc\n'
293*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE_NAME = 'net_test_hci'
294*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_NAME = 'PFTest'
295*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE_DIR = 'system/bt/hci'
296*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_FILTER = test_info.TestFilter(CC_CLASS_NAME, frozenset())
297*c2e18aaaSAndroid Build Coastguard WorkerCC_CONFIG_FILE = os.path.join(CC_MODULE_DIR, constants.MODULE_CONFIG)
298*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE_CLASS_DATA = {
299*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CC_CONFIG_FILE,
300*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([CC_CLASS_FILTER]),
301*c2e18aaaSAndroid Build Coastguard Worker}
302*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE_CLASS_INFO = test_info.TestInfo(
303*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
304*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
305*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS,
306*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_CLASS_DATA,
307*c2e18aaaSAndroid Build Coastguard Worker)
308*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE2_DIR = 'foo/bar/hello'
309*c2e18aaaSAndroid Build Coastguard WorkerCC_MODULE2_NAME = 'hello_world_test'
310*c2e18aaaSAndroid Build Coastguard WorkerCC_PATH = 'pf_test.cc'
311*c2e18aaaSAndroid Build Coastguard WorkerCC_FIND_ONE = (
312*c2e18aaaSAndroid Build Coastguard Worker    ROOT
313*c2e18aaaSAndroid Build Coastguard Worker    + 'system/bt/hci/test/pf_test.cc:TEST_F(PFTest, test1) {\n'
314*c2e18aaaSAndroid Build Coastguard Worker    + ROOT
315*c2e18aaaSAndroid Build Coastguard Worker    + 'system/bt/hci/test/pf_test.cc:TEST_F(PFTest, test2) {\n'
316*c2e18aaaSAndroid Build Coastguard Worker)
317*c2e18aaaSAndroid Build Coastguard WorkerCC_FIND_TWO = (
318*c2e18aaaSAndroid Build Coastguard Worker    ROOT
319*c2e18aaaSAndroid Build Coastguard Worker    + 'other/dir/test.cpp:TEST(PFTest, test_f) {\n'
320*c2e18aaaSAndroid Build Coastguard Worker    + ROOT
321*c2e18aaaSAndroid Build Coastguard Worker    + 'other/dir/test.cpp:TEST(PFTest, test_p) {\n'
322*c2e18aaaSAndroid Build Coastguard Worker)
323*c2e18aaaSAndroid Build Coastguard WorkerCC_CONFIG2_FILE = os.path.join(CC_MODULE2_DIR, constants.MODULE_CONFIG)
324*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_FILTER = test_info.TestFilter(CC_CLASS_NAME + '.*', frozenset())
325*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_DATA = {
326*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CC_CONFIG_FILE,
327*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset([CC_CLASS_FILTER]),
328*c2e18aaaSAndroid Build Coastguard Worker}
329*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_INFO = test_info.TestInfo(
330*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
331*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
332*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS,
333*c2e18aaaSAndroid Build Coastguard Worker    CC_CLASS_DATA,
334*c2e18aaaSAndroid Build Coastguard Worker)
335*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD_NAME = 'test1'
336*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD2_NAME = 'test2'
337*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD_FILTER = test_info.TestFilter(
338*c2e18aaaSAndroid Build Coastguard Worker    CC_CLASS_NAME + '.' + CC_METHOD_NAME, frozenset()
339*c2e18aaaSAndroid Build Coastguard Worker)
340*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD2_FILTER = test_info.TestFilter(
341*c2e18aaaSAndroid Build Coastguard Worker    CC_CLASS_NAME
342*c2e18aaaSAndroid Build Coastguard Worker    + '.'
343*c2e18aaaSAndroid Build Coastguard Worker    + CC_METHOD_NAME
344*c2e18aaaSAndroid Build Coastguard Worker    + ':'
345*c2e18aaaSAndroid Build Coastguard Worker    + CC_CLASS_NAME
346*c2e18aaaSAndroid Build Coastguard Worker    + '.'
347*c2e18aaaSAndroid Build Coastguard Worker    + CC_METHOD2_NAME,
348*c2e18aaaSAndroid Build Coastguard Worker    frozenset(),
349*c2e18aaaSAndroid Build Coastguard Worker)
350*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD3_FILTER = test_info.TestFilter(
351*c2e18aaaSAndroid Build Coastguard Worker    CC_CLASS_NAME, frozenset([CC_METHOD_NAME])
352*c2e18aaaSAndroid Build Coastguard Worker)
353*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD_INFO = test_info.TestInfo(
354*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
355*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
356*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
357*c2e18aaaSAndroid Build Coastguard Worker    data={
358*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CC_CONFIG_FILE,
359*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([CC_METHOD_FILTER]),
360*c2e18aaaSAndroid Build Coastguard Worker    },
361*c2e18aaaSAndroid Build Coastguard Worker)
362*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD2_INFO = test_info.TestInfo(
363*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
364*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
365*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
366*c2e18aaaSAndroid Build Coastguard Worker    data={
367*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CC_CONFIG_FILE,
368*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([CC_METHOD2_FILTER]),
369*c2e18aaaSAndroid Build Coastguard Worker    },
370*c2e18aaaSAndroid Build Coastguard Worker)
371*c2e18aaaSAndroid Build Coastguard WorkerCC_METHOD3_INFO = test_info.TestInfo(
372*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
373*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
374*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
375*c2e18aaaSAndroid Build Coastguard Worker    data={
376*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_REL_CONFIG: CC_CONFIG_FILE,
377*c2e18aaaSAndroid Build Coastguard Worker        constants.TI_FILTER: frozenset([CC_METHOD3_FILTER]),
378*c2e18aaaSAndroid Build Coastguard Worker    },
379*c2e18aaaSAndroid Build Coastguard Worker)
380*c2e18aaaSAndroid Build Coastguard WorkerCC_PATH_DATA = {
381*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: TEST_DATA_CONFIG,
382*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
383*c2e18aaaSAndroid Build Coastguard Worker}
384*c2e18aaaSAndroid Build Coastguard WorkerCC_PATH_INFO = test_info.TestInfo(
385*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
386*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
387*c2e18aaaSAndroid Build Coastguard Worker    MODULE_BUILD_TARGETS,
388*c2e18aaaSAndroid Build Coastguard Worker    CC_PATH_DATA,
389*c2e18aaaSAndroid Build Coastguard Worker)
390*c2e18aaaSAndroid Build Coastguard WorkerCC_PATH_DATA2 = {
391*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_REL_CONFIG: CC_CONFIG_FILE,
392*c2e18aaaSAndroid Build Coastguard Worker    constants.TI_FILTER: frozenset(),
393*c2e18aaaSAndroid Build Coastguard Worker}
394*c2e18aaaSAndroid Build Coastguard WorkerCC_PATH_INFO2 = test_info.TestInfo(
395*c2e18aaaSAndroid Build Coastguard Worker    CC_MODULE_NAME,
396*c2e18aaaSAndroid Build Coastguard Worker    atf_tr.AtestTradefedTestRunner.NAME,
397*c2e18aaaSAndroid Build Coastguard Worker    CLASS_BUILD_TARGETS,
398*c2e18aaaSAndroid Build Coastguard Worker    CC_PATH_DATA2,
399*c2e18aaaSAndroid Build Coastguard Worker)
400*c2e18aaaSAndroid Build Coastguard WorkerCTS_INT_DIR = 'test/suite_harness/tools/cts-tradefed/res/config'
401*c2e18aaaSAndroid Build Coastguard Worker# Constrants of java, kt, cc, cpp test_find_class_file() unittest
402*c2e18aaaSAndroid Build Coastguard WorkerFIND_PATH_TESTCASE_JAVA = 'hello_world_test'
403*c2e18aaaSAndroid Build Coastguard WorkerFIND_PATH_FILENAME_CC = 'hello_world_test'
404*c2e18aaaSAndroid Build Coastguard WorkerFIND_PATH_TESTCASE_CC = 'HelloWorldTest'
405*c2e18aaaSAndroid Build Coastguard WorkerFIND_PATH_FOLDER = 'class_file_path_testing'
406*c2e18aaaSAndroid Build Coastguard WorkerFIND_PATH = os.path.join(TEST_DATA_DIR, FIND_PATH_FOLDER)
407*c2e18aaaSAndroid Build Coastguard Worker
408*c2e18aaaSAndroid Build Coastguard WorkerDEFAULT_INSTALL_PATH = ['/path/to/install']
409*c2e18aaaSAndroid Build Coastguard Worker# Module names
410*c2e18aaaSAndroid Build Coastguard WorkerMOD1 = 'mod1'
411*c2e18aaaSAndroid Build Coastguard WorkerMOD2 = 'mod2'
412*c2e18aaaSAndroid Build Coastguard WorkerMOD3 = 'mod3'
413*c2e18aaaSAndroid Build Coastguard WorkerFUZZY_MOD1 = 'Mod1'
414*c2e18aaaSAndroid Build Coastguard WorkerFUZZY_MOD2 = 'nod2'
415*c2e18aaaSAndroid Build Coastguard WorkerFUZZY_MOD3 = 'mod3mod3'
416*c2e18aaaSAndroid Build Coastguard Worker
417*c2e18aaaSAndroid Build Coastguard WorkerINDEX_DIR = os.path.join('/tmp', 'indices')
418*c2e18aaaSAndroid Build Coastguard WorkerLOCATE_CACHE = os.path.join(INDEX_DIR, 'plocate.db')
419*c2e18aaaSAndroid Build Coastguard WorkerLOCATE_CACHE_MD5 = os.path.join(INDEX_DIR, 'plocate.md5')
420*c2e18aaaSAndroid Build Coastguard WorkerCLASS_INDEX = os.path.join(INDEX_DIR, 'classes.idx')
421*c2e18aaaSAndroid Build Coastguard WorkerQCLASS_INDEX = os.path.join(INDEX_DIR, 'fqcn.idx')
422*c2e18aaaSAndroid Build Coastguard WorkerCC_CLASS_INDEX = os.path.join(INDEX_DIR, 'cc_classes.idx')
423*c2e18aaaSAndroid Build Coastguard WorkerPACKAGE_INDEX = os.path.join(INDEX_DIR, 'packages.idx')
424*c2e18aaaSAndroid Build Coastguard WorkerMODULE_INFO_MD5 = os.path.join(INDEX_DIR, 'module-info.md5')
425*c2e18aaaSAndroid Build Coastguard Worker
426*c2e18aaaSAndroid Build Coastguard Worker# TF's log dir
427*c2e18aaaSAndroid Build Coastguard WorkerTEST_INFO_DIR = '/tmp/atest_run_1510085893_pi_Nbi'
428*c2e18aaaSAndroid Build Coastguard Worker
429*c2e18aaaSAndroid Build Coastguard Worker# Constants for get_test_config unit tests.
430*c2e18aaaSAndroid Build Coastguard WorkerANDTEST_CONFIG_PATH = 'my/android/config/path'
431*c2e18aaaSAndroid Build Coastguard WorkerSINGLE_CONFIG_PATH = 'my/single/config/path'
432*c2e18aaaSAndroid Build Coastguard WorkerMULTIPLE_CONFIG_PATH = 'my/multiple/config/path'
433*c2e18aaaSAndroid Build Coastguard WorkerMAIN_CONFIG_NAME = 'main_test_config.xml'
434*c2e18aaaSAndroid Build Coastguard WorkerSINGLE_CONFIG_NAME = 'test_config.xml'
435*c2e18aaaSAndroid Build Coastguard WorkerSUB_CONFIG_NAME_2 = 'Multiple2.xml'
436