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

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: Refine it according to bulach's comments 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):
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
84 test_suites: the source test suites to process"""
84 # If not specified, assume the test suites are in out/Release 85 # If not specified, assume the test suites are in out/Release
85 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR, 86 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR,
86 'out', 'Release')) 87 'out', 'Release'))
87 if apk: 88 if apk:
88 # out/Release/$SUITE_apk/$SUITE-debug.apk 89 # out/Release/$SUITE_apk/$SUITE-debug.apk
89 suites = [os.path.join(test_suite_dir, 90 suites = [os.path.join(test_suite_dir,
90 t + '_apk', 91 t + '_apk',
91 t + '-debug.apk') 92 t + '-debug.apk')
92 for t in _TEST_SUITES] 93 for t in test_suites]
93 else: 94 else:
94 suites = [os.path.join(test_suite_dir, t) for t in _TEST_SUITES] 95 suites = [os.path.join(test_suite_dir, t) for t in _TEST_SUITES]
95 return suites 96 return suites
96 97
97 98
98 class TimeProfile(object): 99 class TimeProfile(object):
99 """Class for simple profiling of action, with logging of cost.""" 100 """Class for simple profiling of action, with logging of cost."""
100 101
101 def __init__(self, description): 102 def __init__(self, description):
102 self._description = description 103 self._description = description
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 Returns: 193 Returns:
193 A TestResults object. 194 A TestResults object.
194 """ 195 """
195 results = [] 196 results = []
196 global _TEST_SUITES 197 global _TEST_SUITES
197 198
198 if test_suite: 199 if test_suite:
199 global _TEST_SUITES 200 global _TEST_SUITES
200 201
201 # If not specified, assume the test suites are in out/Release 202 # 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, 203 test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR,
203 'out', 'Release')) 204 'out', 'Release'))
gone 2012/07/11 21:55:17 Saw this line during our downstream merge. Is it
yongsheng 2012/07/12 01:34:44 oh, I think you're right. should be removed. I'll
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)): 205 if (not os.path.exists(test_suite)):
213 logging.critical('Unrecognized test suite %s, supported: %s' % 206 logging.critical('Unrecognized test suite %s, supported: %s' %
214 (test_suite, _TEST_SUITES)) 207 (test_suite, _TEST_SUITES))
215 if test_suite in _TEST_SUITES: 208 if test_suite in _TEST_SUITES:
216 logging.critical('(Remember to include the path: out/Release/%s)', 209 logging.critical('(Remember to include the path: out/Release/%s)',
217 test_suite) 210 test_suite)
218 test_suite_basename = os.path.basename(test_suite) 211 test_suite_basename = os.path.basename(test_suite)
219 if test_suite_basename in _TEST_SUITES: 212 if test_suite_basename in _TEST_SUITES:
220 logging.critical('Try "make -j15 %s"' % test_suite_basename) 213 logging.critical('Try "make -j15 %s"' % test_suite_basename)
221 else: 214 else:
222 logging.critical('Unrecognized test suite, supported: %s' % 215 logging.critical('Unrecognized test suite, supported: %s' %
223 _TEST_SUITES) 216 _TEST_SUITES)
224 return TestResults.FromOkAndFailed([], [BaseTestResult(test_suite, '')], 217 return TestResults.FromRun([], [BaseTestResult(test_suite, '')],
225 False, False) 218 False, False)
226 fully_qualified_test_suites = [test_suite] 219 fully_qualified_test_suites = [test_suite]
227 else: 220 else:
228 fully_qualified_test_suites = FullyQualifiedTestSuites(apk) 221 fully_qualified_test_suites = FullyQualifiedTestSuites(apk, _TEST_SUITES)
229 debug_info_list = [] 222 debug_info_list = []
230 print 'Known suites: ' + str(_TEST_SUITES) 223 print 'Known suites: ' + str(_TEST_SUITES)
231 print 'Running these: ' + str(fully_qualified_test_suites) 224 print 'Running these: ' + str(fully_qualified_test_suites)
232 for t in fully_qualified_test_suites: 225 for t in fully_qualified_test_suites:
233 if annotate: 226 if annotate:
234 print '@@@BUILD_STEP Test suite %s@@@' % os.path.basename(t) 227 print '@@@BUILD_STEP Test suite %s@@@' % os.path.basename(t)
235 test = SingleTestRunner(device, t, gtest_filter, test_arguments, 228 test = SingleTestRunner(device, t, gtest_filter, test_arguments,
236 timeout, rebaseline, performance_test, 229 timeout, rebaseline, performance_test,
237 cleanup_test_files, tool, 0, not not log_dump_name) 230 cleanup_test_files, tool, 0, not not log_dump_name)
238 test.Run() 231 test.Run()
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 """ 400 """
408 if options.test_suite == 'help': 401 if options.test_suite == 'help':
409 ListTestSuites() 402 ListTestSuites()
410 return 0 403 return 0
411 404
412 if options.use_xvfb: 405 if options.use_xvfb:
413 xvfb = Xvfb() 406 xvfb = Xvfb()
414 xvfb.Start() 407 xvfb.Start()
415 408
416 if options.test_suite: 409 if options.test_suite:
417 all_test_suites = [options.test_suite] 410 all_test_suites = FullyQualifiedTestSuites(options.apk,
411 [options.test_suite])
418 else: 412 else:
419 all_test_suites = FullyQualifiedTestSuites(options.apk) 413 all_test_suites = FullyQualifiedTestSuites(options.apk,
414 _TEST_SUITES)
420 failures = 0 415 failures = 0
421 for suite in all_test_suites: 416 for suite in all_test_suites:
422 options.test_suite = suite 417 options.test_suite = suite
423 failures += _RunATestSuite(options) 418 failures += _RunATestSuite(options)
424 419
425 if options.use_xvfb: 420 if options.use_xvfb:
426 xvfb.Stop() 421 xvfb.Stop()
427 return failures 422 return failures
428 423
429 424
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 # from all suites, but the buildbot associates the exit status only with the 493 # from all suites, but the buildbot associates the exit status only with the
499 # most recent step). 494 # most recent step).
500 if options.annotate: 495 if options.annotate:
501 return 0 496 return 0
502 else: 497 else:
503 return failed_tests_count 498 return failed_tests_count
504 499
505 500
506 if __name__ == '__main__': 501 if __name__ == '__main__':
507 sys.exit(main(sys.argv)) 502 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