OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 ''' Runs various chrome tests through valgrind_test.py.''' | 6 ''' Runs various chrome tests through valgrind_test.py.''' |
7 | 7 |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import multiprocessing | 10 import multiprocessing |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time | 141 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time |
142 # so we can find the slowpokes. | 142 # so we can find the slowpokes. |
143 cmd.append("--gtest_print_time") | 143 cmd.append("--gtest_print_time") |
144 # Built-in test launcher for gtest-based executables runs tests using | 144 # Built-in test launcher for gtest-based executables runs tests using |
145 # multiple process by default. Force the single-process mode back. | 145 # multiple process by default. Force the single-process mode back. |
146 cmd.append("--single-process-tests") | 146 cmd.append("--single-process-tests") |
147 if self._options.gtest_repeat: | 147 if self._options.gtest_repeat: |
148 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat) | 148 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat) |
149 if self._options.gtest_shuffle: | 149 if self._options.gtest_shuffle: |
150 cmd.append("--gtest_shuffle") | 150 cmd.append("--gtest_shuffle") |
| 151 if self._options.gtest_break_on_failure: |
| 152 cmd.append("--gtest_break_on_failure") |
151 if self._options.brave_new_test_launcher: | 153 if self._options.brave_new_test_launcher: |
152 cmd.append("--brave-new-test-launcher") | 154 cmd.append("--brave-new-test-launcher") |
153 if self._options.test_launcher_bot_mode: | 155 if self._options.test_launcher_bot_mode: |
154 cmd.append("--test-launcher-bot-mode") | 156 cmd.append("--test-launcher-bot-mode") |
155 return cmd | 157 return cmd |
156 | 158 |
157 def Run(self): | 159 def Run(self): |
158 ''' Runs the test specified by command-line argument --test ''' | 160 ''' Runs the test specified by command-line argument --test ''' |
159 logging.info("running test %s" % (self._test)) | 161 logging.info("running test %s" % (self._test)) |
160 return self._test_list[self._test](self) | 162 return self._test_list[self._test](self) |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 parser.add_option("-t", "--test", action="append", default=[], | 732 parser.add_option("-t", "--test", action="append", default=[], |
731 help="which test to run, supports test:gtest_filter format " | 733 help="which test to run, supports test:gtest_filter format " |
732 "as well.") | 734 "as well.") |
733 parser.add_option("--baseline", action="store_true", default=False, | 735 parser.add_option("--baseline", action="store_true", default=False, |
734 help="generate baseline data instead of validating") | 736 help="generate baseline data instead of validating") |
735 parser.add_option("--gtest_filter", | 737 parser.add_option("--gtest_filter", |
736 help="additional arguments to --gtest_filter") | 738 help="additional arguments to --gtest_filter") |
737 parser.add_option("--gtest_repeat", help="argument for --gtest_repeat") | 739 parser.add_option("--gtest_repeat", help="argument for --gtest_repeat") |
738 parser.add_option("--gtest_shuffle", action="store_true", default=False, | 740 parser.add_option("--gtest_shuffle", action="store_true", default=False, |
739 help="Randomize tests' orders on every iteration.") | 741 help="Randomize tests' orders on every iteration.") |
| 742 parser.add_option("--gtest_break_on_failure", action="store_true", |
| 743 default=False, |
| 744 help="Drop in to debugger on assertion failure. Also " |
| 745 "useful for forcing tests to exit with a stack dump " |
| 746 "on the first assertion failure when running with " |
| 747 "--gtest_repeat=-1") |
740 parser.add_option("-v", "--verbose", action="store_true", default=False, | 748 parser.add_option("-v", "--verbose", action="store_true", default=False, |
741 help="verbose output - enable debug log messages") | 749 help="verbose output - enable debug log messages") |
742 parser.add_option("--tool", dest="valgrind_tool", default="memcheck", | 750 parser.add_option("--tool", dest="valgrind_tool", default="memcheck", |
743 help="specify a valgrind tool to run the tests under") | 751 help="specify a valgrind tool to run the tests under") |
744 parser.add_option("--tool_flags", dest="valgrind_tool_flags", default="", | 752 parser.add_option("--tool_flags", dest="valgrind_tool_flags", default="", |
745 help="specify custom flags for the selected valgrind tool") | 753 help="specify custom flags for the selected valgrind tool") |
746 parser.add_option("--keep_logs", action="store_true", default=False, | 754 parser.add_option("--keep_logs", action="store_true", default=False, |
747 help="store memory tool logs in the <tool>.logs directory " | 755 help="store memory tool logs in the <tool>.logs directory " |
748 "instead of /tmp.\nThis can be useful for tool " | 756 "instead of /tmp.\nThis can be useful for tool " |
749 "developers/maintainers.\nPlease note that the <tool>" | 757 "developers/maintainers.\nPlease note that the <tool>" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 793 |
786 for t in options.test: | 794 for t in options.test: |
787 tests = ChromeTests(options, args, t) | 795 tests = ChromeTests(options, args, t) |
788 ret = tests.Run() | 796 ret = tests.Run() |
789 if ret: return ret | 797 if ret: return ret |
790 return 0 | 798 return 0 |
791 | 799 |
792 | 800 |
793 if __name__ == "__main__": | 801 if __name__ == "__main__": |
794 sys.exit(_main()) | 802 sys.exit(_main()) |
OLD | NEW |