Chromium Code Reviews| Index: build/android/test_runner.py |
| diff --git a/build/android/test_runner.py b/build/android/test_runner.py |
| index e103db0ddd21c8db1067c259e2261535cc958d86..afed350d38742ef0a0c65a692a6b88c44d1d8ae9 100755 |
| --- a/build/android/test_runner.py |
| +++ b/build/android/test_runner.py |
| @@ -17,6 +17,7 @@ import sys |
| from pylib import cmd_helper |
| from pylib import constants |
| +from pylib import exit_code |
| from pylib import ports |
| from pylib.base import base_test_result |
| from pylib.browsertests import dispatch as browsertests_dispatch |
| @@ -108,19 +109,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 |
| - # failures appropriately. See crbug.com/170477. |
| - option_parser.add_option('--buildbot-step-failure', |
| - action='store_true', |
| - help=('(DEPRECATED) If present, will set the ' |
| - 'buildbot status as STEP_FAILURE, otherwise ' |
| - 'as STEP_WARNINGS when test(s) fail.')) |
| option_parser.add_option('-d', '--device', dest='test_device', |
| help=('Target device for the test suite ' |
| 'to run on.')) |
| @@ -375,18 +363,24 @@ def RunTestsCommand(command, options, args, option_parser): |
| Returns: |
| Integer indicated exit code. |
| + |
| + Raises: |
| + Exception: Unknown command name passed in. |
| """ |
| + exit_code.ResetExitCode() |
| + |
| 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) |
| + gtest_dispatch.Dispatch(options) |
| + returned_exit_code = exit_code.GetExitCode() |
| elif command == 'content_browsertests': |
| - total_failed = browsertests_dispatch.Dispatch(options) |
| + browsertests_dispatch.Dispatch(options) |
| + returned_exit_code = exit_code.GetExitCode() |
| elif command == 'instrumentation': |
| ProcessInstrumentationOptions(options, option_parser.error) |
| results = base_test_result.TestRunResults() |
| @@ -401,7 +395,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()) |
| + returned_exit_code = exit_code.GetExitCode() |
| elif command == 'uiautomator': |
| ProcessUIAutomatorOptions(options, option_parser.error) |
| results = base_test_result.TestRunResults() |
| @@ -416,11 +410,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()) |
| + returned_exit_code = exit_code.GetExitCode() |
|
frankf
2013/07/04 00:46:19
Why not just return this on line 417?
gkanwar
2013/07/08 18:50:25
In the updated code we get the exit_code before pr
|
| else: |
| raise Exception('Unknown test type state') |
| - return total_failed |
| + return returned_exit_code |
| def HelpCommand(command, options, args, option_parser): |
| @@ -503,6 +497,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 +512,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 |