Index: build/android/test_runner.py |
diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
index e103db0ddd21c8db1067c259e2261535cc958d86..fdaa5da30b7fc9942d1be86cda739617a9f243fc 100755 |
--- a/build/android/test_runner.py |
+++ b/build/android/test_runner.py |
@@ -108,10 +108,6 @@ def AddCommonOptions(option_parser): |
help=('Do not push dependencies to the device. ' |
'Use this at own risk for speeding up test ' |
'execution on local machine.')) |
- # TODO(gkanwar): This option is deprecated. Remove it in the future. |
- option_parser.add_option('--exit-code', action='store_true', |
- help=('(DEPRECATED) If set, the exit code will be ' |
- 'total number of failures.')) |
# TODO(gkanwar): This option is deprecated. It is currently used to run tests |
# with the FlakyTest annotation to prevent the bots going red downstream. We |
# should instead use exit codes and let the Buildbot scripts deal with test |
@@ -375,18 +371,22 @@ def RunTestsCommand(command, options, args, option_parser): |
Returns: |
Integer indicated exit code. |
+ |
+ Raises: |
+ Exception: Unknown command name passed in. |
""" |
ProcessCommonOptions(options) |
- total_failed = 0 |
if command == 'gtest': |
# TODO(gkanwar): See the emulator TODO above -- this call should either go |
# away or become generalized. |
ProcessEmulatorOptions(options) |
- total_failed = gtest_dispatch.Dispatch(options) |
+ results = gtest_dispatch.Dispatch(options) |
+ exit_code = results.exit_code |
elif command == 'content_browsertests': |
- total_failed = browsertests_dispatch.Dispatch(options) |
+ results = browsertests_dispatch.Dispatch(options) |
+ exit_code = results.exit_code |
elif command == 'instrumentation': |
ProcessInstrumentationOptions(options, option_parser.error) |
results = base_test_result.TestRunResults() |
@@ -401,7 +401,7 @@ def RunTestsCommand(command, options, args, option_parser): |
annotation=options.annotations, |
build_type=options.build_type, |
flakiness_server=options.flakiness_dashboard_server) |
- total_failed += len(results.GetNotPass()) |
+ exit_code = results.exit_code |
elif command == 'uiautomator': |
ProcessUIAutomatorOptions(options, option_parser.error) |
results = base_test_result.TestRunResults() |
@@ -416,11 +416,11 @@ def RunTestsCommand(command, options, args, option_parser): |
annotation=options.annotations, |
build_type=options.build_type, |
flakiness_server=options.flakiness_dashboard_server) |
- total_failed += len(results.GetNotPass()) |
+ exit_code = results.exit_code |
else: |
raise Exception('Unknown test type state') |
- return total_failed |
+ return exit_code |
def HelpCommand(command, options, args, option_parser): |
@@ -503,6 +503,7 @@ class CommandOptionParser(optparse.OptionParser): |
return '\nExample:\n %s\n' % self.example |
return '' |
+ |
def main(argv): |
option_parser = CommandOptionParser( |
usage='Usage: %prog <command> [options]', |
@@ -517,13 +518,6 @@ def main(argv): |
exit_code = VALID_COMMANDS[command].run_command_func( |
command, options, args, option_parser) |
- # Failures of individual test suites are communicated by printing a |
- # STEP_FAILURE message. |
- # Returning a success exit status also prevents the buildbot from incorrectly |
- # marking the last suite as failed if there were failures in other suites in |
- # the batch (this happens because the exit status is a sum of all failures |
- # from all suites, but the buildbot associates the exit status only with the |
- # most recent step). |
return exit_code |