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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 dest='build_type', default=default_build_type, | 57 dest='build_type', default=default_build_type, |
58 help=('If set, run test suites under out/Debug. ' | 58 help=('If set, run test suites under out/Debug. ' |
59 'Default is env var BUILDTYPE or Debug.')) | 59 'Default is env var BUILDTYPE or Debug.')) |
60 group.add_option('--release', action='store_const', | 60 group.add_option('--release', action='store_const', |
61 const='Release', dest='build_type', | 61 const='Release', dest='build_type', |
62 help=('If set, run test suites under out/Release.' | 62 help=('If set, run test suites under out/Release.' |
63 ' Default is env var BUILDTYPE or Debug.')) | 63 ' Default is env var BUILDTYPE or Debug.')) |
64 group.add_option('--build-directory', dest='build_directory', | 64 group.add_option('--build-directory', dest='build_directory', |
65 help=('Path to the directory in which build files are' | 65 help=('Path to the directory in which build files are' |
66 ' located (should not include build type)')) | 66 ' located (should not include build type)')) |
| 67 group.add_option('--output-directory', dest='output_directory', |
| 68 help=('Path to the directory in which build files are' |
| 69 ' located (must include build type). This will take' |
| 70 ' precedence over --debug, --release and' |
| 71 ' --build-directory')) |
67 group.add_option('--num_retries', dest='num_retries', type='int', | 72 group.add_option('--num_retries', dest='num_retries', type='int', |
68 default=2, | 73 default=2, |
69 help=('Number of retries for a test before ' | 74 help=('Number of retries for a test before ' |
70 'giving up.')) | 75 'giving up.')) |
71 group.add_option('-v', | 76 group.add_option('-v', |
72 '--verbose', | 77 '--verbose', |
73 dest='verbose_count', | 78 dest='verbose_count', |
74 default=0, | 79 default=0, |
75 action='count', | 80 action='count', |
76 help='Verbose level (multiple times for more)') | 81 help='Verbose level (multiple times for more)') |
(...skipping 11 matching lines...) Expand all Loading... |
88 ', '.join(constants.VALID_ENVIRONMENTS))) | 93 ', '.join(constants.VALID_ENVIRONMENTS))) |
89 option_parser.add_option_group(group) | 94 option_parser.add_option_group(group) |
90 | 95 |
91 | 96 |
92 def ProcessCommonOptions(options, error_func): | 97 def ProcessCommonOptions(options, error_func): |
93 """Processes and handles all common options.""" | 98 """Processes and handles all common options.""" |
94 run_tests_helper.SetLogLevel(options.verbose_count) | 99 run_tests_helper.SetLogLevel(options.verbose_count) |
95 constants.SetBuildType(options.build_type) | 100 constants.SetBuildType(options.build_type) |
96 if options.build_directory: | 101 if options.build_directory: |
97 constants.SetBuildDirectory(options.build_directory) | 102 constants.SetBuildDirectory(options.build_directory) |
| 103 if options.output_directory: |
| 104 constants.SetOutputDirectort(options.output_directory) |
98 if options.environment not in constants.VALID_ENVIRONMENTS: | 105 if options.environment not in constants.VALID_ENVIRONMENTS: |
99 error_func('--environment must be one of: %s' % | 106 error_func('--environment must be one of: %s' % |
100 ', '.join(constants.VALID_ENVIRONMENTS)) | 107 ', '.join(constants.VALID_ENVIRONMENTS)) |
101 | 108 |
102 | 109 |
103 def AddDeviceOptions(option_parser): | 110 def AddDeviceOptions(option_parser): |
104 group = optparse.OptionGroup(option_parser, 'Device Options') | 111 group = optparse.OptionGroup(option_parser, 'Device Options') |
105 group.add_option('-c', dest='cleanup_test_files', | 112 group.add_option('-c', dest='cleanup_test_files', |
106 help='Cleanup test files on the device after run', | 113 help='Cleanup test files on the device after run', |
107 action='store_true') | 114 action='store_true') |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 | 986 |
980 def main(): | 987 def main(): |
981 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 988 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
982 option_parser = command_option_parser.CommandOptionParser( | 989 option_parser = command_option_parser.CommandOptionParser( |
983 commands_dict=VALID_COMMANDS) | 990 commands_dict=VALID_COMMANDS) |
984 return command_option_parser.ParseAndExecute(option_parser) | 991 return command_option_parser.ParseAndExecute(option_parser) |
985 | 992 |
986 | 993 |
987 if __name__ == '__main__': | 994 if __name__ == '__main__': |
988 sys.exit(main()) | 995 sys.exit(main()) |
OLD | NEW |