OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 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 UIAutomator tests.""" | 7 """Runs both the Python and Java UIAutomator tests.""" |
8 | 8 |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
11 import sys | 11 import sys |
12 import time | 12 import time |
13 | 13 |
14 from pylib import buildbot_report | 14 from pylib import buildbot_report |
15 from pylib import constants | 15 from pylib import constants |
16 from pylib import ports | 16 from pylib import ports |
17 from pylib.base import base_test_result | 17 from pylib.base import base_test_result |
18 from pylib.host_driven import run_python_tests | 18 from pylib.host_driven import run_python_tests |
19 from pylib.instrumentation import dispatch | 19 from pylib.uiautomator import dispatch |
20 from pylib.utils import report_results | 20 from pylib.utils import report_results |
21 from pylib.utils import run_tests_helper | 21 from pylib.utils import run_tests_helper |
22 from pylib.utils import test_options_parser | 22 from pylib.utils import test_options_parser |
23 | 23 |
24 | 24 |
25 def DispatchUIAutomatorTests(options): | 25 def DispatchUIAutomatorTests(options): |
26 """Dispatches the UIAutomator tests, sharding if possible. | 26 """Dispatches the UIAutomator tests, sharding if possible. |
27 | 27 |
28 Uses the logging module to print the combined final results and | 28 Uses the logging module to print the combined final results and |
29 summary of the Java and Python tests. If the java_only option is set, only | 29 summary of the Java and Python tests. If the java_only option is set, only |
(...skipping 16 matching lines...) Expand all Loading... |
46 | 46 |
47 if options.run_java_tests: | 47 if options.run_java_tests: |
48 all_results.AddTestRunResults(dispatch.Dispatch(options)) | 48 all_results.AddTestRunResults(dispatch.Dispatch(options)) |
49 if options.run_python_tests: | 49 if options.run_python_tests: |
50 all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options)) | 50 all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options)) |
51 | 51 |
52 report_results.LogFull( | 52 report_results.LogFull( |
53 results=all_results, | 53 results=all_results, |
54 test_type='UIAutomator', | 54 test_type='UIAutomator', |
55 test_package=os.path.basename(options.test_jar), | 55 test_package=os.path.basename(options.test_jar), |
56 annotation=options.annotation, | 56 annotation=options.annotations, |
57 build_type=options.build_type, | 57 build_type=options.build_type, |
58 flakiness_server=options.flakiness_dashboard_server) | 58 flakiness_server=options.flakiness_dashboard_server) |
59 | 59 |
60 return len(all_results.GetNotPass()) | 60 return len(all_results.GetNotPass()) |
61 | 61 |
62 | 62 |
63 def main(argv): | 63 def main(argv): |
64 option_parser = optparse.OptionParser() | 64 option_parser = optparse.OptionParser() |
65 test_options_parser.AddUIAutomatorOptions(option_parser) | 65 test_options_parser.AddUIAutomatorOptions(option_parser) |
66 options, args = option_parser.parse_args(argv) | 66 options, args = option_parser.parse_args(argv) |
67 test_options_parser.ValidateUIAutomatorOptions(option_parser, options, args) | 67 test_options_parser.ValidateUIAutomatorOptions(option_parser, options, args) |
68 | 68 |
69 run_tests_helper.SetLogLevel(options.verbose_count) | 69 run_tests_helper.SetLogLevel(options.verbose_count) |
70 ret = 1 | 70 ret = 1 |
71 try: | 71 try: |
72 ret = DispatchUIAutomatorTests(options) | 72 ret = DispatchUIAutomatorTests(options) |
73 finally: | 73 finally: |
74 buildbot_report.PrintStepResultIfNeeded(options, ret) | 74 buildbot_report.PrintStepResultIfNeeded(options, ret) |
75 return ret | 75 return ret |
76 | 76 |
77 | 77 |
78 if __name__ == '__main__': | 78 if __name__ == '__main__': |
79 sys.exit(main(sys.argv)) | 79 sys.exit(main(sys.argv)) |
OLD | NEW |