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 This file is a copy of ../purify/chrome_tests.py. Eventually, it would be nice | 10 This file is a copy of ../purify/chrome_tests.py. Eventually, it would be nice |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 ''' Runs the test specified by command-line argument --test ''' | 181 ''' Runs the test specified by command-line argument --test ''' |
182 logging.info("running test %s" % (self._test)) | 182 logging.info("running test %s" % (self._test)) |
183 return self._test_list[self._test]() | 183 return self._test_list[self._test]() |
184 | 184 |
185 def _ReadGtestFilterFile(self, name, cmd): | 185 def _ReadGtestFilterFile(self, name, cmd): |
186 '''Read a file which is a list of tests to filter out with --gtest_filter | 186 '''Read a file which is a list of tests to filter out with --gtest_filter |
187 and append the command-line option to cmd. | 187 and append the command-line option to cmd. |
188 ''' | 188 ''' |
189 filters = [] | 189 filters = [] |
190 for directory in self._data_dirs: | 190 for directory in self._data_dirs: |
191 filename = os.path.join(directory, name + ".gtest.txt") | 191 platform_suffix = {'darwin': 'mac', |
192 if os.path.exists(filename): | 192 'linux2': 'linux'}[sys.platform] |
193 logging.info("reading gtest filters from %s" % filename) | 193 gtest_filter_files = [ |
194 f = open(filename, 'r') | 194 os.path.join(directory, name + ".gtest.txt"), |
195 for line in f.readlines(): | 195 os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix)] |
196 if line.startswith("#") or line.startswith("//") or line.isspace(): | 196 for filename in gtest_filter_files: |
197 continue | 197 if os.path.exists(filename): |
198 line = line.rstrip() | 198 logging.info("reading gtest filters from %s" % filename) |
199 filters.append(line) | 199 f = open(filename, 'r') |
| 200 for line in f.readlines(): |
| 201 if line.startswith("#") or line.startswith("//") or line.isspace(): |
| 202 continue |
| 203 line = line.rstrip() |
| 204 filters.append(line) |
200 gtest_filter = self._options.gtest_filter | 205 gtest_filter = self._options.gtest_filter |
201 if len(filters): | 206 if len(filters): |
202 if gtest_filter: | 207 if gtest_filter: |
203 gtest_filter += ":" | 208 gtest_filter += ":" |
204 if gtest_filter.find("-") < 0: | 209 if gtest_filter.find("-") < 0: |
205 gtest_filter += "-" | 210 gtest_filter += "-" |
206 else: | 211 else: |
207 gtest_filter = "-" | 212 gtest_filter = "-" |
208 gtest_filter += ":".join(filters) | 213 gtest_filter += ":".join(filters) |
209 if gtest_filter: | 214 if gtest_filter: |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 for t in options.test: | 417 for t in options.test: |
413 tests = ChromeTests(options, args, t) | 418 tests = ChromeTests(options, args, t) |
414 ret = tests.Run() | 419 ret = tests.Run() |
415 if ret: return ret | 420 if ret: return ret |
416 return 0 | 421 return 0 |
417 | 422 |
418 | 423 |
419 if __name__ == "__main__": | 424 if __name__ == "__main__": |
420 ret = _main(sys.argv) | 425 ret = _main(sys.argv) |
421 sys.exit(ret) | 426 sys.exit(ret) |
OLD | NEW |