| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout) | 827 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout) |
| 828 if drconfig_retcode: | 828 if drconfig_retcode: |
| 829 logging.error("Configuring whether to follow python children failed " \ | 829 logging.error("Configuring whether to follow python children failed " \ |
| 830 "with %d.", drconfig_retcode) | 830 "with %d.", drconfig_retcode) |
| 831 raise RuntimeError, "Configuring python children failed " | 831 raise RuntimeError, "Configuring python children failed " |
| 832 | 832 |
| 833 suppression_count = 0 | 833 suppression_count = 0 |
| 834 for suppression_file in self._options.suppressions: | 834 for suppression_file in self._options.suppressions: |
| 835 if os.path.exists(suppression_file): | 835 if os.path.exists(suppression_file): |
| 836 suppression_count += 1 | 836 suppression_count += 1 |
| 837 proc += ["-suppress", suppression_file] | 837 proc += ["-suppress", common.NormalizeWindowsPath(suppression_file)] |
| 838 | 838 |
| 839 if not suppression_count: | 839 if not suppression_count: |
| 840 logging.warning("WARNING: NOT USING SUPPRESSIONS!") | 840 logging.warning("WARNING: NOT USING SUPPRESSIONS!") |
| 841 | 841 |
| 842 # Un-comment to dump Dr.Memory events on error | 842 # Un-comment to dump Dr.Memory events on error |
| 843 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] | 843 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] |
| 844 | 844 |
| 845 # Un-comment to debug Dr.Memory | 845 # Un-comment to debug Dr.Memory |
| 846 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] | 846 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] |
| 847 | 847 |
| 848 if self._options.use_debug: | 848 if self._options.use_debug: |
| 849 proc += ["-debug"] | 849 proc += ["-debug"] |
| 850 | 850 |
| 851 proc += ["-logdir", self.log_dir] | 851 proc += ["-logdir", common.NormalizeWindowsPath(self.log_dir)] |
| 852 proc += ["-batch", "-quiet", "-no_results_to_stderr"] | 852 proc += ["-batch", "-quiet", "-no_results_to_stderr"] |
| 853 | 853 |
| 854 proc += ["-callstack_max_frames", "40"] | 854 proc += ["-callstack_max_frames", "40"] |
| 855 | 855 |
| 856 # make callstacks easier to read | 856 # make callstacks easier to read |
| 857 proc += ["-callstack_srcfile_prefix", | 857 proc += ["-callstack_srcfile_prefix", |
| 858 "build\\src,chromium\\src,crt_build\\self_x86"] | 858 "build\\src,chromium\\src,crt_build\\self_x86"] |
| 859 proc += ["-callstack_modname_hide", | 859 proc += ["-callstack_modname_hide", |
| 860 "*.exe,chrome.dll"] | 860 "*.exe,chrome.dll"] |
| 861 | 861 |
| 862 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False) | 862 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False) |
| 863 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .." | 863 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .." |
| 864 proc += ["-callstack_truncate_below", ",".join(boring_callers)] | 864 proc += ["-callstack_truncate_below", ",".join(boring_callers)] |
| 865 | 865 |
| 866 if not self.handle_uninits_and_leaks: | 866 if not self.handle_uninits_and_leaks: |
| 867 proc += ["-no_check_uninitialized", "-no_count_leaks"] | 867 proc += ["-no_check_uninitialized", "-no_count_leaks"] |
| 868 | 868 |
| 869 proc += self._tool_flags | 869 proc += self._tool_flags |
| 870 | 870 |
| 871 # Dr.Memory requires -- to separate tool flags from the executable name. | 871 # Dr.Memory requires -- to separate tool flags from the executable name. |
| 872 proc += ["--"] | 872 proc += ["--"] |
| 873 | 873 |
| 874 if self._options.indirect: | 874 if self._options.indirect: |
| 875 self.CreateBrowserWrapper(" ".join(proc)) | 875 self.CreateBrowserWrapper(" ".join(proc)) |
| 876 proc = [] | 876 proc = [] |
| 877 | 877 |
| 878 # Note that self._args begins with the name of the exe to be run. | 878 # Note that self._args begins with the name of the exe to be run. |
| 879 self._args[0] = common.NormalizeWindowsPath(self._args[0]) |
| 879 proc += self._args | 880 proc += self._args |
| 880 return proc | 881 return proc |
| 881 | 882 |
| 882 def CreateBrowserWrapper(self, command): | 883 def CreateBrowserWrapper(self, command): |
| 883 os.putenv("BROWSER_WRAPPER", command) | 884 os.putenv("BROWSER_WRAPPER", command) |
| 884 | 885 |
| 885 def Analyze(self, check_sanity=False): | 886 def Analyze(self, check_sanity=False): |
| 886 # Glob all the results files in the "testing.tmp" directory | 887 # Glob all the results files in the "testing.tmp" directory |
| 887 filenames = glob.glob(self.log_dir + "/*/results.txt") | 888 filenames = glob.glob(self.log_dir + "/*/results.txt") |
| 888 | 889 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 platform_name = sys.platform + "(Unknown)" | 1137 platform_name = sys.platform + "(Unknown)" |
| 1137 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1138 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
| 1138 platform_name) | 1139 platform_name) |
| 1139 | 1140 |
| 1140 def CreateTool(tool): | 1141 def CreateTool(tool): |
| 1141 return ToolFactory().Create(tool) | 1142 return ToolFactory().Create(tool) |
| 1142 | 1143 |
| 1143 if __name__ == '__main__': | 1144 if __name__ == '__main__': |
| 1144 logging.error(sys.argv[0] + " can not be run from command line") | 1145 logging.error(sys.argv[0] + " can not be run from command line") |
| 1145 sys.exit(1) | 1146 sys.exit(1) |
| OLD | NEW |