| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 cmd.append("--gtest_print_time") | 146 cmd.append("--gtest_print_time") |
| 147 # Built-in test launcher for gtest-based executables runs tests using | 147 # Built-in test launcher for gtest-based executables runs tests using |
| 148 # multiple process by default. Force the single-process mode back. | 148 # multiple process by default. Force the single-process mode back. |
| 149 cmd.append("--single-process-tests") | 149 cmd.append("--single-process-tests") |
| 150 if self._options.gtest_repeat: | 150 if self._options.gtest_repeat: |
| 151 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat) | 151 cmd.append("--gtest_repeat=%s" % self._options.gtest_repeat) |
| 152 if self._options.gtest_shuffle: | 152 if self._options.gtest_shuffle: |
| 153 cmd.append("--gtest_shuffle") | 153 cmd.append("--gtest_shuffle") |
| 154 if self._options.gtest_break_on_failure: | 154 if self._options.gtest_break_on_failure: |
| 155 cmd.append("--gtest_break_on_failure") | 155 cmd.append("--gtest_break_on_failure") |
| 156 if self._options.brave_new_test_launcher: | |
| 157 cmd.append("--brave-new-test-launcher") | |
| 158 if self._options.test_launcher_bot_mode: | 156 if self._options.test_launcher_bot_mode: |
| 159 cmd.append("--test-launcher-bot-mode") | 157 cmd.append("--test-launcher-bot-mode") |
| 158 if self._options.test_launcher_total_shards is not None: |
| 159 cmd.append("--test-launcher-total-shards=%d" % self._options.test_launcher
_total_shards) |
| 160 if self._options.test_launcher_shard_index is not None: |
| 161 cmd.append("--test-launcher-shard-index=%d" % self._options.test_launcher_
shard_index) |
| 160 return cmd | 162 return cmd |
| 161 | 163 |
| 162 def Run(self): | 164 def Run(self): |
| 163 ''' Runs the test specified by command-line argument --test ''' | 165 ''' Runs the test specified by command-line argument --test ''' |
| 164 logging.info("running test %s" % (self._test)) | 166 logging.info("running test %s" % (self._test)) |
| 165 return self._test_list[self._test](self) | 167 return self._test_list[self._test](self) |
| 166 | 168 |
| 167 def _AppendGtestFilter(self, tool, name, cmd): | 169 def _AppendGtestFilter(self, tool, name, cmd): |
| 168 '''Append an appropriate --gtest_filter flag to the googletest binary | 170 '''Append an appropriate --gtest_filter flag to the googletest binary |
| 169 invocation. | 171 invocation. |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 parser.add_option("--tool_flags", dest="valgrind_tool_flags", default="", | 757 parser.add_option("--tool_flags", dest="valgrind_tool_flags", default="", |
| 756 help="specify custom flags for the selected valgrind tool") | 758 help="specify custom flags for the selected valgrind tool") |
| 757 parser.add_option("--keep_logs", action="store_true", default=False, | 759 parser.add_option("--keep_logs", action="store_true", default=False, |
| 758 help="store memory tool logs in the <tool>.logs directory " | 760 help="store memory tool logs in the <tool>.logs directory " |
| 759 "instead of /tmp.\nThis can be useful for tool " | 761 "instead of /tmp.\nThis can be useful for tool " |
| 760 "developers/maintainers.\nPlease note that the <tool>" | 762 "developers/maintainers.\nPlease note that the <tool>" |
| 761 ".logs directory will be clobbered on tool startup.") | 763 ".logs directory will be clobbered on tool startup.") |
| 762 parser.add_option("-n", "--num_tests", type="int", | 764 parser.add_option("-n", "--num_tests", type="int", |
| 763 default=ChromeTests.LAYOUT_TESTS_DEFAULT_CHUNK_SIZE, | 765 default=ChromeTests.LAYOUT_TESTS_DEFAULT_CHUNK_SIZE, |
| 764 help="for layout tests: # of subtests per run. 0 for all.") | 766 help="for layout tests: # of subtests per run. 0 for all.") |
| 765 # TODO(thestig) Remove this if we can. | |
| 766 parser.add_option("--gtest_color", dest="gtest_color", default="no", | |
| 767 help="dummy compatibility flag for sharding_supervisor.") | |
| 768 parser.add_option("--brave-new-test-launcher", action="store_true", | |
| 769 help="run the tests with --brave-new-test-launcher") | |
| 770 parser.add_option("--test-launcher-bot-mode", action="store_true", | 767 parser.add_option("--test-launcher-bot-mode", action="store_true", |
| 771 help="run the tests with --test-launcher-bot-mode") | 768 help="run the tests with --test-launcher-bot-mode") |
| 769 parser.add_option("--test-launcher-total-shards", type=int, |
| 770 help="run the tests with --test-launcher-total-shards") |
| 771 parser.add_option("--test-launcher-shard-index", type=int, |
| 772 help="run the tests with --test-launcher-shard-index") |
| 772 | 773 |
| 773 options, args = parser.parse_args() | 774 options, args = parser.parse_args() |
| 774 | 775 |
| 775 # Bake target into build_dir. | 776 # Bake target into build_dir. |
| 776 if options.target and options.build_dir: | 777 if options.target and options.build_dir: |
| 777 assert (options.target != | 778 assert (options.target != |
| 778 os.path.basename(os.path.dirname(options.build_dir))) | 779 os.path.basename(os.path.dirname(options.build_dir))) |
| 779 options.build_dir = os.path.join(os.path.abspath(options.build_dir), | 780 options.build_dir = os.path.join(os.path.abspath(options.build_dir), |
| 780 options.target) | 781 options.target) |
| 781 | 782 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 796 | 797 |
| 797 for t in options.test: | 798 for t in options.test: |
| 798 tests = ChromeTests(options, args, t) | 799 tests = ChromeTests(options, args, t) |
| 799 ret = tests.Run() | 800 ret = tests.Run() |
| 800 if ret: return ret | 801 if ret: return ret |
| 801 return 0 | 802 return 0 |
| 802 | 803 |
| 803 | 804 |
| 804 if __name__ == "__main__": | 805 if __name__ == "__main__": |
| 805 sys.exit(_main()) | 806 sys.exit(_main()) |
| OLD | NEW |