Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 @local_device_environment.handle_shard_failures_with( | 347 @local_device_environment.handle_shard_failures_with( |
| 348 on_failure=self._env.BlacklistDevice) | 348 on_failure=self._env.BlacklistDevice) |
| 349 def list_tests(dev): | 349 def list_tests(dev): |
| 350 raw_test_list = self._delegate.Run( | 350 raw_test_list = self._delegate.Run( |
| 351 None, dev, flags='--gtest_list_tests', timeout=30) | 351 None, dev, flags='--gtest_list_tests', timeout=30) |
| 352 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) | 352 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) |
| 353 if not tests: | 353 if not tests: |
| 354 logging.info('No tests found. Output:') | 354 logging.info('No tests found. Output:') |
| 355 for l in raw_test_list: | 355 for l in raw_test_list: |
| 356 logging.info(' %s', l) | 356 logging.info(' %s', l) |
| 357 tests = self._test_instance.FilterTests(tests) | 357 tests = self._test_instance.FilterTests( |
| 358 tests, None, self._test_instance.gtest_also_run_disabled_tests) | |
| 358 return tests | 359 return tests |
| 359 | 360 |
| 360 # Query all devices in case one fails. | 361 # Query all devices in case one fails. |
| 361 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 362 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
| 362 | 363 |
| 363 # If all devices failed to list tests, raise an exception. | 364 # If all devices failed to list tests, raise an exception. |
| 364 # Check that tl is not None and is not empty. | 365 # Check that tl is not None and is not empty. |
| 365 if all(not tl for tl in test_lists): | 366 if all(not tl for tl in test_lists): |
| 366 raise device_errors.CommandFailedError( | 367 raise device_errors.CommandFailedError( |
| 367 'Failed to list tests on any device') | 368 'Failed to list tests on any device') |
| 368 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 369 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
| 369 | 370 |
| 370 #override | 371 #override |
| 371 def _RunTest(self, device, test): | 372 def _RunTest(self, device, test): |
| 372 # Run the test. | 373 # Run the test. |
| 373 timeout = (self._test_instance.shard_timeout | 374 timeout = (self._test_instance.shard_timeout |
| 374 * self.GetTool(device).GetTimeoutScale()) | 375 * self.GetTool(device).GetTimeoutScale()) |
| 375 if self._test_instance.store_tombstones: | 376 if self._test_instance.store_tombstones: |
| 376 tombstones.ClearAllTombstones(device) | 377 tombstones.ClearAllTombstones(device) |
| 377 with device_temp_file.DeviceTempFile( | 378 with device_temp_file.DeviceTempFile( |
| 378 adb=device.adb, | 379 adb=device.adb, |
| 379 dir=self._delegate.ResultsDirectory(device), | 380 dir=self._delegate.ResultsDirectory(device), |
| 380 suffix='.xml') as device_tmp_results_file: | 381 suffix='.xml') as device_tmp_results_file: |
| 381 | 382 |
| 382 flags = self._test_instance.test_arguments or '' | 383 flags = self._test_instance.test_arguments or '' |
| 383 if self._test_instance.enable_xml_result_parsing: | 384 if self._test_instance.enable_xml_result_parsing: |
| 384 flags += ' --gtest_output=xml:%s' % device_tmp_results_file.name | 385 flags += ' --gtest_output=xml:%s' % device_tmp_results_file.name |
| 386 flags += ' --gtest_also_run_disabled_tests=%r' % ( | |
| 387 self._test_instance.gtest_also_run_disabled_tests) | |
|
jbudorick
2016/11/30 21:05:56
This shouldn't need a value, you should just be ab
shenghuazhang
2016/11/30 21:58:01
Done.
| |
| 385 | 388 |
| 386 output = self._delegate.Run( | 389 output = self._delegate.Run( |
| 387 test, device, flags=flags, | 390 test, device, flags=flags, |
| 388 timeout=timeout, retries=0) | 391 timeout=timeout, retries=0) |
| 389 | 392 |
| 390 if self._test_instance.enable_xml_result_parsing: | 393 if self._test_instance.enable_xml_result_parsing: |
| 391 gtest_xml = device.ReadFile( | 394 gtest_xml = device.ReadFile( |
| 392 device_tmp_results_file.name, | 395 device_tmp_results_file.name, |
| 393 as_root=True) | 396 as_root=True) |
| 394 | 397 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 def TearDown(self): | 431 def TearDown(self): |
| 429 @local_device_environment.handle_shard_failures | 432 @local_device_environment.handle_shard_failures |
| 430 def individual_device_tear_down(dev): | 433 def individual_device_tear_down(dev): |
| 431 for s in self._servers.get(str(dev), []): | 434 for s in self._servers.get(str(dev), []): |
| 432 s.TearDown() | 435 s.TearDown() |
| 433 | 436 |
| 434 tool = self.GetTool(dev) | 437 tool = self.GetTool(dev) |
| 435 tool.CleanUpEnvironment() | 438 tool.CleanUpEnvironment() |
| 436 | 439 |
| 437 self._env.parallel_devices.pMap(individual_device_tear_down) | 440 self._env.parallel_devices.pMap(individual_device_tear_down) |
| OLD | NEW |