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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 help=('Address of the server that is hosting the ' | 79 help=('Address of the server that is hosting the ' |
80 'Chrome for Android flakiness dashboard.')) | 80 'Chrome for Android flakiness dashboard.')) |
81 group.add_option('--enable-platform-mode', action='store_true', | 81 group.add_option('--enable-platform-mode', action='store_true', |
82 help=('Run the test scripts in platform mode, which ' | 82 help=('Run the test scripts in platform mode, which ' |
83 'conceptually separates the test runner from the ' | 83 'conceptually separates the test runner from the ' |
84 '"device" (local or remote, real or emulated) on ' | 84 '"device" (local or remote, real or emulated) on ' |
85 'which the tests are running. [experimental]')) | 85 'which the tests are running. [experimental]')) |
86 group.add_option('-e', '--environment', default='local', | 86 group.add_option('-e', '--environment', default='local', |
87 help=('Test environment to run in. Must be one of: %s' % | 87 help=('Test environment to run in. Must be one of: %s' % |
88 ', '.join(constants.VALID_ENVIRONMENTS))) | 88 ', '.join(constants.VALID_ENVIRONMENTS))) |
89 group.add_option('--adb-path', | |
90 help=('Specify the absolute path of the adb binary that ' | |
91 'should be used.')) | |
89 option_parser.add_option_group(group) | 92 option_parser.add_option_group(group) |
90 | 93 |
91 | 94 |
92 def ProcessCommonOptions(options, error_func): | 95 def ProcessCommonOptions(options, error_func): |
93 """Processes and handles all common options.""" | 96 """Processes and handles all common options.""" |
94 run_tests_helper.SetLogLevel(options.verbose_count) | 97 run_tests_helper.SetLogLevel(options.verbose_count) |
95 constants.SetBuildType(options.build_type) | 98 constants.SetBuildType(options.build_type) |
96 if options.build_directory: | 99 if options.build_directory: |
97 constants.SetBuildDirectory(options.build_directory) | 100 constants.SetBuildDirectory(options.build_directory) |
101 if options.adb_path: | |
102 constants.SetAdbPath(options.adb_path) | |
103 # Some things such as Forwarder require ADB to be in the environment path. | |
jbudorick
2014/11/11 15:27:23
Where is this?
mikecase (-- gone --)
2014/11/11 17:56:41
Forwarder is used inside of base_test_runner.py (c
jbudorick
2014/11/11 18:04:03
I suppose I should have been specific. Where does
mikecase (-- gone --)
2014/11/11 19:36:01
Inside pylib/forwarder.py, inside Map() function,
| |
104 adb_dir = os.path.dirname(constants.GetAdbPath()) | |
105 if adb_dir and adb_dir not in os.environ['PATH'].split(os.pathsep): | |
jbudorick
2014/11/11 15:27:23
Also, what's up with this...?
mikecase (-- gone --)
2014/11/11 17:56:41
Not sure what you mean. Most of this is logic copi
jbudorick
2014/11/11 18:04:03
This was previously inside android_commands.py bec
mikecase (-- gone --)
2014/11/11 19:36:01
adb_interface.py no longer needs ADB to be in the
| |
106 os.environ['PATH'] = adb_dir + os.pathsep + os.environ['PATH'] | |
98 if options.environment not in constants.VALID_ENVIRONMENTS: | 107 if options.environment not in constants.VALID_ENVIRONMENTS: |
99 error_func('--environment must be one of: %s' % | 108 error_func('--environment must be one of: %s' % |
100 ', '.join(constants.VALID_ENVIRONMENTS)) | 109 ', '.join(constants.VALID_ENVIRONMENTS)) |
101 | 110 |
102 | 111 |
103 def AddDeviceOptions(option_parser): | 112 def AddDeviceOptions(option_parser): |
104 group = optparse.OptionGroup(option_parser, 'Device Options') | 113 group = optparse.OptionGroup(option_parser, 'Device Options') |
105 group.add_option('-c', dest='cleanup_test_files', | 114 group.add_option('-c', dest='cleanup_test_files', |
106 help='Cleanup test files on the device after run', | 115 help='Cleanup test files on the device after run', |
107 action='store_true') | 116 action='store_true') |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
979 | 988 |
980 def main(): | 989 def main(): |
981 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 990 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
982 option_parser = command_option_parser.CommandOptionParser( | 991 option_parser = command_option_parser.CommandOptionParser( |
983 commands_dict=VALID_COMMANDS) | 992 commands_dict=VALID_COMMANDS) |
984 return command_option_parser.ParseAndExecute(option_parser) | 993 return command_option_parser.ParseAndExecute(option_parser) |
985 | 994 |
986 | 995 |
987 if __name__ == '__main__': | 996 if __name__ == '__main__': |
988 sys.exit(main()) | 997 sys.exit(main()) |
OLD | NEW |