Chromium Code Reviews| Index: build/android/pylib/gtest/dispatch.py |
| diff --git a/build/android/pylib/gtest/dispatch.py b/build/android/pylib/gtest/dispatch.py |
| index 3c11c00f3b3d358cd7c9bef326708e7989ca733a..1aebc0b74e32a54cf9aed836c11d8ae9a2d43eb4 100644 |
| --- a/build/android/pylib/gtest/dispatch.py |
| +++ b/build/android/pylib/gtest/dispatch.py |
| @@ -13,6 +13,7 @@ from pylib import android_commands |
| from pylib import cmd_helper |
| from pylib import constants |
| from pylib import ports |
| +from pylib.base import base_test_result |
| from pylib.base import shard |
| from pylib.utils import emulator |
| from pylib.utils import report_results |
| @@ -35,6 +36,9 @@ def _FullyQualifiedTestSuites(exe, option_test_suite, build_type): |
| Ex. ('content_unittests', |
| '/tmp/chrome/src/out/Debug/content_unittests_apk/' |
| 'content_unittests-debug.apk') |
| + |
| + Raises: |
| + Exception: If test suite not found. |
| """ |
| def GetQualifiedSuite(suite): |
| if suite.is_suite_exe: |
| @@ -93,7 +97,8 @@ def GetAllEnabledTests(runner_factory, devices): |
| Returns: |
| List of all enabled tests. |
| - Raises Exception if all devices failed. |
| + Raises: |
| + Exception: If no devices available. |
| """ |
| for device in devices: |
| try: |
| @@ -118,7 +123,10 @@ def _RunATestSuite(options, suite_name): |
| suite_name: name of the test suite being run. |
| Returns: |
| - 0 if successful, number of failing tests otherwise. |
| + A tuple of (base_test_result.TestRunResult object, exit code). |
| + |
| + Raises: |
| + Exception: If device not attached, or failed to reset test server port. |
| """ |
| step_name = os.path.basename(options.test_suite).replace('-debug.apk', '') |
| attached_devices = [] |
| @@ -168,9 +176,9 @@ def _RunATestSuite(options, suite_name): |
| tests = [t for t in tests if t] |
| # Run tests. |
| - test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, tests, |
| - options.build_type, test_timeout=None, |
| - num_retries=options.num_retries) |
| + test_results, exit_code = shard.ShardAndRunTests( |
| + RunnerFactory, attached_devices, tests, options.build_type, |
| + test_timeout=None, num_retries=options.num_retries) |
| report_results.LogFull( |
| results=test_results, |
| @@ -183,7 +191,7 @@ def _RunATestSuite(options, suite_name): |
| for buildbot_emulator in buildbot_emulators: |
| buildbot_emulator.Shutdown() |
| - return len(test_results.GetNotPass()) |
| + return (test_results, exit_code) |
| def _ListTestSuites(): |
| @@ -203,7 +211,7 @@ def Dispatch(options): |
| options: options for running the tests. |
| Returns: |
| - 0 if successful, number of failing tests otherwise. |
| + base_test_result.TestRunResults object with the results of running the tests |
| """ |
| if options.test_suite == 'help': |
| _ListTestSuites() |
| @@ -215,13 +223,18 @@ def Dispatch(options): |
| all_test_suites = _FullyQualifiedTestSuites(options.exe, options.test_suite, |
| options.build_type) |
| - failures = 0 |
| + results = base_test_result.TestRunResults() |
| + exit_code = 0 |
| for suite_name, suite_path in all_test_suites: |
| # Give each test suite its own copy of options. |
| test_options = copy.deepcopy(options) |
| test_options.test_suite = suite_path |
| - failures += _RunATestSuite(test_options, suite_name) |
| + test_results, test_exit_code = _RunATestSuite(test_options, suite_name) |
| + results.AddTestRunResults(test_results) |
| + if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: |
|
frankf
2013/07/04 00:46:19
the warning would get overwritten here right?
gkanwar
2013/07/08 18:50:25
If exit_code is warning or normal, and test_exit_c
|
| + exit_code = test_exit_code |
| if options.use_xvfb: |
| framebuffer.Stop() |
| - return failures |
| + |
| + return (results, exit_code) |