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

Unified Diff: build/android/pylib/gtest/dispatch.py

Issue 18323020: Updates the test runner script exit codes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Makes several minor fixes Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
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.
frankf 2013/07/08 19:13:43 Not sure if this is the whole truth. Many of the f
gkanwar 2013/07/08 21:17:07 Hmm, I didn't realize that. Slightly rephrased.
"""
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
frankf 2013/07/08 19:13:43 Hmm. Actually, I'm not sure having a NORMAL exit c
gkanwar 2013/07/08 21:17:07 Fair enough... I could see an argument for both wa
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:
+ exit_code = test_exit_code
if options.use_xvfb:
framebuffer.Stop()
- return failures
+
+ return (results, exit_code)

Powered by Google App Engine
This is Rietveld 408576698