| 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 tests.""" | 7 """Runs both the Python and Java tests.""" |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import sys | 10 import sys |
| 11 import time | 11 import time |
| 12 | 12 |
| 13 from pylib import apk_info | 13 from pylib import apk_info |
| 14 from pylib import buildbot_report | 14 from pylib import buildbot_report |
| 15 from pylib import test_options_parser | 15 from pylib import ports |
| 16 from pylib import run_java_tests | 16 from pylib import run_java_tests |
| 17 from pylib import run_python_tests | 17 from pylib import run_python_tests |
| 18 from pylib import run_tests_helper | 18 from pylib import run_tests_helper |
| 19 from pylib import test_options_parser |
| 19 from pylib.test_result import TestResults | 20 from pylib.test_result import TestResults |
| 20 | 21 |
| 21 | 22 |
| 22 def SummarizeResults(java_results, python_results, annotation, build_type): | 23 def SummarizeResults(java_results, python_results, annotation, build_type): |
| 23 """Summarize the results from the various test types. | 24 """Summarize the results from the various test types. |
| 24 | 25 |
| 25 Args: | 26 Args: |
| 26 java_results: a TestResults object with java test case results. | 27 java_results: a TestResults object with java test case results. |
| 27 python_results: a TestResults object with python test case results. | 28 python_results: a TestResults object with python test case results. |
| 28 annotation: the annotation used for these results. | 29 annotation: the annotation used for these results. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 summary of the Java and Python tests. If the java_only option is set, only | 47 summary of the Java and Python tests. If the java_only option is set, only |
| 47 the Java tests run. If the python_only option is set, only the python tests | 48 the Java tests run. If the python_only option is set, only the python tests |
| 48 run. If neither are set, run both Java and Python tests. | 49 run. If neither are set, run both Java and Python tests. |
| 49 | 50 |
| 50 Args: | 51 Args: |
| 51 options: command-line options for running the Java and Python tests. | 52 options: command-line options for running the Java and Python tests. |
| 52 | 53 |
| 53 Returns: | 54 Returns: |
| 54 An integer representing the number of failing tests. | 55 An integer representing the number of failing tests. |
| 55 """ | 56 """ |
| 57 # Reset the test port allocation. It's important to do it before starting |
| 58 # to dispatch any tests. |
| 59 if not ports.ResetTestServerPortAllocation(): |
| 60 raise Exception('Failed to reset test server port.') |
| 56 start_date = int(time.time() * 1000) | 61 start_date = int(time.time() * 1000) |
| 57 java_results = TestResults() | 62 java_results = TestResults() |
| 58 python_results = TestResults() | 63 python_results = TestResults() |
| 59 | 64 |
| 60 if options.run_java_tests: | 65 if options.run_java_tests: |
| 61 java_results = run_java_tests.DispatchJavaTests( | 66 java_results = run_java_tests.DispatchJavaTests( |
| 62 options, | 67 options, |
| 63 [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]) | 68 [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]) |
| 64 if options.run_python_tests: | 69 if options.run_python_tests: |
| 65 python_results = run_python_tests.DispatchPythonTests(options) | 70 python_results = run_python_tests.DispatchPythonTests(options) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 78 | 83 |
| 79 run_tests_helper.SetLogLevel(options.verbose_count) | 84 run_tests_helper.SetLogLevel(options.verbose_count) |
| 80 buildbot_report.PrintNamedStep( | 85 buildbot_report.PrintNamedStep( |
| 81 'Instrumentation tests: %s - %s' % (', '.join(options.annotation), | 86 'Instrumentation tests: %s - %s' % (', '.join(options.annotation), |
| 82 options.test_apk)) | 87 options.test_apk)) |
| 83 return DispatchInstrumentationTests(options) | 88 return DispatchInstrumentationTests(options) |
| 84 | 89 |
| 85 | 90 |
| 86 if __name__ == '__main__': | 91 if __name__ == '__main__': |
| 87 sys.exit(main(sys.argv)) | 92 sys.exit(main(sys.argv)) |
| OLD | NEW |