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

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

Issue 1716863002: Raise exception when all devices fail to list tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 10 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 collections 5 import collections
6 import itertools 6 import itertools
7 import os 7 import os
8 import posixpath 8 import posixpath
9 9
10 from devil.android import device_errors 10 from devil.android import device_errors
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 on_failure=self._env.BlacklistDevice) 308 on_failure=self._env.BlacklistDevice)
309 def list_tests(dev): 309 def list_tests(dev):
310 tests = self._delegate.Run( 310 tests = self._delegate.Run(
311 None, dev, flags='--gtest_list_tests', timeout=20) 311 None, dev, flags='--gtest_list_tests', timeout=20)
312 tests = gtest_test_instance.ParseGTestListTests(tests) 312 tests = gtest_test_instance.ParseGTestListTests(tests)
313 tests = self._test_instance.FilterTests(tests) 313 tests = self._test_instance.FilterTests(tests)
314 return tests 314 return tests
315 315
316 # Query all devices in case one fails. 316 # Query all devices in case one fails.
317 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) 317 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None)
318 # TODO(agrieve): Make this fail rather than return an empty list when 318
319 # all devices fail. 319 # If all devices failed to list tests, raise an exception.
320 if all([tl is None for tl in test_lists]):
321 raise device_errors.CommandFailedError(
322 'Failed to list tests on any device')
320 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) 323 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl])))
321 324
322 #override 325 #override
323 def _RunTest(self, device, test): 326 def _RunTest(self, device, test):
324 # Run the test. 327 # Run the test.
325 timeout = (self._test_instance.shard_timeout 328 timeout = (self._test_instance.shard_timeout
326 * self.GetTool(device).GetTimeoutScale()) 329 * self.GetTool(device).GetTimeoutScale())
327 output = self._delegate.Run( 330 output = self._delegate.Run(
328 test, device, flags=self._test_instance.test_arguments, 331 test, device, flags=self._test_instance.test_arguments,
329 timeout=timeout, retries=0) 332 timeout=timeout, retries=0)
(...skipping 14 matching lines...) Expand all
344 def TearDown(self): 347 def TearDown(self):
345 @local_device_test_run.handle_shard_failures 348 @local_device_test_run.handle_shard_failures
346 def individual_device_tear_down(dev): 349 def individual_device_tear_down(dev):
347 for s in self._servers.get(str(dev), []): 350 for s in self._servers.get(str(dev), []):
348 s.TearDown() 351 s.TearDown()
349 352
350 tool = self.GetTool(dev) 353 tool = self.GetTool(dev)
351 tool.CleanUpEnvironment() 354 tool.CleanUpEnvironment()
352 355
353 self._env.parallel_devices.pMap(individual_device_tear_down) 356 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