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

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

Issue 2509623003: Fix KeyError caused when filtering gtests on multiple threads. (Closed)
Patch Set: Created 4 years, 1 month 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 logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 10
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 @local_device_environment.handle_shard_failures_with( 331 @local_device_environment.handle_shard_failures_with(
332 on_failure=self._env.BlacklistDevice) 332 on_failure=self._env.BlacklistDevice)
333 def list_tests(dev): 333 def list_tests(dev):
334 raw_test_list = self._delegate.Run( 334 raw_test_list = self._delegate.Run(
335 None, dev, flags='--gtest_list_tests', timeout=30) 335 None, dev, flags='--gtest_list_tests', timeout=30)
336 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) 336 tests = gtest_test_instance.ParseGTestListTests(raw_test_list)
337 if not tests: 337 if not tests:
338 logging.info('No tests found. Output:') 338 logging.info('No tests found. Output:')
339 for l in raw_test_list: 339 for l in raw_test_list:
340 logging.info(' %s', l) 340 logging.info(' %s', l)
341 tests = self._test_instance.FilterTests(tests)
342 return tests 341 return tests
343 342
344 # Query all devices in case one fails. 343 # Query all devices in case one fails. Return unfiltered test list
344 # because |FilterTests| function is not threadsafe on older versions
345 # of python due to its use of |fnmatch| module.
345 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) 346 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None)
346 347 test_lists = [self._test_instance.FilterTests(tests)
jbudorick 2016/11/17 00:16:03 This change is ok, but it should also either: - m
348 for tests in test_lists]
347 # If all devices failed to list tests, raise an exception. 349 # If all devices failed to list tests, raise an exception.
348 # Check that tl is not None and is not empty. 350 # Check that tl is not None and is not empty.
349 if all(not tl for tl in test_lists): 351 if all(not tl for tl in test_lists):
350 raise device_errors.CommandFailedError( 352 raise device_errors.CommandFailedError(
351 'Failed to list tests on any device') 353 'Failed to list tests on any device')
352 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) 354 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl])))
353 355
354 #override 356 #override
355 def _RunTest(self, device, test): 357 def _RunTest(self, device, test):
356 # Run the test. 358 # Run the test.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 def TearDown(self): 400 def TearDown(self):
399 @local_device_environment.handle_shard_failures 401 @local_device_environment.handle_shard_failures
400 def individual_device_tear_down(dev): 402 def individual_device_tear_down(dev):
401 for s in self._servers.get(str(dev), []): 403 for s in self._servers.get(str(dev), []):
402 s.TearDown() 404 s.TearDown()
403 405
404 tool = self.GetTool(dev) 406 tool = self.GetTool(dev)
405 tool.CleanUpEnvironment() 407 tool.CleanUpEnvironment()
406 408
407 self._env.parallel_devices.pMap(individual_device_tear_down) 409 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