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