blob: c07e1150d7e02c1281677103fd18ab5db59ad491 [file] [log] [blame]
Phil Dubachec19a572009-08-21 15:20:13 -07001#!/usr/bin/python
Phil Dubach0d6ef062009-08-12 18:13:16 -07002
3# Copyright (C) 2009 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17"""Module for generating CTS test descriptions and test plans."""
18
19import glob
20import os
21import re
Unsuk Jung2a692d12013-09-29 20:57:32 -070022import shutil
Kalle Raita30e3acc2015-11-25 10:46:01 -080023import string
Phil Dubach0d6ef062009-08-12 18:13:16 -070024import subprocess
25import sys
26import xml.dom.minidom as dom
27from cts import tools
Brian Muramatsu9157e0a2011-04-05 18:06:15 -070028from multiprocessing import Pool
Phil Dubach0d6ef062009-08-12 18:13:16 -070029
30def GetSubDirectories(root):
31 """Return all directories under the given root directory."""
32 return [x for x in os.listdir(root) if os.path.isdir(os.path.join(root, x))]
33
Jarkko Pöyry1ab85bf2015-04-24 14:43:42 -070034def ReadFileLines(filePath):
35 """Reads a file and returns its contents as a line list."""
36 f = open(filePath, 'r');
37 lines = [line.strip() for line in f.readlines()]
38 f.close()
39 return lines
Phil Dubach0d6ef062009-08-12 18:13:16 -070040
Kalle Raita30e3acc2015-11-25 10:46:01 -080041def ReadDeqpTestList(testRoot, file):
42 """Reads a file, converts test names from deqp to CTS format, and returns
43 its contents as a line list.
44 """
45 REPO_ROOT = os.path.join(testRoot, "../../..")
46 f = open(os.path.join(REPO_ROOT, "external/deqp/android/cts", file), 'r');
47 lines = [string.join(line.strip().rsplit('.',1),'#') for line in f.readlines()]
48 f.close()
49 return lines
50
Phil Dubach0d6ef062009-08-12 18:13:16 -070051def GetMakeFileVars(makefile_path):
52 """Extracts variable definitions from the given make file.
53
54 Args:
55 makefile_path: Path to the make file.
56
57 Returns:
58 A dictionary mapping variable names to their assigned value.
59 """
60 result = {}
61 pattern = re.compile(r'^\s*([^:#=\s]+)\s*:=\s*(.*?[^\\])$', re.MULTILINE + re.DOTALL)
62 stream = open(makefile_path, 'r')
63 content = stream.read()
64 for match in pattern.finditer(content):
65 result[match.group(1)] = match.group(2)
66 stream.close()
67 return result
68
69
70class CtsBuilder(object):
71 """Main class for generating test descriptions and test plans."""
72
73 def __init__(self, argv):
74 """Initialize the CtsBuilder from command line arguments."""
Keun young Parkd93d0d12013-01-10 14:11:35 -080075 if len(argv) != 6:
76 print 'Usage: %s <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath>' % argv[0]
Phil Dubach0d6ef062009-08-12 18:13:16 -070077 print ''
78 print 'testRoot: Directory under which to search for CTS tests.'
79 print 'ctsOutputDir: Directory in which the CTS repository should be created.'
80 print 'tempDir: Directory to use for storing temporary files.'
81 print 'androidRootDir: Root directory of the Android source tree.'
82 print 'docletPath: Class path where the DescriptionGenerator doclet can be found.'
83 sys.exit(1)
84 self.test_root = sys.argv[1]
85 self.out_dir = sys.argv[2]
86 self.temp_dir = sys.argv[3]
87 self.android_root = sys.argv[4]
88 self.doclet_path = sys.argv[5]
89
90 self.test_repository = os.path.join(self.out_dir, 'repository/testcases')
91 self.plan_repository = os.path.join(self.out_dir, 'repository/plans')
Unsuk Jung08d97f92013-09-29 22:40:22 -070092 self.definedplans_repository = os.path.join(self.android_root, 'cts/tests/plans')
Phil Dubach0d6ef062009-08-12 18:13:16 -070093
Phil Dubach0d6ef062009-08-12 18:13:16 -070094 def GenerateTestDescriptions(self):
95 """Generate test descriptions for all packages."""
Brian Muramatsu5df641c2011-12-28 15:46:57 -080096 pool = Pool(processes=2)
Brian Muramatsu9157e0a2011-04-05 18:06:15 -070097
Phil Dubach0d6ef062009-08-12 18:13:16 -070098 # generate test descriptions for android tests
Brian Muramatsubdcfc7c2011-12-01 14:32:02 -080099 results = []
Brian Muramatsu9157e0a2011-04-05 18:06:15 -0700100 pool.close()
101 pool.join()
Brian Muramatsubdcfc7c2011-12-01 14:32:02 -0800102 return sum(map(lambda result: result.get(), results))
Phil Dubach0d6ef062009-08-12 18:13:16 -0700103
104 def __WritePlan(self, plan, plan_name):
105 print 'Generating test plan %s' % plan_name
106 plan.Write(os.path.join(self.plan_repository, plan_name + '.xml'))
107
108 def GenerateTestPlans(self):
109 """Generate default test plans."""
110 # TODO: Instead of hard-coding the plans here, use a configuration file,
111 # such as test_defs.xml
112 packages = []
Phil Dubach8dcedfe2009-08-20 16:10:39 -0700113 descriptions = sorted(glob.glob(os.path.join(self.test_repository, '*.xml')))
Phil Dubach0d6ef062009-08-12 18:13:16 -0700114 for description in descriptions:
115 doc = tools.XmlFile(description)
116 packages.append(doc.GetAttr('TestPackage', 'appPackageName'))
Keun young Park965d1912013-02-08 11:37:16 -0800117 # sort the list to give the same sequence based on name
118 packages.sort()
Phil Dubach0d6ef062009-08-12 18:13:16 -0700119
120 plan = tools.TestPlan(packages)
Guang Zhu2d8a2702016-03-19 19:53:43 -0700121 plan.Exclude('android\.car')
Tsu Chiang Chuangd4cce3b2011-05-12 12:19:54 -0700122 plan.Exclude('android\.performance.*')
Brian Muramatsu87ff4df2011-12-16 11:41:17 -0800123 self.__WritePlan(plan, 'CTS')
Brian Muramatsu89ae08c2012-01-03 10:55:02 -0800124 self.__WritePlan(plan, 'CTS-TF')
Tsu Chiang Chuangd4cce3b2011-05-12 12:19:54 -0700125
Keun young Parkd93d0d12013-01-10 14:11:35 -0800126 plan = tools.TestPlan(packages)
Guang Zhu2d8a2702016-03-19 19:53:43 -0700127 plan.Exclude('android\.car')
Keun young Parkd93d0d12013-01-10 14:11:35 -0800128 plan.Exclude('android\.performance.*')
Guru Nagarajan55f10db2013-06-03 13:50:37 -0700129 plan.Exclude('android\.media\.cts\.StreamingMediaPlayerTest.*')
130 # Test plan to not include media streaming tests
131 self.__WritePlan(plan, 'CTS-No-Media-Stream')
132
133 plan = tools.TestPlan(packages)
Guang Zhu2d8a2702016-03-19 19:53:43 -0700134 plan.Exclude('android\.car')
Guru Nagarajan55f10db2013-06-03 13:50:37 -0700135 plan.Exclude('android\.performance.*')
Keun young Parkd93d0d12013-01-10 14:11:35 -0800136 self.__WritePlan(plan, 'SDK')
137
Stuart Scottf67280f2014-09-30 14:07:30 -0700138 plan.Exclude(r'android\.signature')
Phil Dubach0d6ef062009-08-12 18:13:16 -0700139 plan.Exclude(r'android\.core.*')
140 self.__WritePlan(plan, 'Android')
141
142 plan = tools.TestPlan(packages)
143 plan.Include(r'android\.core\.tests.*')
Stuart Scottd17e97a2015-09-29 12:36:55 -0700144 plan.Exclude(r'android\.core\.tests\.libcore\.package\.harmony*')
Phil Dubach0d6ef062009-08-12 18:13:16 -0700145 self.__WritePlan(plan, 'Java')
146
Tsu Chiang Chuangcf7ceab2012-10-24 16:48:03 -0700147 # TODO: remove this once the tests are fixed and merged into Java plan above.
148 plan = tools.TestPlan(packages)
Stuart Scottd17e97a2015-09-29 12:36:55 -0700149 plan.Include(r'android\.core\.tests\.libcore\.package\.harmony*')
Tsu Chiang Chuangcf7ceab2012-10-24 16:48:03 -0700150 self.__WritePlan(plan, 'Harmony')
151
Phil Dubach0d6ef062009-08-12 18:13:16 -0700152 plan = tools.TestPlan(packages)
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700153 plan.Include(r'android\.core\.vm-tests-tf')
154 self.__WritePlan(plan, 'VM-TF')
155
156 plan = tools.TestPlan(packages)
Phil Dubach60680482009-08-19 10:13:23 -0700157 plan.Include(r'android\.tests\.appsecurity')
158 self.__WritePlan(plan, 'AppSecurity')
159
Keun young Parkff194172012-08-14 17:56:11 -0700160 # hard-coded white list for PDK plan
161 plan.Exclude('.*')
keunyoungc767cba2013-04-03 14:50:58 -0700162 plan.Include('android\.aadb')
Keun young Parkff194172012-08-14 17:56:11 -0700163 plan.Include('android\.bluetooth')
164 plan.Include('android\.graphics.*')
165 plan.Include('android\.hardware')
keunyoungde519462013-03-21 12:06:42 -0700166 plan.Include('android\.media')
167 plan.Exclude('android\.mediastress')
Keun young Parkff194172012-08-14 17:56:11 -0700168 plan.Include('android\.net')
169 plan.Include('android\.opengl.*')
170 plan.Include('android\.renderscript')
171 plan.Include('android\.telephony')
172 plan.Include('android\.nativemedia.*')
Stuart Scotta132af62013-11-07 10:30:32 -0800173 plan.Include('com\.android\.cts\..*')#TODO(stuartscott): Should PDK have all these?
Guang Zhu2d8a2702016-03-19 19:53:43 -0700174 plan.Exclude('android\.car')
Keun young Parkff194172012-08-14 17:56:11 -0700175 self.__WritePlan(plan, 'PDK')
176
Nicholas Sauer72632f92015-05-04 14:45:50 -0700177 temporarily_known_failure_tests = BuildCtsTemporarilyKnownFailureList();
Nicholas Sauer471c6012014-05-28 15:28:28 -0700178 flaky_tests = BuildCtsFlakyTestList()
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700179 releasekey_tests = BuildListForReleaseBuildTest()
Nicholas Sauer471c6012014-05-28 15:28:28 -0700180
181 # CTS Stable plan
182 plan = tools.TestPlan(packages)
Guang Zhu2d8a2702016-03-19 19:53:43 -0700183 plan.Exclude('android\.car')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700184 plan.Exclude(r'android\.browser')
Nicholas Sauer471c6012014-05-28 15:28:28 -0700185 for package, test_list in flaky_tests.iteritems():
186 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700187 for package, test_list in releasekey_tests.iteritems():
188 plan.ExcludeTests(package, test_list)
Nicholas Sauer471c6012014-05-28 15:28:28 -0700189 self.__WritePlan(plan, 'CTS-stable')
190
Unsuk Jung8398ab82014-09-19 03:26:39 -0700191 # CTS Flaky plan - list of tests known to be flaky in lab environment
Nicholas Sauer471c6012014-05-28 15:28:28 -0700192 plan = tools.TestPlan(packages)
193 plan.Exclude('.*')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700194 plan.Include(r'android\.browser')
Nicholas Sauer471c6012014-05-28 15:28:28 -0700195 for package, test_list in flaky_tests.iteritems():
Unsuk Jungb5153c42014-09-19 02:12:50 -0700196 plan.Include(package+'$')
Nicholas Sauer471c6012014-05-28 15:28:28 -0700197 plan.IncludeTests(package, test_list)
198 self.__WritePlan(plan, 'CTS-flaky')
199
Unsuk Jung8398ab82014-09-19 03:26:39 -0700200 small_tests = BuildAospSmallSizeTestList()
201 medium_tests = BuildAospMediumSizeTestList()
Guang Zhu80f667f2015-01-15 16:40:46 -0800202 new_test_packages = BuildCtsVettedNewPackagesList()
Unsuk Jung8398ab82014-09-19 03:26:39 -0700203
204 # CTS - sub plan for public, small size tests
205 plan = tools.TestPlan(packages)
206 plan.Exclude('.*')
207 for package, test_list in small_tests.iteritems():
208 plan.Include(package+'$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700209 plan.Exclude(r'android\.browser')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700210 for package, test_list in flaky_tests.iteritems():
211 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700212 for package, test_list in releasekey_tests.iteritems():
213 plan.ExcludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700214 self.__WritePlan(plan, 'CTS-kitkat-small')
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700215 self.__WritePlan(plan, 'CTS-public-small')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700216
217 # CTS - sub plan for public, medium size tests
218 plan = tools.TestPlan(packages)
219 plan.Exclude('.*')
220 for package, test_list in medium_tests.iteritems():
221 plan.Include(package+'$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700222 plan.Exclude(r'android\.browser')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700223 for package, test_list in flaky_tests.iteritems():
224 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700225 for package, test_list in releasekey_tests.iteritems():
226 plan.ExcludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700227 self.__WritePlan(plan, 'CTS-kitkat-medium')
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700228 self.__WritePlan(plan, 'CTS-public-medium')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700229
230 # CTS - sub plan for hardware tests which is public, large
231 plan = tools.TestPlan(packages)
232 plan.Exclude('.*')
233 plan.Include(r'android\.hardware$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700234 plan.Exclude(r'android\.browser')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700235 for package, test_list in flaky_tests.iteritems():
236 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700237 for package, test_list in releasekey_tests.iteritems():
238 plan.ExcludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700239 self.__WritePlan(plan, 'CTS-hardware')
240
Yin-Chia Yeh96f4d402015-10-29 17:53:39 -0700241 # CTS - sub plan for camera tests which is public, large
242 plan = tools.TestPlan(packages)
243 plan.Exclude('.*')
244 plan.Include(r'android\.camera$')
245 misc_camera_tests = BuildCtsMiscCameraList()
246 for package, test_list in misc_camera_tests.iteritems():
247 plan.Include(package+'$')
248 plan.IncludeTests(package, test_list)
249 for package, test_list in flaky_tests.iteritems():
250 plan.ExcludeTests(package, test_list)
251 for package, test_list in releasekey_tests.iteritems():
252 plan.ExcludeTests(package, test_list)
253 self.__WritePlan(plan, 'CTS-camera')
254
Unsuk Jung8398ab82014-09-19 03:26:39 -0700255 # CTS - sub plan for media tests which is public, large
256 plan = tools.TestPlan(packages)
257 plan.Exclude('.*')
258 plan.Include(r'android\.media$')
Unsuk Jungfd4955a2014-10-21 18:11:48 -0700259 plan.Include(r'android\.view$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700260 plan.Exclude(r'android\.browser')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700261 for package, test_list in flaky_tests.iteritems():
262 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700263 for package, test_list in releasekey_tests.iteritems():
264 plan.ExcludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700265 self.__WritePlan(plan, 'CTS-media')
266
267 # CTS - sub plan for mediastress tests which is public, large
268 plan = tools.TestPlan(packages)
269 plan.Exclude('.*')
270 plan.Include(r'android\.mediastress$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700271 plan.Exclude(r'android\.browser')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700272 for package, test_list in flaky_tests.iteritems():
273 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700274 for package, test_list in releasekey_tests.iteritems():
275 plan.ExcludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700276 self.__WritePlan(plan, 'CTS-mediastress')
277
Guang Zhu80f667f2015-01-15 16:40:46 -0800278 # CTS - sub plan for new tests that is vetted for L launch
279 plan = tools.TestPlan(packages)
280 plan.Exclude('.*')
281 for package, test_list in new_test_packages.iteritems():
282 plan.Include(package+'$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700283 plan.Exclude(r'android\.browser')
Guang Zhu80f667f2015-01-15 16:40:46 -0800284 for package, test_list in flaky_tests.iteritems():
285 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700286 for package, test_list in releasekey_tests.iteritems():
287 plan.ExcludeTests(package, test_list)
Guang Zhu80f667f2015-01-15 16:40:46 -0800288 self.__WritePlan(plan, 'CTS-l-tests')
289
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700290 # CTS - sub plan for tests in drawelement packages
291 plan = tools.TestPlan(packages)
292 plan.Exclude('.*')
293 plan.Include(r'com\.drawelements\.')
Kalle Raita30e3acc2015-11-25 10:46:01 -0800294 plan.IncludeTests('com.drawelements.deqp.egl', ReadDeqpTestList(self.test_root, 'mnc/egl-master.txt'))
295 plan.IncludeTests('com.drawelements.deqp.gles2', ReadDeqpTestList(self.test_root, 'mnc/gles2-master.txt'))
296 plan.IncludeTests('com.drawelements.deqp.gles3', ReadDeqpTestList(self.test_root, 'mnc/gles3-master.txt'))
297 plan.IncludeTests('com.drawelements.deqp.gles31', ReadDeqpTestList(self.test_root, 'mnc/gles31-master.txt'))
Pyry Haulose793db12015-07-27 11:09:55 -0700298 self.__WritePlan(plan, 'CTS-DEQP')
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700299
Kalle Raita30e3acc2015-11-25 10:46:01 -0800300 plan = tools.TestPlan(packages)
301 plan.Exclude('.*')
302 plan.Include(r'com\.drawelements\.')
303 plan.ExcludeTests('com.drawelements.deqp.egl', ReadDeqpTestList(self.test_root, 'mnc/egl-master.txt'))
304 plan.ExcludeTests('com.drawelements.deqp.gles2', ReadDeqpTestList(self.test_root, 'mnc/gles2-master.txt'))
305 plan.ExcludeTests('com.drawelements.deqp.gles3', ReadDeqpTestList(self.test_root, 'mnc/gles3-master.txt'))
306 plan.ExcludeTests('com.drawelements.deqp.gles31', ReadDeqpTestList(self.test_root, 'mnc/gles31-master.txt'))
307 self.__WritePlan(plan, 'CTS-DEQP-for-next-rel')
308
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700309 # CTS - sub plan for new test packages added for staging
Unsuk Jung8398ab82014-09-19 03:26:39 -0700310 plan = tools.TestPlan(packages)
311 for package, test_list in small_tests.iteritems():
312 plan.Exclude(package+'$')
313 for package, test_list in medium_tests.iteritems():
314 plan.Exclude(package+'$')
Guang Zhu80f667f2015-01-15 16:40:46 -0800315 for package, tests_list in new_test_packages.iteritems():
316 plan.Exclude(package+'$')
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700317 plan.Exclude(r'com\.drawelements\.')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700318 plan.Exclude(r'android\.hardware$')
319 plan.Exclude(r'android\.media$')
Unsuk Jungfd4955a2014-10-21 18:11:48 -0700320 plan.Exclude(r'android\.view$')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700321 plan.Exclude(r'android\.mediastress$')
Stuart Scott2c993ed2015-09-14 13:58:31 -0700322 plan.Exclude(r'android\.browser')
Guang Zhu2d8a2702016-03-19 19:53:43 -0700323 plan.Exclude('android\.car')
Unsuk Jung8398ab82014-09-19 03:26:39 -0700324 for package, test_list in flaky_tests.iteritems():
325 plan.ExcludeTests(package, test_list)
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700326 for package, test_list in releasekey_tests.iteritems():
327 plan.ExcludeTests(package, test_list)
Unsuk Jung0a99c972015-09-02 15:28:15 -0700328 self.__WritePlan(plan, 'CTS-m-tests')
329
330
331 # CTS - sub plan for new test packages added for staging
332 plan = tools.TestPlan(packages)
333 plan.Exclude('.*')
334 for package, test_list in temporarily_known_failure_tests.iteritems():
335 plan.Include(package+'$')
336 plan.IncludeTests(package, test_list)
Unsuk Jung8398ab82014-09-19 03:26:39 -0700337 self.__WritePlan(plan, 'CTS-staging')
338
Guang Zhu80f667f2015-01-15 16:40:46 -0800339 plan = tools.TestPlan(packages)
340 plan.Exclude('.*')
Guang Zhu80f667f2015-01-15 16:40:46 -0800341 self.__WritePlan(plan, 'CTS-webview')
342
Daniel Xie8a532e52015-12-30 11:25:25 -0800343 # CTS - sub plan for Security
344 plan = tools.TestPlan(packages)
345 plan.Exclude('.*')
346 plan.Include(r'android\.security$')
347 plan.Include('android\.host\.jdwpsecurity$')
Selim Gurun364fd162016-02-19 17:41:52 -0800348 plan.Include('android\.host\.abioverride$')
Daniel Xie8a532e52015-12-30 11:25:25 -0800349 self.__WritePlan(plan, 'Security')
Guang Zhu80f667f2015-01-15 16:40:46 -0800350
Unsuk Jung8398ab82014-09-19 03:26:39 -0700351def BuildAospMediumSizeTestList():
352 """ Construct a defaultdic that lists package names of medium tests
353 already published to aosp. """
354 return {
355 'android.app' : [],
356 'android.core.tests.libcore.package.libcore' : [],
357 'android.core.tests.libcore.package.org' : [],
358 'android.core.vm-tests-tf' : [],
359 'android.dpi' : [],
360 'android.host.security' : [],
361 'android.net' : [],
362 'android.os' : [],
Unsuk Jung2e4e9292014-10-09 02:20:44 -0700363 'android.permission2' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700364 'android.security' : [],
365 'android.telephony' : [],
366 'android.webkit' : [],
367 'android.widget' : [],
Stuart Scott2c993ed2015-09-14 13:58:31 -0700368 'android.browser' : []}
Unsuk Jung8398ab82014-09-19 03:26:39 -0700369
370def BuildAospSmallSizeTestList():
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700371 """ Construct a default dict that lists packages names of small tests
Unsuk Jung8398ab82014-09-19 03:26:39 -0700372 already published to aosp. """
373 return {
374 'android.aadb' : [],
375 'android.acceleration' : [],
376 'android.accessibility' : [],
377 'android.accessibilityservice' : [],
378 'android.accounts' : [],
379 'android.admin' : [],
380 'android.animation' : [],
Aaron Holdenc7f3b252015-10-20 11:48:37 -0700381 'android.appsecurity' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700382 'android.bionic' : [],
383 'android.bluetooth' : [],
384 'android.calendarcommon' : [],
385 'android.content' : [],
386 'android.core.tests.libcore.package.com' : [],
387 'android.core.tests.libcore.package.conscrypt' : [],
388 'android.core.tests.libcore.package.dalvik' : [],
389 'android.core.tests.libcore.package.sun' : [],
390 'android.core.tests.libcore.package.tests' : [],
391 'android.database' : [],
Stuart Scott5d509992015-09-15 10:56:10 -0700392 'android.dram' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700393 'android.dreams' : [],
394 'android.drm' : [],
395 'android.effect' : [],
Stuart Scotte4036fe2015-09-15 11:36:43 -0700396 'android.filesystem' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700397 'android.gesture' : [],
398 'android.graphics' : [],
399 'android.graphics2' : [],
400 'android.jni' : [],
401 'android.keystore' : [],
402 'android.location' : [],
403 'android.nativemedia.sl' : [],
404 'android.nativemedia.xa' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700405 'android.ndef' : [],
406 'android.opengl' : [],
407 'android.openglperf' : [],
408 'android.permission' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700409 'android.preference' : [],
410 'android.preference2' : [],
411 'android.provider' : [],
412 'android.renderscript' : [],
413 'android.rscpp' : [],
414 'android.rsg' : [],
415 'android.sax' : [],
Stuart Scottd2624e92016-01-06 14:20:03 -0800416 'android.server' : [],
Stuart Scottf67280f2014-09-30 14:07:30 -0700417 'android.signature' : [],
Aaron Holdenecda1b32015-10-15 12:23:21 -0700418 'android.simplecpu' : [],
Yabin Cui33a07622016-03-02 14:02:34 -0800419 'android.simpleperf' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700420 'android.speech' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700421 'android.text' : [],
422 'android.textureview' : [],
423 'android.theme' : [],
424 'android.usb' : [],
425 'android.util' : [],
Aaron Holden24fd5782015-10-15 16:30:44 -0700426 'android.video' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700427 'com.android.cts.jank' : [],
Guang Zhucf5c2542015-03-09 23:13:27 -0700428 'com.android.cts.jank2' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700429 'com.android.cts.opengl' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700430 'com.android.cts.ui' : [],
431 'com.android.cts.uihost' : [],
Unsuk Jung8398ab82014-09-19 03:26:39 -0700432 'zzz.android.monkey' : []}
Nicholas Sauer471c6012014-05-28 15:28:28 -0700433
Guang Zhu80f667f2015-01-15 16:40:46 -0800434def BuildCtsVettedNewPackagesList():
435 """ Construct a defaultdict that maps package names that is vetted for L. """
436 return {
437 'android.JobScheduler' : [],
438 'android.core.tests.libcore.package.harmony_annotation' : [],
439 'android.core.tests.libcore.package.harmony_beans' : [],
440 'android.core.tests.libcore.package.harmony_java_io' : [],
441 'android.core.tests.libcore.package.harmony_java_lang' : [],
442 'android.core.tests.libcore.package.harmony_java_math' : [],
443 'android.core.tests.libcore.package.harmony_java_net' : [],
444 'android.core.tests.libcore.package.harmony_java_nio' : [],
445 'android.core.tests.libcore.package.harmony_java_util' : [],
446 'android.core.tests.libcore.package.harmony_java_text' : [],
447 'android.core.tests.libcore.package.harmony_javax_security' : [],
448 'android.core.tests.libcore.package.harmony_logging' : [],
449 'android.core.tests.libcore.package.harmony_prefs' : [],
450 'android.core.tests.libcore.package.harmony_sql' : [],
451 'android.core.tests.libcore.package.jsr166' : [],
452 'android.core.tests.libcore.package.okhttp' : [],
453 'android.display' : [],
454 'android.host.theme' : [],
455 'android.jdwp' : [],
456 'android.location2' : [],
457 'android.print' : [],
458 'android.renderscriptlegacy' : [],
459 'android.signature' : [],
460 'android.tv' : [],
461 'android.uiautomation' : [],
Bo Liuc30bdbc2015-05-18 14:15:15 -0700462 'android.uirendering' : []}
Guang Zhu80f667f2015-01-15 16:40:46 -0800463
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700464def BuildListForReleaseBuildTest():
Nicholas Sauer471c6012014-05-28 15:28:28 -0700465 """ Construct a defaultdict that maps package name to a list of tests
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700466 that are expected to pass only when running against a user/release-key build. """
Nicholas Sauer471c6012014-05-28 15:28:28 -0700467 return {
468 'android.app' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700469 'android.app.cts.ActivityManagerTest#testIsRunningInTestHarness',],
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700470 'android.dpi' : [
471 'android.dpi.cts.DefaultManifestAttributesSdkTest#testPackageHasExpectedSdkVersion',],
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700472 'android.host.security' : [
473 'android.cts.security.SELinuxHostTest#testAllEnforcing',
474 'android.cts.security.SELinuxHostTest#testSuDomain',],
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700475 'android.os' : [
476 'android.os.cts.BuildVersionTest#testReleaseVersion',
477 'android.os.cts.BuildTest#testIsSecureUserBuild',],
478 'android.security' : [
479 'android.security.cts.BannedFilesTest#testNoSu',
480 'android.security.cts.BannedFilesTest#testNoSuInPath',
481 'android.security.cts.PackageSignatureTest#testPackageSignatures',
482 'android.security.cts.SELinuxDomainTest#testSuDomain',],
483 '' : []}
484
485def BuildCtsFlakyTestList():
486 """ Construct a defaultdict that maps package name to a list of tests
487 that flaky during dev cycle and cause other subsequent tests to fail. """
488 return {
Yin-Chia Yeh96f4d402015-10-29 17:53:39 -0700489 'android.camera' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700490 'android.hardware.cts.CameraTest#testVideoSnapshot',
491 'android.hardware.cts.CameraGLTest#testCameraToSurfaceTextureMetadata',
492 'android.hardware.cts.CameraGLTest#testSetPreviewTextureBothCallbacks',
493 'android.hardware.cts.CameraGLTest#testSetPreviewTexturePreviewCallback',],
Nicholas Sauer471c6012014-05-28 15:28:28 -0700494 'android.media' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700495 'android.media.cts.DecoderTest#testCodecResetsH264WithSurface',
496 'android.media.cts.StreamingMediaPlayerTest#testHLS',],
Nicholas Sauer471c6012014-05-28 15:28:28 -0700497 'android.net' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700498 'android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature_enableHipri',
499 'android.net.cts.DnsTest#testDnsWorks',
500 'android.net.cts.SSLCertificateSocketFactoryTest#testCreateSocket',
501 'android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_bind',
502 'android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_simple',
503 'android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_wrapping',
504 'android.net.cts.TrafficStatsTest#testTrafficStatsForLocalhost',
505 'android.net.wifi.cts.NsdManagerTest#testAndroidTestCaseSetupProperly',],
Nicholas Sauer471c6012014-05-28 15:28:28 -0700506 'android.security' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700507 'android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdp6Ports',
Unsuk Jung1345d3d2015-04-24 12:14:59 -0700508 'android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts',],
Nicholas Sauer471c6012014-05-28 15:28:28 -0700509 'android.webkit' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700510 'android.webkit.cts.WebViewClientTest#testOnUnhandledKeyEvent',],
Guang Zhu80f667f2015-01-15 16:40:46 -0800511 'com.android.cts.filesystemperf' : [
Nicholas Sauer42b1b612015-04-24 15:58:47 -0700512 'com.android.cts.filesystemperf.RandomRWTest#testRandomRead',
513 'com.android.cts.filesystemperf.RandomRWTest#testRandomUpdate',],
Guang Zhu80f667f2015-01-15 16:40:46 -0800514 '' : []}
Unsuk Jung2a692d12013-09-29 20:57:32 -0700515
Nicholas Sauer72632f92015-05-04 14:45:50 -0700516def BuildCtsTemporarilyKnownFailureList():
517 """ Construct a defaultdict that maps package name to a list of tests
518 that are known failures during dev cycle but expected to be fixed before launch """
519 return {
Unsuk Jung0a99c972015-09-02 15:28:15 -0700520 'android.alarmclock' : [
521 'android.alarmclock.cts.DismissAlarmTest#testAll',
522 'android.alarmclock.cts.SetAlarmTest#testAll',
523 'android.alarmclock.cts.SnoozeAlarmTest#testAll',
524 ],
Unsuk Jung0a99c972015-09-02 15:28:15 -0700525 'android.dumpsys' : [
526 'android.dumpsys.cts.DumpsysHostTest#testBatterystatsOutput',
527 'android.dumpsys.cts.DumpsysHostTest#testGfxinfoFramestats',
528 ],
529 'android.telecom' : [
530 'android.telecom.cts.ExtendedInCallServiceTest#testAddNewOutgoingCallAndThenDisconnect',
531 'android.telecom.cts.RemoteConferenceTest#testRemoteConferenceCallbacks_ConferenceableConnections',
532 ],
533 'android.transition' : [
534 'android.transition.cts.ChangeScrollTest#testChangeScroll',
535 ],
536 'android.voicesettings' : [
537 'android.voicesettings.cts.ZenModeTest#testAll',
538 ],
Aaron Holdenea930f82015-09-21 10:35:42 -0700539 'android.systemui.cts' : [
540 'android.systemui.cts.LightStatusBarTests#testLightStatusBarIcons',
Adrian Roosd052b582015-08-27 19:06:39 -0700541 ],
Unsuk Jung0a99c972015-09-02 15:28:15 -0700542 'com.android.cts.app.os' : [
543 'com.android.cts.app.os.OsHostTests#testNonExportedActivities',
544 ],
Alex Chau8b5df142015-08-10 18:11:02 +0100545 'com.android.cts.devicepolicy' : [
546 'com.android.cts.devicepolicy.MixedDeviceOwnerTest#testPackageInstallUserRestrictions',
547 'com.android.cts.devicepolicy.MixedProfileOwnerTest#testPackageInstallUserRestrictions',
548 ],
Nicholas Sauer72632f92015-05-04 14:45:50 -0700549 '' : []}
550
Yin-Chia Yeh96f4d402015-10-29 17:53:39 -0700551def BuildCtsMiscCameraList():
552 """ Construct a defaultdict that maps package name to a list of tests
553 that are relevant to camera but does not reside in camera test package """
554 return {
555 'android.app' : [
556 'android.app.cts.SystemFeaturesTest#testCameraFeatures',
557 ],
558 'android.permission' : [
559 'android.permission.cts.CameraPermissionTest',
560 'android.permission.cts.Camera2PermissionTest',
561 ],
562 '' : []}
563
Brian Muramatsu9157e0a2011-04-05 18:06:15 -0700564def LogGenerateDescription(name):
565 print 'Generating test description for package %s' % name
566
Phil Dubach0d6ef062009-08-12 18:13:16 -0700567if __name__ == '__main__':
568 builder = CtsBuilder(sys.argv)
Keun young Parkd93d0d12013-01-10 14:11:35 -0800569 result = builder.GenerateTestDescriptions()
570 if result != 0:
571 sys.exit(result)
Phil Dubach0d6ef062009-08-12 18:13:16 -0700572 builder.GenerateTestPlans()