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

Side by Side Diff: build/android/pylib/local/device/local_device_gtest_run.py

Issue 1394153002: Android gtest runner: Query only a single device for the test list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import itertools 5 import itertools
6 import os 6 import os
7 import posixpath 7 import posixpath
8 8
9 from devil.android import device_errors 9 from devil.android import device_errors
10 from devil.android import device_temp_file 10 from devil.android import device_temp_file
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #override 222 #override
223 def _GetTests(self): 223 def _GetTests(self):
224 @local_device_test_run.handle_shard_failures 224 @local_device_test_run.handle_shard_failures
225 def list_tests(dev): 225 def list_tests(dev):
226 tests = self._delegate.Run( 226 tests = self._delegate.Run(
227 None, dev, flags='--gtest_list_tests', timeout=10) 227 None, dev, flags='--gtest_list_tests', timeout=10)
228 tests = gtest_test_instance.ParseGTestListTests(tests) 228 tests = gtest_test_instance.ParseGTestListTests(tests)
229 tests = self._test_instance.FilterTests(tests) 229 tests = self._test_instance.FilterTests(tests)
230 return tests 230 return tests
231 231
232 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) 232 # Result should be the same for all devices, so just use the first one.
233 tests = list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) 233 return list_tests(self._env.devices[0])
234 return tests
235 234
236 #override 235 #override
237 def _RunTest(self, device, test): 236 def _RunTest(self, device, test):
238 # Run the test. 237 # Run the test.
239 timeout = (self._test_instance.shard_timeout 238 timeout = (self._test_instance.shard_timeout
240 * self.GetTool(device).GetTimeoutScale()) 239 * self.GetTool(device).GetTimeoutScale())
241 output = self._delegate.Run( 240 output = self._delegate.Run(
242 test, device, timeout=timeout, retries=0) 241 test, device, timeout=timeout, retries=0)
243 for s in self._servers[str(device)]: 242 for s in self._servers[str(device)]:
244 s.Reset() 243 s.Reset()
245 if self._test_instance.app_files: 244 if self._test_instance.app_files:
246 self._delegate.PullAppFiles(device, self._test_instance.app_files, 245 self._delegate.PullAppFiles(device, self._test_instance.app_files,
247 self._test_instance.app_file_dir) 246 self._test_instance.app_file_dir)
248 self._delegate.Clear(device) 247 self._delegate.Clear(device)
249 248
250 # Parse the output. 249 # Parse the output.
251 # TODO(jbudorick): Transition test scripts away from parsing stdout. 250 # TODO(jbudorick): Transition test scripts away from parsing stdout.
252 results = self._test_instance.ParseGTestOutput(output) 251 results = self._test_instance.ParseGTestOutput(output)
253 return results 252 return results
254 253
255 #override 254 #override
256 def TearDown(self): 255 def TearDown(self):
257 @local_device_test_run.handle_shard_failures 256 @local_device_test_run.handle_shard_failures
258 def individual_device_tear_down(dev): 257 def individual_device_tear_down(dev):
259 for s in self._servers.get(str(dev), []): 258 for s in self._servers.get(str(dev), []):
260 s.TearDown() 259 s.TearDown()
261 260
262 self._env.parallel_devices.pMap(individual_device_tear_down) 261 self._env.parallel_devices.pMap(individual_device_tear_down)
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