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 | |
28 import logging | 27 import logging |
29 import optparse | 28 import optparse |
30 import os | 29 import os |
31 import sys | 30 import sys |
32 | 31 |
33 import logging_utils | 32 import logging_utils |
34 import path_utils | 33 import path_utils |
35 | 34 |
36 import chrome_tests | 35 import chrome_tests |
37 | 36 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 'developers/maintainers.\nPlease note that the <tool>' | 117 'developers/maintainers.\nPlease note that the <tool>' |
119 '.logs directory will be clobbered on tool startup.')) | 118 '.logs directory will be clobbered on tool startup.')) |
120 parser.add_option("--test-launcher-bot-mode", action="store_true", | 119 parser.add_option("--test-launcher-bot-mode", action="store_true", |
121 help="run the tests with --test-launcher-bot-mode") | 120 help="run the tests with --test-launcher-bot-mode") |
122 parser.add_option("--test-launcher-total-shards", type=int, | 121 parser.add_option("--test-launcher-total-shards", type=int, |
123 help="run the tests with --test-launcher-total-shards") | 122 help="run the tests with --test-launcher-total-shards") |
124 parser.add_option("--test-launcher-shard-index", type=int, | 123 parser.add_option("--test-launcher-shard-index", type=int, |
125 help="run the tests with --test-launcher-shard-index") | 124 help="run the tests with --test-launcher-shard-index") |
126 options, args = parser.parse_args() | 125 options, args = parser.parse_args() |
127 | 126 |
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 | |
137 if options.verbose: | 127 if options.verbose: |
138 logging_utils.config_root(logging.DEBUG) | 128 logging_utils.config_root(logging.DEBUG) |
139 else: | 129 else: |
140 logging_utils.config_root() | 130 logging_utils.config_root() |
141 | 131 |
142 if not options.test: | 132 if not options.test: |
143 parser.error('--test not specified') | 133 parser.error('--test not specified') |
144 | 134 |
145 # Support build dir both with and without the target. | 135 # Support build dir both with and without the target. |
146 if (options.target and options.build_dir and | 136 if (options.target and options.build_dir and |
147 not options.build_dir.endswith(options.target)): | 137 not options.build_dir.endswith(options.target)): |
148 options.build_dir = os.path.join(options.build_dir, options.target) | 138 options.build_dir = os.path.join(options.build_dir, options.target) |
149 | 139 |
150 # If --build_dir is provided, prepend it to the test executable if needed. | 140 # If --build_dir is provided, prepend it to the test executable if needed. |
151 test_executable = options.test | 141 test_executable = options.test |
152 if options.build_dir and not test_executable.startswith(options.build_dir): | 142 if options.build_dir and not test_executable.startswith(options.build_dir): |
153 test_executable = os.path.join(options.build_dir, test_executable) | 143 test_executable = os.path.join(options.build_dir, test_executable) |
154 args = [test_executable] + args | 144 args = [test_executable] + args |
155 | 145 |
156 test = WebRTCTest(options.test, options, args, 'cmdline') | 146 test = WebRTCTest(options.test, options, args, 'cmdline') |
157 return test.Run() | 147 return test.Run() |
158 | 148 |
159 if __name__ == '__main__': | 149 if __name__ == '__main__': |
160 return_code = main(sys.argv) | 150 return_code = main(sys.argv) |
161 sys.exit(return_code) | 151 sys.exit(return_code) |
OLD | NEW |