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

Side by Side Diff: build/android/pylib/base_test_sharder.py

Issue 10689132: [android] Upstream / sync most of build/android and build/android/pylib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « build/android/pylib/base_test_runner.py ('k') | build/android/pylib/buildbot_report.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 import logging 6 import logging
7 import multiprocessing 7 import multiprocessing
8 8
9 from test_result import * 9 from test_result import TestResults
10 10
11 11
12 def _ShardedTestRunnable(test): 12 def _ShardedTestRunnable(test):
13 """Standalone function needed by multiprocessing.Pool.""" 13 """Standalone function needed by multiprocessing.Pool."""
14 log_format = '[' + test.device + '] # %(asctime)-15s: %(message)s' 14 log_format = '[' + test.device + '] # %(asctime)-15s: %(message)s'
15 if logging.getLogger().handlers: 15 if logging.getLogger().handlers:
16 logging.getLogger().handlers[0].setFormatter(logging.Formatter(log_format)) 16 logging.getLogger().handlers[0].setFormatter(logging.Formatter(log_format))
17 else: 17 else:
18 logging.basicConfig(format=log_format) 18 logging.basicConfig(format=log_format)
19 return test.Run() 19 return test.Run()
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 A TestResults object. 69 A TestResults object.
70 """ 70 """
71 logging.warning('*' * 80) 71 logging.warning('*' * 80)
72 logging.warning('Sharding in ' + str(len(self.attached_devices)) + 72 logging.warning('Sharding in ' + str(len(self.attached_devices)) +
73 ' devices.') 73 ' devices.')
74 logging.warning('Note that the output is not synchronized.') 74 logging.warning('Note that the output is not synchronized.')
75 logging.warning('Look for the "Final result" banner in the end.') 75 logging.warning('Look for the "Final result" banner in the end.')
76 logging.warning('*' * 80) 76 logging.warning('*' * 80)
77 final_results = TestResults() 77 final_results = TestResults()
78 for retry in xrange(self.retries): 78 for retry in xrange(self.retries):
79 logging.warning('Try %d of %d' % (retry + 1, self.retries)) 79 logging.warning('Try %d of %d', retry + 1, self.retries)
80 self.SetupSharding(self.tests) 80 self.SetupSharding(self.tests)
81 test_runners = [] 81 test_runners = []
82 for index, device in enumerate(self.attached_devices): 82 for index, device in enumerate(self.attached_devices):
83 logging.warning('*' * 80) 83 logging.warning('*' * 80)
84 logging.warning('Creating shard %d for %s' % (index, device)) 84 logging.warning('Creating shard %d for %s', index, device)
85 logging.warning('*' * 80) 85 logging.warning('*' * 80)
86 test_runner = self.CreateShardedTestRunner(device, index) 86 test_runner = self.CreateShardedTestRunner(device, index)
87 test_runners += [test_runner] 87 test_runners += [test_runner]
88 logging.warning('Starting...') 88 logging.warning('Starting...')
89 pool = multiprocessing.Pool(len(self.attached_devices), 89 pool = multiprocessing.Pool(len(self.attached_devices),
90 SetTestsContainer, 90 SetTestsContainer,
91 [BaseTestSharder.tests_container]) 91 [BaseTestSharder.tests_container])
92 results_lists = pool.map(_ShardedTestRunnable, test_runners) 92 results_lists = pool.map(_ShardedTestRunnable, test_runners)
93 test_results = TestResults.FromTestResults(results_lists) 93 test_results = TestResults.FromTestResults(results_lists)
94 if retry == self.retries - 1: 94 if retry == self.retries - 1:
95 all_passed = final_results.ok + test_results.ok 95 all_passed = final_results.ok + test_results.ok
96 final_results = test_results 96 final_results = test_results
97 final_results.ok = all_passed 97 final_results.ok = all_passed
98 break 98 break
99 else: 99 else:
100 final_results.ok += test_results.ok 100 final_results.ok += test_results.ok
101 self.tests = [] 101 self.tests = []
102 for t in test_results.GetAllBroken(): 102 for t in test_results.GetAllBroken():
103 self.tests += [t.name] 103 self.tests += [t.name]
104 if not self.tests: 104 if not self.tests:
105 break 105 break
106 self.OnTestsCompleted(test_runners, final_results) 106 self.OnTestsCompleted(test_runners, final_results)
107 return final_results 107 return final_results
OLDNEW
« no previous file with comments | « build/android/pylib/base_test_runner.py ('k') | build/android/pylib/buildbot_report.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698