OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Runs an exe through Valgrind and puts the intermediate files in a | 5 """Runs an exe through Valgrind and puts the intermediate files in a |
6 directory. | 6 directory. |
7 """ | 7 """ |
8 | 8 |
9 import datetime | 9 import datetime |
10 import glob | 10 import glob |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 self.option_parser_hooks.append(hook) | 58 self.option_parser_hooks.append(hook) |
59 | 59 |
60 def CreateOptionParser(self): | 60 def CreateOptionParser(self): |
61 # Defines Chromium-specific flags. | 61 # Defines Chromium-specific flags. |
62 self._parser = optparse.OptionParser("usage: %prog [options] <program to " | 62 self._parser = optparse.OptionParser("usage: %prog [options] <program to " |
63 "test>") | 63 "test>") |
64 self._parser.disable_interspersed_args() | 64 self._parser.disable_interspersed_args() |
65 self._parser.add_option("-t", "--timeout", | 65 self._parser.add_option("-t", "--timeout", |
66 dest="timeout", metavar="TIMEOUT", default=10000, | 66 dest="timeout", metavar="TIMEOUT", default=10000, |
67 help="timeout in seconds for the run (default 10000)") | 67 help="timeout in seconds for the run (default 10000)") |
| 68 self._parser.add_option("", "--build_dir", |
| 69 help="the location of the compiler output") |
68 self._parser.add_option("", "--source_dir", | 70 self._parser.add_option("", "--source_dir", |
69 help="path to top of source tree for this build" | 71 help="path to top of source tree for this build" |
70 "(used to normalize source paths in baseline)") | 72 "(used to normalize source paths in baseline)") |
71 self._parser.add_option("", "--gtest_filter", default="", | 73 self._parser.add_option("", "--gtest_filter", default="", |
72 help="which test case to run") | 74 help="which test case to run") |
73 self._parser.add_option("", "--gtest_repeat", | 75 self._parser.add_option("", "--gtest_repeat", |
74 help="how many times to run each test") | 76 help="how many times to run each test") |
75 self._parser.add_option("", "--gtest_print_time", action="store_true", | 77 self._parser.add_option("", "--gtest_print_time", action="store_true", |
76 default=False, | 78 default=False, |
77 help="show how long each test takes") | 79 help="show how long each test takes") |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] | 840 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] |
839 | 841 |
840 # Un-comment to debug Dr.Memory | 842 # Un-comment to debug Dr.Memory |
841 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] | 843 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] |
842 | 844 |
843 if self._options.use_debug: | 845 if self._options.use_debug: |
844 proc += ["-debug"] | 846 proc += ["-debug"] |
845 | 847 |
846 proc += ["-logdir", common.NormalizeWindowsPath(self.log_dir)] | 848 proc += ["-logdir", common.NormalizeWindowsPath(self.log_dir)] |
847 | 849 |
| 850 if self._options.build_dir: |
| 851 # The other case is only possible with -t cmdline. |
| 852 # Anyways, if we omit -symcache_dir the -logdir's value is used which |
| 853 # should be fine. |
| 854 symcache_dir = os.path.join(self._options.build_dir, "drmemory.symcache") |
| 855 if not os.path.exists(symcache_dir): |
| 856 try: |
| 857 os.mkdir(symcache_dir) |
| 858 except OSError: |
| 859 logging.warning("Can't create symcache dir?") |
| 860 if os.path.exists(symcache_dir): |
| 861 proc += ["-symcache_dir", symcache_dir] |
| 862 |
848 # Use -no_summary to suppress DrMemory's summary and init-time | 863 # Use -no_summary to suppress DrMemory's summary and init-time |
849 # notifications. We generate our own with drmemory_analyze.py. | 864 # notifications. We generate our own with drmemory_analyze.py. |
850 proc += ["-batch", "-no_summary"] | 865 proc += ["-batch", "-no_summary"] |
851 | 866 |
852 # Un-comment to disable interleaved output. Will also suppress error | 867 # Un-comment to disable interleaved output. Will also suppress error |
853 # messages normally printed to stderr. | 868 # messages normally printed to stderr. |
854 #proc += ["-quiet", "-no_results_to_stderr"] | 869 #proc += ["-quiet", "-no_results_to_stderr"] |
855 | 870 |
856 proc += ["-callstack_max_frames", "40"] | 871 proc += ["-callstack_max_frames", "40"] |
857 | 872 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 return Asan() | 1192 return Asan() |
1178 try: | 1193 try: |
1179 platform_name = common.PlatformNames()[0] | 1194 platform_name = common.PlatformNames()[0] |
1180 except common.NotImplementedError: | 1195 except common.NotImplementedError: |
1181 platform_name = sys.platform + "(Unknown)" | 1196 platform_name = sys.platform + "(Unknown)" |
1182 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1197 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
1183 platform_name) | 1198 platform_name) |
1184 | 1199 |
1185 def CreateTool(tool): | 1200 def CreateTool(tool): |
1186 return ToolFactory().Create(tool) | 1201 return ToolFactory().Create(tool) |
OLD | NEW |