OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
9 | 9 |
10 """Runs various WebRTC tests through valgrind_test.py. | 10 """Runs various WebRTC tests through valgrind_test.py. |
11 | 11 |
12 This script inherits the chrome_tests.py in Chrome, but allows running any test | 12 This script inherits the chrome_tests.py in Chrome, but allows running any test |
13 instead of only the hard-coded ones. It uses the -t cmdline flag to do this, and | 13 instead of only the hard-coded ones. It uses the -t cmdline flag to do this, and |
14 only supports specifying a single test for each run. | 14 only supports specifying a single test for each run. |
15 | 15 |
16 Suppression files: | 16 Suppression files: |
17 The Chrome valgrind directory we use as a DEPS dependency contains the following | 17 The Chrome valgrind directory we use as a DEPS dependency contains the following |
18 suppression files: | 18 suppression files: |
19 valgrind/memcheck/suppressions.txt | 19 valgrind/memcheck/suppressions.txt |
20 valgrind/memcheck/suppressions_mac.txt | 20 valgrind/memcheck/suppressions_mac.txt |
21 Since they're referenced from the chrome_tests.py script, we have similar files | 21 Since they're referenced from the chrome_tests.py script, we have similar files |
22 below the directory of this script. When executing, this script will setup both | 22 below the directory of this script. When executing, this script will setup both |
23 Chrome's suppression files and our own, so we can easily maintain WebRTC | 23 Chrome's suppression files and our own, so we can easily maintain WebRTC |
24 specific suppressions in our own files. | 24 specific suppressions in our own files. |
25 """ | 25 """ |
26 | 26 |
| 27 import argparse |
27 import logging | 28 import logging |
28 import optparse | 29 import optparse |
29 import os | 30 import os |
30 import sys | 31 import sys |
31 | 32 |
32 import logging_utils | 33 import logging_utils |
33 import path_utils | 34 import path_utils |
34 | 35 |
35 import chrome_tests | 36 import chrome_tests |
36 | 37 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 'developers/maintainers.\nPlease note that the <tool>' | 118 'developers/maintainers.\nPlease note that the <tool>' |
118 '.logs directory will be clobbered on tool startup.')) | 119 '.logs directory will be clobbered on tool startup.')) |
119 parser.add_option("--test-launcher-bot-mode", action="store_true", | 120 parser.add_option("--test-launcher-bot-mode", action="store_true", |
120 help="run the tests with --test-launcher-bot-mode") | 121 help="run the tests with --test-launcher-bot-mode") |
121 parser.add_option("--test-launcher-total-shards", type=int, | 122 parser.add_option("--test-launcher-total-shards", type=int, |
122 help="run the tests with --test-launcher-total-shards") | 123 help="run the tests with --test-launcher-total-shards") |
123 parser.add_option("--test-launcher-shard-index", type=int, | 124 parser.add_option("--test-launcher-shard-index", type=int, |
124 help="run the tests with --test-launcher-shard-index") | 125 help="run the tests with --test-launcher-shard-index") |
125 options, args = parser.parse_args() | 126 options, args = parser.parse_args() |
126 | 127 |
| 128 ignore_parser = argparse.ArgumentParser() |
| 129 # Ignore Chromium-specific flags |
| 130 # TODO(oprypin): Remove (bugs.webrtc.org/8115) |
| 131 ignore_parser.add_argument('--isolated-script-test-output', |
| 132 type=str, default=None) |
| 133 ignore_parser.add_argument('--isolated-script-test-chartjson-output', |
| 134 type=str, default=None) |
| 135 _, args = ignore_parser.parse_known_args(args) |
| 136 |
127 if options.verbose: | 137 if options.verbose: |
128 logging_utils.config_root(logging.DEBUG) | 138 logging_utils.config_root(logging.DEBUG) |
129 else: | 139 else: |
130 logging_utils.config_root() | 140 logging_utils.config_root() |
131 | 141 |
132 if not options.test: | 142 if not options.test: |
133 parser.error('--test not specified') | 143 parser.error('--test not specified') |
134 | 144 |
135 # Support build dir both with and without the target. | 145 # Support build dir both with and without the target. |
136 if (options.target and options.build_dir and | 146 if (options.target and options.build_dir and |
137 not options.build_dir.endswith(options.target)): | 147 not options.build_dir.endswith(options.target)): |
138 options.build_dir = os.path.join(options.build_dir, options.target) | 148 options.build_dir = os.path.join(options.build_dir, options.target) |
139 | 149 |
140 # If --build_dir is provided, prepend it to the test executable if needed. | 150 # If --build_dir is provided, prepend it to the test executable if needed. |
141 test_executable = options.test | 151 test_executable = options.test |
142 if options.build_dir and not test_executable.startswith(options.build_dir): | 152 if options.build_dir and not test_executable.startswith(options.build_dir): |
143 test_executable = os.path.join(options.build_dir, test_executable) | 153 test_executable = os.path.join(options.build_dir, test_executable) |
144 args = [test_executable] + args | 154 args = [test_executable] + args |
145 | 155 |
146 test = WebRTCTest(options.test, options, args, 'cmdline') | 156 test = WebRTCTest(options.test, options, args, 'cmdline') |
147 return test.Run() | 157 return test.Run() |
148 | 158 |
149 if __name__ == '__main__': | 159 if __name__ == '__main__': |
150 return_code = main(sys.argv) | 160 return_code = main(sys.argv) |
151 sys.exit(return_code) | 161 sys.exit(return_code) |
OLD | NEW |