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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 group = optparse.OptionGroup(option_parser, 'Common Options') | 50 group = optparse.OptionGroup(option_parser, 'Common Options') |
51 default_build_type = os.environ.get('BUILDTYPE', 'Debug') | 51 default_build_type = os.environ.get('BUILDTYPE', 'Debug') |
52 group.add_option('--debug', action='store_const', const='Debug', | 52 group.add_option('--debug', action='store_const', const='Debug', |
53 dest='build_type', default=default_build_type, | 53 dest='build_type', default=default_build_type, |
54 help=('If set, run test suites under out/Debug. ' | 54 help=('If set, run test suites under out/Debug. ' |
55 'Default is env var BUILDTYPE or Debug.')) | 55 'Default is env var BUILDTYPE or Debug.')) |
56 group.add_option('--release', action='store_const', | 56 group.add_option('--release', action='store_const', |
57 const='Release', dest='build_type', | 57 const='Release', dest='build_type', |
58 help=('If set, run test suites under out/Release.' | 58 help=('If set, run test suites under out/Release.' |
59 ' Default is env var BUILDTYPE or Debug.')) | 59 ' Default is env var BUILDTYPE or Debug.')) |
| 60 group.add_option('--build-directory', dest='build_directory', |
| 61 help=('Path to the directory in which build files are' |
| 62 ' located (should not include build type)')) |
60 group.add_option('-c', dest='cleanup_test_files', | 63 group.add_option('-c', dest='cleanup_test_files', |
61 help='Cleanup test files on the device after run', | 64 help='Cleanup test files on the device after run', |
62 action='store_true') | 65 action='store_true') |
63 group.add_option('--num_retries', dest='num_retries', type='int', | 66 group.add_option('--num_retries', dest='num_retries', type='int', |
64 default=2, | 67 default=2, |
65 help=('Number of retries for a test before ' | 68 help=('Number of retries for a test before ' |
66 'giving up.')) | 69 'giving up.')) |
67 group.add_option('-v', | 70 group.add_option('-v', |
68 '--verbose', | 71 '--verbose', |
69 dest='verbose_count', | 72 dest='verbose_count', |
(...skipping 16 matching lines...) Expand all Loading... |
86 group.add_option('-d', '--device', dest='test_device', | 89 group.add_option('-d', '--device', dest='test_device', |
87 help=('Target device for the test suite ' | 90 help=('Target device for the test suite ' |
88 'to run on.')) | 91 'to run on.')) |
89 option_parser.add_option_group(group) | 92 option_parser.add_option_group(group) |
90 | 93 |
91 | 94 |
92 def ProcessCommonOptions(options): | 95 def ProcessCommonOptions(options): |
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) |
| 99 if options.build_directory: |
| 100 constants.SetBuildDirectory(options.build_directory) |
96 | 101 |
97 | 102 |
98 def AddGTestOptions(option_parser): | 103 def AddGTestOptions(option_parser): |
99 """Adds gtest options to |option_parser|.""" | 104 """Adds gtest options to |option_parser|.""" |
100 | 105 |
101 option_parser.usage = '%prog gtest [options]' | 106 option_parser.usage = '%prog gtest [options]' |
102 option_parser.commands_dict = {} | 107 option_parser.commands_dict = {} |
103 option_parser.example = '%prog gtest -s base_unittests' | 108 option_parser.example = '%prog gtest -s base_unittests' |
104 | 109 |
105 # TODO(gkanwar): Make this option required | 110 # TODO(gkanwar): Make this option required |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 885 |
881 def main(): | 886 def main(): |
882 signal.signal(signal.SIGUSR1, DumpThreadStacks) | 887 signal.signal(signal.SIGUSR1, DumpThreadStacks) |
883 option_parser = command_option_parser.CommandOptionParser( | 888 option_parser = command_option_parser.CommandOptionParser( |
884 commands_dict=VALID_COMMANDS) | 889 commands_dict=VALID_COMMANDS) |
885 return command_option_parser.ParseAndExecute(option_parser) | 890 return command_option_parser.ParseAndExecute(option_parser) |
886 | 891 |
887 | 892 |
888 if __name__ == '__main__': | 893 if __name__ == '__main__': |
889 sys.exit(main()) | 894 sys.exit(main()) |
OLD | NEW |