OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 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 all types of tests from one unified interface.""" | 7 """Runs all types of tests from one unified interface.""" |
8 | 8 |
9 import collections | 9 import collections |
10 import logging | 10 import logging |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 help=('Address of the server that is hosting the ' | 84 help=('Address of the server that is hosting the ' |
85 'Chrome for Android flakiness dashboard.')) | 85 'Chrome for Android flakiness dashboard.')) |
86 group.add_option('--enable-platform-mode', action='store_true', | 86 group.add_option('--enable-platform-mode', action='store_true', |
87 help=('Run the test scripts in platform mode, which ' | 87 help=('Run the test scripts in platform mode, which ' |
88 'conceptually separates the test runner from the ' | 88 'conceptually separates the test runner from the ' |
89 '"device" (local or remote, real or emulated) on ' | 89 '"device" (local or remote, real or emulated) on ' |
90 'which the tests are running. [experimental]')) | 90 'which the tests are running. [experimental]')) |
91 group.add_option('-e', '--environment', default='local', | 91 group.add_option('-e', '--environment', default='local', |
92 help=('Test environment to run in. Must be one of: %s' % | 92 help=('Test environment to run in. Must be one of: %s' % |
93 ', '.join(constants.VALID_ENVIRONMENTS))) | 93 ', '.join(constants.VALID_ENVIRONMENTS))) |
| 94 group.add_option('--adb-path', |
| 95 help=('Specify the absolute path of the adb binary that ' |
| 96 'should be used.')) |
94 option_parser.add_option_group(group) | 97 option_parser.add_option_group(group) |
95 | 98 |
96 | 99 |
97 def ProcessCommonOptions(options, error_func): | 100 def ProcessCommonOptions(options, error_func): |
98 """Processes and handles all common options.""" | 101 """Processes and handles all common options.""" |
99 run_tests_helper.SetLogLevel(options.verbose_count) | 102 run_tests_helper.SetLogLevel(options.verbose_count) |
100 constants.SetBuildType(options.build_type) | 103 constants.SetBuildType(options.build_type) |
101 if options.build_directory: | 104 if options.build_directory: |
102 constants.SetBuildDirectory(options.build_directory) | 105 constants.SetBuildDirectory(options.build_directory) |
103 if options.output_directory: | 106 if options.output_directory: |
104 constants.SetOutputDirectort(options.output_directory) | 107 constants.SetOutputDirectort(options.output_directory) |
| 108 if options.adb_path: |
| 109 constants.SetAdbPath(options.adb_path) |
| 110 # Some things such as Forwarder require ADB to be in the environment path. |
| 111 adb_dir = os.path.dirname(constants.GetAdbPath()) |
| 112 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): |
| 113 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] |
105 if options.environment not in constants.VALID_ENVIRONMENTS: | 114 if options.environment not in constants.VALID_ENVIRONMENTS: |
106 error_func('--environment must be one of: %s' % | 115 error_func('--environment must be one of: %s' % |
107 ', '.join(constants.VALID_ENVIRONMENTS)) | 116 ', '.join(constants.VALID_ENVIRONMENTS)) |
108 | 117 |
109 | 118 |
110 def AddDeviceOptions(option_parser): | 119 def AddDeviceOptions(option_parser): |
111 group = optparse.OptionGroup(option_parser, 'Device Options') | 120 group = optparse.OptionGroup(option_parser, 'Device Options') |
112 group.add_option('-c', dest='cleanup_test_files', | 121 group.add_option('-c', dest='cleanup_test_files', |
113 help='Cleanup test files on the device after run', | 122 help='Cleanup test files on the device after run', |
114 action='store_true') | 123 action='store_true') |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 | 995 |
987 def main(): | 996 def main(): |
988 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 997 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
989 option_parser = command_option_parser.CommandOptionParser( | 998 option_parser = command_option_parser.CommandOptionParser( |
990 commands_dict=VALID_COMMANDS) | 999 commands_dict=VALID_COMMANDS) |
991 return command_option_parser.ParseAndExecute(option_parser) | 1000 return command_option_parser.ParseAndExecute(option_parser) |
992 | 1001 |
993 | 1002 |
994 if __name__ == '__main__': | 1003 if __name__ == '__main__': |
995 sys.exit(main()) | 1004 sys.exit(main()) |
OLD | NEW |