| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Runs both the Python and Java instrumentation tests.""" | 7 """Runs both the Python and Java instrumentation tests.""" |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os |
| 10 import sys | 11 import sys |
| 11 | 12 |
| 12 from pylib import buildbot_report | 13 from pylib import buildbot_report |
| 13 from pylib import ports | 14 from pylib import ports |
| 14 from pylib.base import base_test_result | 15 from pylib.base import base_test_result |
| 15 from pylib.host_driven import run_python_tests | 16 from pylib.host_driven import run_python_tests |
| 16 from pylib.instrumentation import dispatch | 17 from pylib.instrumentation import dispatch |
| 17 from pylib.utils import report_results | 18 from pylib.utils import report_results |
| 18 from pylib.utils import run_tests_helper | 19 from pylib.utils import run_tests_helper |
| 19 from pylib.utils import test_options_parser | 20 from pylib.utils import test_options_parser |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 all_results = base_test_result.TestRunResults() | 43 all_results = base_test_result.TestRunResults() |
| 43 | 44 |
| 44 if options.run_java_tests: | 45 if options.run_java_tests: |
| 45 all_results.AddTestRunResults(dispatch.Dispatch(options)) | 46 all_results.AddTestRunResults(dispatch.Dispatch(options)) |
| 46 if options.run_python_tests: | 47 if options.run_python_tests: |
| 47 all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options)) | 48 all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options)) |
| 48 | 49 |
| 49 report_results.LogFull( | 50 report_results.LogFull( |
| 50 results=all_results, | 51 results=all_results, |
| 51 test_type='Instrumentation', | 52 test_type='Instrumentation', |
| 52 test_package=options.test_apk, | 53 test_package=os.path.basename(options.test_apk), |
| 53 annotation=options.annotation, | 54 annotation=options.annotation, |
| 54 build_type=options.build_type, | 55 build_type=options.build_type, |
| 55 flakiness_server=options.flakiness_dashboard_server) | 56 flakiness_server=options.flakiness_dashboard_server) |
| 56 | 57 |
| 57 return len(all_results.GetNotPass()) | 58 return len(all_results.GetNotPass()) |
| 58 | 59 |
| 59 | 60 |
| 60 def main(argv): | 61 def main(argv): |
| 61 option_parser = optparse.OptionParser() | 62 option_parser = optparse.OptionParser() |
| 62 test_options_parser.AddInstrumentationOptions(option_parser) | 63 test_options_parser.AddInstrumentationOptions(option_parser) |
| 63 options, args = option_parser.parse_args(argv) | 64 options, args = option_parser.parse_args(argv) |
| 64 test_options_parser.ValidateInstrumentationOptions(option_parser, options, | 65 test_options_parser.ValidateInstrumentationOptions(option_parser, options, |
| 65 args) | 66 args) |
| 66 | 67 |
| 67 run_tests_helper.SetLogLevel(options.verbose_count) | 68 run_tests_helper.SetLogLevel(options.verbose_count) |
| 68 ret = 1 | 69 ret = 1 |
| 69 try: | 70 try: |
| 70 ret = DispatchInstrumentationTests(options) | 71 ret = DispatchInstrumentationTests(options) |
| 71 finally: | 72 finally: |
| 72 buildbot_report.PrintStepResultIfNeeded(options, ret) | 73 buildbot_report.PrintStepResultIfNeeded(options, ret) |
| 73 return ret | 74 return ret |
| 74 | 75 |
| 75 | 76 |
| 76 if __name__ == '__main__': | 77 if __name__ == '__main__': |
| 77 sys.exit(main(sys.argv)) | 78 sys.exit(main(sys.argv)) |
| OLD | NEW |