OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # chrome_tests.py | 6 # chrome_tests.py |
7 | 7 |
8 ''' Runs various chrome tests through valgrind_test.py.''' | 8 ''' Runs various chrome tests through valgrind_test.py.''' |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 self._options.build_dir = FindNewestDir(dirs) | 128 self._options.build_dir = FindNewestDir(dirs) |
129 | 129 |
130 cmd = list(self._command_preamble) | 130 cmd = list(self._command_preamble) |
131 for directory in self._data_dirs: | 131 for directory in self._data_dirs: |
132 tool_name = self._options.valgrind_tool | 132 tool_name = self._options.valgrind_tool |
133 suppression_file = os.path.join(directory, | 133 suppression_file = os.path.join(directory, |
134 "%s/suppressions.txt" % tool_name) | 134 "%s/suppressions.txt" % tool_name) |
135 if os.path.exists(suppression_file): | 135 if os.path.exists(suppression_file): |
136 cmd.append("--suppressions=%s" % suppression_file) | 136 cmd.append("--suppressions=%s" % suppression_file) |
137 # Platform specific suppression | 137 # Platform specific suppression |
138 suppression_platform = common.PlatformName() | 138 for suppression_platform in common.PlatformNames(): |
139 suppression_file_platform = \ | 139 suppression_file_platform = \ |
140 os.path.join(directory, | 140 os.path.join(directory, |
141 '%s/suppressions_%s.txt' % (tool_name, suppression_platform)) | 141 '%s/suppressions_%s.txt' % (tool_name, suppression_platform)) |
142 if os.path.exists(suppression_file_platform): | 142 if os.path.exists(suppression_file_platform): |
143 cmd.append("--suppressions=%s" % suppression_file_platform) | 143 cmd.append("--suppressions=%s" % suppression_file_platform) |
144 | 144 |
145 cmd.append("--tool=%s" % self._options.valgrind_tool) | 145 cmd.append("--tool=%s" % self._options.valgrind_tool) |
146 if self._options.valgrind_tool_flags: | 146 if self._options.valgrind_tool_flags: |
147 cmd += self._options.valgrind_tool_flags.split(" ") | 147 cmd += self._options.valgrind_tool_flags.split(" ") |
148 if valgrind_test_args != None: | 148 if valgrind_test_args != None: |
149 for arg in valgrind_test_args: | 149 for arg in valgrind_test_args: |
150 cmd.append(arg) | 150 cmd.append(arg) |
151 if exe: | 151 if exe: |
152 if common.IsWine(): | 152 if common.IsWine(): |
153 cmd.append(os.environ.get('WINE')) | 153 cmd.append(os.environ.get('WINE')) |
(...skipping 10 matching lines...) Expand all Loading... |
164 ''' Runs the test specified by command-line argument --test ''' | 164 ''' Runs the test specified by command-line argument --test ''' |
165 logging.info("running test %s" % (self._test)) | 165 logging.info("running test %s" % (self._test)) |
166 return self._test_list[self._test]() | 166 return self._test_list[self._test]() |
167 | 167 |
168 def _ReadGtestFilterFile(self, name, cmd): | 168 def _ReadGtestFilterFile(self, name, cmd): |
169 '''Read a file which is a list of tests to filter out with --gtest_filter | 169 '''Read a file which is a list of tests to filter out with --gtest_filter |
170 and append the command-line option to cmd. | 170 and append the command-line option to cmd. |
171 ''' | 171 ''' |
172 filters = [] | 172 filters = [] |
173 for directory in self._data_dirs: | 173 for directory in self._data_dirs: |
174 platform_suffix = common.PlatformName() | |
175 gtest_filter_files = [ | 174 gtest_filter_files = [ |
176 os.path.join(directory, name + ".gtest.txt"), | 175 os.path.join(directory, name + ".gtest.txt"), |
177 os.path.join(directory, name + ".gtest-%s.txt" % \ | 176 os.path.join(directory, name + ".gtest-%s.txt" % \ |
178 self._options.valgrind_tool), | 177 self._options.valgrind_tool)] |
| 178 for platform_suffix in common.PlatformNames(): |
| 179 gtest_filter_files += [ |
179 os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), | 180 os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), |
180 os.path.join(directory, name + ".gtest-%s_%s.txt" % \ | 181 os.path.join(directory, name + ".gtest-%s_%s.txt" % \ |
181 (self._options.valgrind_tool, platform_suffix))] | 182 (self._options.valgrind_tool, platform_suffix))] |
182 for filename in gtest_filter_files: | 183 for filename in gtest_filter_files: |
183 if os.path.exists(filename): | 184 if os.path.exists(filename): |
184 logging.info("reading gtest filters from %s" % filename) | 185 logging.info("reading gtest filters from %s" % filename) |
185 f = open(filename, 'r') | 186 f = open(filename, 'r') |
186 for line in f.readlines(): | 187 for line in f.readlines(): |
187 if line.startswith("#") or line.startswith("//") or line.isspace(): | 188 if line.startswith("#") or line.startswith("//") or line.isspace(): |
188 continue | 189 continue |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 for t in options.test: | 413 for t in options.test: |
413 tests = ChromeTests(options, args, t) | 414 tests = ChromeTests(options, args, t) |
414 ret = tests.Run() | 415 ret = tests.Run() |
415 if ret: return ret | 416 if ret: return ret |
416 return 0 | 417 return 0 |
417 | 418 |
418 | 419 |
419 if __name__ == "__main__": | 420 if __name__ == "__main__": |
420 ret = _main(sys.argv) | 421 ret = _main(sys.argv) |
421 sys.exit(ret) | 422 sys.exit(ret) |
OLD | NEW |