Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: build/android/run_tests.py

Issue 10692153: Fix the errors for run_tests.py (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Support to specific test suite Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all the native unit tests. 7 """Runs all the native unit tests.
8 8
9 1. Copy over test binary to /data/local on device. 9 1. Copy over test binary to /data/local on device.
10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak) 10 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 _TEST_SUITES = ['base_unittests', 69 _TEST_SUITES = ['base_unittests',
70 'content_unittests', 70 'content_unittests',
71 'gpu_unittests', 71 'gpu_unittests',
72 'ipc_tests', 72 'ipc_tests',
73 'net_unittests', 73 'net_unittests',
74 'sql_unittests', 74 'sql_unittests',
75 'sync_unit_tests', 75 'sync_unit_tests',
76 'ui_unittests', 76 'ui_unittests',
77 ] 77 ]
78 78
79 def FullyQualifiedTestSuites(apk): 79 def FullyQualifiedTestSuites(apk, test_suites = _TEST_SUITES):
bulach 2012/07/11 09:04:22 nit: since there are only two callers, let's avoid
80 """Return a fully qualified list that represents all known suites. 80 """Return a fully qualified list that represents all known suites.
81 81
82 Args: 82 Args:
83 apk: if True, use the apk-based test runner""" 83 apk: if True, use the apk-based test runner"""
bulach 2012/07/11 09:04:22 nit: while here, please move the """ to the next l
84 # If not specified, assume the test suites are in out/Release 84 # If not specified, assume the test suites are in out/Release
85 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR, 85 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR,
86 'out', 'Release')) 86 'out', 'Release'))
87 if apk: 87 if apk:
88 # out/Release/$SUITE_apk/$SUITE-debug.apk 88 # out/Release/$SUITE_apk/$SUITE-debug.apk
89 suites = [os.path.join(test_suite_dir, 89 suites = [os.path.join(test_suite_dir,
90 t + '_apk', 90 t + '_apk',
91 t + '-debug.apk') 91 t + '-debug.apk')
92 for t in _TEST_SUITES] 92 for t in test_suites]
93 else: 93 else:
94 suites = [os.path.join(test_suite_dir, t) for t in _TEST_SUITES] 94 suites = [os.path.join(test_suite_dir, t) for t in _TEST_SUITES]
95 return suites 95 return suites
96 96
97 97
98 class TimeProfile(object): 98 class TimeProfile(object):
99 """Class for simple profiling of action, with logging of cost.""" 99 """Class for simple profiling of action, with logging of cost."""
100 100
101 def __init__(self, description): 101 def __init__(self, description):
102 self._description = description 102 self._description = description
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 Returns: 192 Returns:
193 A TestResults object. 193 A TestResults object.
194 """ 194 """
195 results = [] 195 results = []
196 global _TEST_SUITES 196 global _TEST_SUITES
197 197
198 if test_suite: 198 if test_suite:
199 global _TEST_SUITES 199 global _TEST_SUITES
200 200
201 # If not specified, assume the test suites are in out/Release 201 # If not specified, assume the test suites are in out/Release
202 test_suite_dir = os.path.abspath(os.path.join(run_tests_helper.CHROME_DIR, 202 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR,
203 'out', 'Release')) 203 'out', 'Release'))
bulach 2012/07/11 09:04:22 nit: while at it, please align the 'out' with the
204 if apk:
205 # out/Release/$SUITE_apk/$SUITE-debug.apk
206 test_suite = os.path.join(test_suite_dir,
207 test_suite + '_apk',
208 test_suite + '-debug.apk')
209 else:
210 test_suite = os.path.join(test_suite_dir, test_suite)
211
212 if (not os.path.exists(test_suite)): 204 if (not os.path.exists(test_suite)):
213 logging.critical('Unrecognized test suite %s, supported: %s' % 205 logging.critical('Unrecognized test suite %s, supported: %s' %
214 (test_suite, _TEST_SUITES)) 206 (test_suite, _TEST_SUITES))
215 if test_suite in _TEST_SUITES: 207 if test_suite in _TEST_SUITES:
216 logging.critical('(Remember to include the path: out/Release/%s)', 208 logging.critical('(Remember to include the path: out/Release/%s)',
217 test_suite) 209 test_suite)
218 test_suite_basename = os.path.basename(test_suite) 210 test_suite_basename = os.path.basename(test_suite)
219 if test_suite_basename in _TEST_SUITES: 211 if test_suite_basename in _TEST_SUITES:
220 logging.critical('Try "make -j15 %s"' % test_suite_basename) 212 logging.critical('Try "make -j15 %s"' % test_suite_basename)
221 else: 213 else:
222 logging.critical('Unrecognized test suite, supported: %s' % 214 logging.critical('Unrecognized test suite, supported: %s' %
223 _TEST_SUITES) 215 _TEST_SUITES)
224 return TestResults.FromOkAndFailed([], [BaseTestResult(test_suite, '')], 216 return TestResults.FromRun([], [BaseTestResult(test_suite, '')],
225 False, False) 217 False, False)
226 fully_qualified_test_suites = [test_suite] 218 fully_qualified_test_suites = [test_suite]
227 else: 219 else:
228 fully_qualified_test_suites = FullyQualifiedTestSuites(apk) 220 fully_qualified_test_suites = FullyQualifiedTestSuites(apk)
229 debug_info_list = [] 221 debug_info_list = []
230 print 'Known suites: ' + str(_TEST_SUITES) 222 print 'Known suites: ' + str(_TEST_SUITES)
231 print 'Running these: ' + str(fully_qualified_test_suites) 223 print 'Running these: ' + str(fully_qualified_test_suites)
232 for t in fully_qualified_test_suites: 224 for t in fully_qualified_test_suites:
233 if annotate: 225 if annotate:
234 print '@@@BUILD_STEP Test suite %s@@@' % os.path.basename(t) 226 print '@@@BUILD_STEP Test suite %s@@@' % os.path.basename(t)
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 """ 399 """
408 if options.test_suite == 'help': 400 if options.test_suite == 'help':
409 ListTestSuites() 401 ListTestSuites()
410 return 0 402 return 0
411 403
412 if options.use_xvfb: 404 if options.use_xvfb:
413 xvfb = Xvfb() 405 xvfb = Xvfb()
414 xvfb.Start() 406 xvfb.Start()
415 407
416 if options.test_suite: 408 if options.test_suite:
417 all_test_suites = [options.test_suite] 409 all_test_suites = FullyQualifiedTestSuites(options.apk,
410 [options.test_suite])
418 else: 411 else:
419 all_test_suites = FullyQualifiedTestSuites(options.apk) 412 all_test_suites = FullyQualifiedTestSuites(options.apk)
420 failures = 0 413 failures = 0
421 for suite in all_test_suites: 414 for suite in all_test_suites:
422 options.test_suite = suite 415 options.test_suite = suite
423 failures += _RunATestSuite(options) 416 failures += _RunATestSuite(options)
424 417
425 if options.use_xvfb: 418 if options.use_xvfb:
426 xvfb.Stop() 419 xvfb.Stop()
427 return failures 420 return failures
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 # from all suites, but the buildbot associates the exit status only with the 491 # from all suites, but the buildbot associates the exit status only with the
499 # most recent step). 492 # most recent step).
500 if options.annotate: 493 if options.annotate:
501 return 0 494 return 0
502 else: 495 else:
503 return failed_tests_count 496 return failed_tests_count
504 497
505 498
506 if __name__ == '__main__': 499 if __name__ == '__main__':
507 sys.exit(main(sys.argv)) 500 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698