OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 cmd.append("--suppressions=%s" % suppression_file) | 95 cmd.append("--suppressions=%s" % suppression_file) |
96 # Platform-specific suppression | 96 # Platform-specific suppression |
97 for platform in common.PlatformNames(): | 97 for platform in common.PlatformNames(): |
98 platform_suppression_file = \ | 98 platform_suppression_file = \ |
99 os.path.join(script_dir, tool_name, 'suppressions_%s.txt' % platform) | 99 os.path.join(script_dir, tool_name, 'suppressions_%s.txt' % platform) |
100 if os.path.exists(platform_suppression_file): | 100 if os.path.exists(platform_suppression_file): |
101 cmd.append("--suppressions=%s" % platform_suppression_file) | 101 cmd.append("--suppressions=%s" % platform_suppression_file) |
102 | 102 |
103 if self._options.valgrind_tool_flags: | 103 if self._options.valgrind_tool_flags: |
104 cmd += self._options.valgrind_tool_flags.split(" ") | 104 cmd += self._options.valgrind_tool_flags.split(" ") |
| 105 if self._options.keep_logs: |
| 106 cmd += ["--keep_logs"] |
105 if valgrind_test_args != None: | 107 if valgrind_test_args != None: |
106 for arg in valgrind_test_args: | 108 for arg in valgrind_test_args: |
107 cmd.append(arg) | 109 cmd.append(arg) |
108 if exe: | 110 if exe: |
109 self._EnsureBuildDirFound() | 111 self._EnsureBuildDirFound() |
110 cmd.append(os.path.join(self._options.build_dir, exe)) | 112 cmd.append(os.path.join(self._options.build_dir, exe)) |
111 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time | 113 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time |
112 # so we can find the slowpokes. | 114 # so we can find the slowpokes. |
113 cmd.append("--gtest_print_time") | 115 cmd.append("--gtest_print_time") |
114 if self._options.gtest_repeat: | 116 if self._options.gtest_repeat: |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 parser.add_option("", "--gtest_filter", | 461 parser.add_option("", "--gtest_filter", |
460 help="additional arguments to --gtest_filter") | 462 help="additional arguments to --gtest_filter") |
461 parser.add_option("", "--gtest_repeat", | 463 parser.add_option("", "--gtest_repeat", |
462 help="argument for --gtest_repeat") | 464 help="argument for --gtest_repeat") |
463 parser.add_option("-v", "--verbose", action="store_true", default=False, | 465 parser.add_option("-v", "--verbose", action="store_true", default=False, |
464 help="verbose output - enable debug log messages") | 466 help="verbose output - enable debug log messages") |
465 parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", | 467 parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", |
466 help="specify a valgrind tool to run the tests under") | 468 help="specify a valgrind tool to run the tests under") |
467 parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", | 469 parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", |
468 help="specify custom flags for the selected valgrind tool") | 470 help="specify custom flags for the selected valgrind tool") |
| 471 parser.add_option("", "--keep_logs", action="store_true", default=False, |
| 472 help="store memory tool logs in the <tool>.logs directory " |
| 473 "instead of /tmp.\nThis can be useful for tool " |
| 474 "developers/maintainers.\nPlease note that the <tool>" |
| 475 ".logs directory will be clobbered on tool startup.") |
469 # My machine can do about 120 layout tests/hour in release mode. | 476 # My machine can do about 120 layout tests/hour in release mode. |
470 # Let's do 30 minutes worth per run. | 477 # Let's do 30 minutes worth per run. |
471 # The CPU is mostly idle, so perhaps we can raise this when | 478 # The CPU is mostly idle, so perhaps we can raise this when |
472 # we figure out how to run them more efficiently. | 479 # we figure out how to run them more efficiently. |
473 parser.add_option("-n", "--num_tests", default=60, type="int", | 480 parser.add_option("-n", "--num_tests", default=60, type="int", |
474 help="for layout tests: # of subtests per run. 0 for all.") | 481 help="for layout tests: # of subtests per run. 0 for all.") |
475 | 482 |
476 options, args = parser.parse_args() | 483 options, args = parser.parse_args() |
477 | 484 |
478 if options.verbose: | 485 if options.verbose: |
(...skipping 10 matching lines...) Expand all Loading... |
489 for t in options.test: | 496 for t in options.test: |
490 tests = ChromeTests(options, args, t) | 497 tests = ChromeTests(options, args, t) |
491 ret = tests.Run() | 498 ret = tests.Run() |
492 if ret: return ret | 499 if ret: return ret |
493 return 0 | 500 return 0 |
494 | 501 |
495 | 502 |
496 if __name__ == "__main__": | 503 if __name__ == "__main__": |
497 ret = _main(sys.argv) | 504 ret = _main(sys.argv) |
498 sys.exit(ret) | 505 sys.exit(ret) |
OLD | NEW |