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 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout) | 791 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout) |
792 if drconfig_retcode: | 792 if drconfig_retcode: |
793 logging.error("Configuring whether to follow python children failed " \ | 793 logging.error("Configuring whether to follow python children failed " \ |
794 "with %d.", drconfig_retcode) | 794 "with %d.", drconfig_retcode) |
795 raise RuntimeError, "Configuring python children failed " | 795 raise RuntimeError, "Configuring python children failed " |
796 | 796 |
797 suppression_count = 0 | 797 suppression_count = 0 |
798 for suppression_file in self._options.suppressions: | 798 for suppression_file in self._options.suppressions: |
799 if os.path.exists(suppression_file): | 799 if os.path.exists(suppression_file): |
800 suppression_count += 1 | 800 suppression_count += 1 |
801 proc += ["-suppress", suppression_file] | 801 proc += ["-suppress", common.NormalizeWindowsPath(suppression_file)] |
802 | 802 |
803 if not suppression_count: | 803 if not suppression_count: |
804 logging.warning("WARNING: NOT USING SUPPRESSIONS!") | 804 logging.warning("WARNING: NOT USING SUPPRESSIONS!") |
805 | 805 |
806 # Un-comment to dump Dr.Memory events on error | 806 # Un-comment to dump Dr.Memory events on error |
807 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] | 807 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] |
808 | 808 |
809 # Un-comment to debug Dr.Memory | 809 # Un-comment to debug Dr.Memory |
810 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] | 810 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] |
811 | 811 |
812 if self._options.use_debug: | 812 if self._options.use_debug: |
813 proc += ["-debug"] | 813 proc += ["-debug"] |
814 | 814 |
815 proc += ["-logdir", self.log_dir] | 815 proc += ["-logdir", common.NormalizeWindowsPath(self.log_dir)] |
816 proc += ["-batch", "-quiet", "-no_results_to_stderr"] | 816 proc += ["-batch", "-quiet", "-no_results_to_stderr"] |
817 | 817 |
818 proc += ["-callstack_max_frames", "40"] | 818 proc += ["-callstack_max_frames", "40"] |
819 | 819 |
820 # make callstacks easier to read | 820 # make callstacks easier to read |
821 proc += ["-callstack_srcfile_prefix", | 821 proc += ["-callstack_srcfile_prefix", |
822 "build\\src,chromium\\src,crt_build\\self_x86"] | 822 "build\\src,chromium\\src,crt_build\\self_x86"] |
823 proc += ["-callstack_modname_hide", | 823 proc += ["-callstack_modname_hide", |
824 "*.exe,chrome.dll"] | 824 "*.exe,chrome.dll"] |
825 | 825 |
826 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False) | 826 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False) |
827 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .." | 827 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .." |
828 proc += ["-callstack_truncate_below", ",".join(boring_callers)] | 828 proc += ["-callstack_truncate_below", ",".join(boring_callers)] |
829 | 829 |
830 if not self.handle_uninits_and_leaks: | 830 if not self.handle_uninits_and_leaks: |
831 proc += ["-no_check_uninitialized", "-no_count_leaks"] | 831 proc += ["-no_check_uninitialized", "-no_count_leaks"] |
832 | 832 |
833 proc += self._tool_flags | 833 proc += self._tool_flags |
834 | 834 |
835 # Dr.Memory requires -- to separate tool flags from the executable name. | 835 # Dr.Memory requires -- to separate tool flags from the executable name. |
836 proc += ["--"] | 836 proc += ["--"] |
837 | 837 |
838 if self._options.indirect: | 838 if self._options.indirect: |
839 self.CreateBrowserWrapper(" ".join(proc)) | 839 self.CreateBrowserWrapper(" ".join(proc)) |
840 proc = [] | 840 proc = [] |
841 | 841 |
842 # Note that self._args begins with the name of the exe to be run. | 842 # Note that self._args begins with the name of the exe to be run. |
| 843 self._args[0] = common.NormalizeWindowsPath(self._args[0]) |
843 proc += self._args | 844 proc += self._args |
844 return proc | 845 return proc |
845 | 846 |
846 def CreateBrowserWrapper(self, command): | 847 def CreateBrowserWrapper(self, command): |
847 os.putenv("BROWSER_WRAPPER", command) | 848 os.putenv("BROWSER_WRAPPER", command) |
848 | 849 |
849 def Analyze(self, check_sanity=False): | 850 def Analyze(self, check_sanity=False): |
850 # Glob all the results files in the "testing.tmp" directory | 851 # Glob all the results files in the "testing.tmp" directory |
851 filenames = glob.glob(self.log_dir + "/*/results.txt") | 852 filenames = glob.glob(self.log_dir + "/*/results.txt") |
852 | 853 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 platform_name = sys.platform + "(Unknown)" | 1101 platform_name = sys.platform + "(Unknown)" |
1101 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1102 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
1102 platform_name) | 1103 platform_name) |
1103 | 1104 |
1104 def CreateTool(tool): | 1105 def CreateTool(tool): |
1105 return ToolFactory().Create(tool) | 1106 return ToolFactory().Create(tool) |
1106 | 1107 |
1107 if __name__ == '__main__': | 1108 if __name__ == '__main__': |
1108 logging.error(sys.argv[0] + " can not be run from command line") | 1109 logging.error(sys.argv[0] + " can not be run from command line") |
1109 sys.exit(1) | 1110 sys.exit(1) |
OLD | NEW |