Chromium Code Reviews| 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 # valgrind_test.py | 6 # valgrind_test.py |
| 7 | 7 |
| 8 """Runs an exe through Valgrind and puts the intermediate files in a | 8 """Runs an exe through Valgrind and puts the intermediate files in a |
| 9 directory. | 9 directory. |
| 10 """ | 10 """ |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 | 705 |
| 706 def ExtendOptionParser(self, parser): | 706 def ExtendOptionParser(self, parser): |
| 707 parser.add_option("", "--suppressions", default=[], | 707 parser.add_option("", "--suppressions", default=[], |
| 708 action="append", | 708 action="append", |
| 709 help="path to a drmemory suppression file") | 709 help="path to a drmemory suppression file") |
| 710 parser.add_option("", "--follow_python", action="store_true", | 710 parser.add_option("", "--follow_python", action="store_true", |
| 711 default=False, dest="follow_python", | 711 default=False, dest="follow_python", |
| 712 help="Monitor python child processes. If off, neither " | 712 help="Monitor python child processes. If off, neither " |
| 713 "python children nor any children of python children " | 713 "python children nor any children of python children " |
| 714 "will be monitored.") | 714 "will be monitored.") |
| 715 parser._parser.add_option("", "--indirect", action="store_true", | 715 parser.add_option("", "--indirect", action="store_true", |
|
Timur Iskhodzhanov
2011/08/08 13:38:04
oops - this was copy-paste mistake
| |
| 716 default=False, | 716 default=False, |
| 717 help="set BROWSER_WRAPPER rather than " | 717 help="set BROWSER_WRAPPER rather than " |
| 718 "running Dr. Memory directly on the harness") | 718 "running Dr. Memory directly on the harness") |
| 719 parser.add_option("", "--use_debug", action="store_true", | 719 parser.add_option("", "--use_debug", action="store_true", |
| 720 default=False, dest="use_debug", | 720 default=False, dest="use_debug", |
| 721 help="Run Dr. Memory debug build") | 721 help="Run Dr. Memory debug build") |
| 722 # TODO(bruening): I want to add --extraops that can take extra | 722 parser.add_option("", "--trace_children", action="store_true", |
| 723 # args that are passed through to Dr. Memory, but the | 723 default=True, |
|
Timur Iskhodzhanov
2011/08/08 13:38:04
This is what --tool_flags was made for.
I've just
| |
| 724 # chrome_tests.bat and chrome_tests.py layers combined w/ | 724 help="TODO: default value differs from Valgrind") |
| 725 # chrome_tests.py parsing makes it not work out in practice. We | |
| 726 # should change chrome_tests.py to pass all unknown options | |
| 727 # through to valgrind_test.py so we don't need to use --tool_flags | |
|
Timur Iskhodzhanov
2011/08/08 13:38:04
re: to use --tool_flags or not to use
If one makes
| |
| 728 # and quote it, and ditto w/ valgrind_test.py passing unknown | |
| 729 # options through to its tool. | |
| 730 | 725 |
| 731 def ToolCommand(self): | 726 def ToolCommand(self): |
| 732 """Get the tool command to run.""" | 727 """Get the tool command to run.""" |
| 733 tool_name = self.ToolName() | 728 tool_name = self.ToolName() |
| 734 | 729 |
| 735 # WINHEAP is what Dr. Memory supports as there are issues w/ both | 730 # WINHEAP is what Dr. Memory supports as there are issues w/ both |
| 736 # jemalloc (http://code.google.com/p/drmemory/issues/detail?id=320) and | 731 # jemalloc (http://code.google.com/p/drmemory/issues/detail?id=320) and |
| 737 # tcmalloc (http://code.google.com/p/drmemory/issues/detail?id=314) | 732 # tcmalloc (http://code.google.com/p/drmemory/issues/detail?id=314) |
| 738 add_env = { | 733 add_env = { |
| 739 "CHROME_ALLOCATOR" : "WINHEAP", | 734 "CHROME_ALLOCATOR" : "WINHEAP", |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] | 793 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] |
| 799 | 794 |
| 800 if self._options.use_debug: | 795 if self._options.use_debug: |
| 801 proc += ["-debug"] | 796 proc += ["-debug"] |
| 802 | 797 |
| 803 proc += ["-logdir", self.log_dir] | 798 proc += ["-logdir", self.log_dir] |
| 804 proc += ["-batch", "-quiet"] | 799 proc += ["-batch", "-quiet"] |
| 805 | 800 |
| 806 # Increase some Dr. Memory constants | 801 # Increase some Dr. Memory constants |
| 807 proc += ["-redzone_size", "16"] | 802 proc += ["-redzone_size", "16"] |
| 808 proc += ["-callstack_max_frames", "30"] | 803 proc += ["-callstack_max_frames", "40"] |
| 809 | 804 |
| 810 # Un-comment to ignore uninitialized accesses | 805 # Un-comment to ignore uninitialized accesses |
| 811 #proc += ["-no_check_uninitialized"] | 806 #proc += ["-no_check_uninitialized"] |
| 812 | 807 |
| 813 # Un-comment to ignore leaks | 808 # Un-comment to ignore leaks |
| 814 #proc += ["-no_check_leaks", "-no_count_leaks"] | 809 #proc += ["-no_check_leaks", "-no_count_leaks"] |
| 815 | 810 |
| 811 proc += self._tool_flags | |
| 812 | |
| 816 # Dr.Memory requires -- to separate tool flags from the executable name. | 813 # Dr.Memory requires -- to separate tool flags from the executable name. |
| 817 proc += ["--"] | 814 proc += ["--"] |
| 818 | 815 |
| 819 if self._options.indirect: | 816 if self._options.indirect: |
| 820 self.CreateBrowserWrapper(" ".join(proc)) | 817 self.CreateBrowserWrapper(" ".join(proc)) |
| 821 proc = [] | 818 proc = [] |
| 822 | 819 |
| 823 # Note that self._args begins with the name of the exe to be run. | 820 # Note that self._args begins with the name of the exe to be run. |
| 824 proc += self._args | 821 proc += self._args |
| 825 return proc | 822 return proc |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 platform_name = sys.platform + "(Unknown)" | 979 platform_name = sys.platform + "(Unknown)" |
| 983 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 980 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
| 984 platform_name) | 981 platform_name) |
| 985 | 982 |
| 986 def CreateTool(tool): | 983 def CreateTool(tool): |
| 987 return ToolFactory().Create(tool) | 984 return ToolFactory().Create(tool) |
| 988 | 985 |
| 989 if __name__ == '__main__': | 986 if __name__ == '__main__': |
| 990 logging.error(sys.argv[0] + " can not be run from command line") | 987 logging.error(sys.argv[0] + " can not be run from command line") |
| 991 sys.exit(1) | 988 sys.exit(1) |
| OLD | NEW |