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 sys | 9 import sys |
10 import time | 10 import time |
11 | 11 |
12 from pylib import apk_info | 12 from pylib import apk_info |
13 from pylib import test_options_parser | 13 from pylib import test_options_parser |
14 from pylib import run_java_tests | 14 from pylib import run_java_tests |
15 from pylib import run_python_tests | 15 from pylib import run_python_tests |
16 from pylib import run_tests_helper | 16 from pylib import run_tests_helper |
17 from pylib.test_result import TestResults | 17 from pylib.test_result import TestResults |
18 | 18 |
19 | 19 |
20 def SummarizeResults(java_results, python_results, annotation): | 20 def SummarizeResults(java_results, python_results, annotation, build_type): |
21 """Summarize the results from the various test types. | 21 """Summarize the results from the various test types. |
22 | 22 |
23 Args: | 23 Args: |
24 java_results: a TestResults object with java test case results. | 24 java_results: a TestResults object with java test case results. |
25 python_results: a TestResults object with python test case results. | 25 python_results: a TestResults object with python test case results. |
26 annotation: the annotation used for these results. | 26 annotation: the annotation used for these results. |
| 27 build_type: 'Release' or 'Debug'. |
27 | 28 |
28 Returns: | 29 Returns: |
29 A tuple (all_results, summary_string, num_failing) | 30 A tuple (all_results, summary_string, num_failing) |
30 """ | 31 """ |
31 all_results = TestResults.FromTestResults([java_results, python_results]) | 32 all_results = TestResults.FromTestResults([java_results, python_results]) |
32 summary_string = all_results.LogFull('Instrumentation', annotation) | 33 summary_string = all_results.LogFull('Instrumentation', annotation, |
| 34 build_type) |
33 num_failing = (len(all_results.failed) + len(all_results.crashed) + | 35 num_failing = (len(all_results.failed) + len(all_results.crashed) + |
34 len(all_results.unknown)) | 36 len(all_results.unknown)) |
35 return all_results, summary_string, num_failing | 37 return all_results, summary_string, num_failing |
36 | 38 |
37 | 39 |
38 def DispatchInstrumentationTests(options): | 40 def DispatchInstrumentationTests(options): |
39 """Dispatches the Java and Python instrumentation tests, sharding if possible. | 41 """Dispatches the Java and Python instrumentation tests, sharding if possible. |
40 | 42 |
41 Uses the logging module to print the combined final results and | 43 Uses the logging module to print the combined final results and |
42 summary of the Java and Python tests. If the java_only option is set, only | 44 summary of the Java and Python tests. If the java_only option is set, only |
(...skipping 11 matching lines...) Expand all Loading... |
54 python_results = TestResults() | 56 python_results = TestResults() |
55 | 57 |
56 if options.run_java_tests: | 58 if options.run_java_tests: |
57 java_results = run_java_tests.DispatchJavaTests( | 59 java_results = run_java_tests.DispatchJavaTests( |
58 options, | 60 options, |
59 [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]) | 61 [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]) |
60 if options.run_python_tests: | 62 if options.run_python_tests: |
61 python_results = run_python_tests.DispatchPythonTests(options) | 63 python_results = run_python_tests.DispatchPythonTests(options) |
62 | 64 |
63 all_results, summary_string, num_failing = SummarizeResults( | 65 all_results, summary_string, num_failing = SummarizeResults( |
64 java_results, python_results, options.annotation) | 66 java_results, python_results, options.annotation, options.build_type) |
65 return num_failing | 67 return num_failing |
66 | 68 |
67 | 69 |
68 def main(argv): | 70 def main(argv): |
69 options = test_options_parser.ParseInstrumentationArgs(argv) | 71 options = test_options_parser.ParseInstrumentationArgs(argv) |
70 run_tests_helper.SetLogLevel(options.verbose_count) | 72 run_tests_helper.SetLogLevel(options.verbose_count) |
71 return DispatchInstrumentationTests(options) | 73 return DispatchInstrumentationTests(options) |
72 | 74 |
73 | 75 |
74 if __name__ == '__main__': | 76 if __name__ == '__main__': |
75 sys.exit(main(sys.argv)) | 77 sys.exit(main(sys.argv)) |
OLD | NEW |