Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: tools/valgrind/valgrind_test.py

Issue 8505028: Update chrome_tests.sh to run DrMemory from Cygwin Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 """
11 11
12 import datetime 12 import datetime
13 import glob 13 import glob
14 import logging 14 import logging
15 import optparse 15 import optparse
16 import os 16 import os
17 import platform
17 import re 18 import re
18 import shutil 19 import shutil
19 import stat 20 import stat
20 import subprocess 21 import subprocess
21 import sys 22 import sys
22 import tempfile 23 import tempfile
23 24
24 import common 25 import common
25 26
26 import drmemory_analyze 27 import drmemory_analyze
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 700
700 def Analyze(self, check_sanity=False): 701 def Analyze(self, check_sanity=False):
701 filenames = glob.glob(self.log_dir + "/tsan.*") 702 filenames = glob.glob(self.log_dir + "/tsan.*")
702 analyzer = tsan_analyze.TsanAnalyzer(self._source_dir) 703 analyzer = tsan_analyze.TsanAnalyzer(self._source_dir)
703 ret = analyzer.Report(filenames, check_sanity) 704 ret = analyzer.Report(filenames, check_sanity)
704 if ret != 0: 705 if ret != 0:
705 logging.info(self.INFO_MESSAGE) 706 logging.info(self.INFO_MESSAGE)
706 return ret 707 return ret
707 708
708 709
710 def _Cygpath(path):
Timur Iskhodzhanov 2011/11/10 11:52:49 maybe this should me moved to tools\valgrind\commo
Alexander Potapenko 2011/11/10 12:12:13 Am I right you're this function is called on every
Reid Kleckner (google) 2011/11/10 14:00:30 It's actually fairly specific to DrMemory, I think
Timur Iskhodzhanov 2011/11/10 14:03:19 The only reason for doing your CL is to support ru
Reid Kleckner (google) 2011/11/10 14:19:09 No. Because I'm using Cygwin, depot_tools uses th
711 """If we're using Cygwin Python, turn the path into a Windows path.
712
713 Don't turn forward slashes into backslashes for easier copy-pasting and
714 escaping.
715 """
716 if path[0] == "/" and "cygwin" in platform.system().lower():
717 p = subprocess.Popen(["cygpath", "-m", path],
718 stdout=subprocess.PIPE,
719 stderr=subprocess.PIPE)
720 (out, err) = p.communicate()
721 if err:
722 logging.warning("WARNING: cygpath error: %s", err)
723 return out.strip()
724 else:
725 return path
726
727
709 class DrMemory(BaseTool): 728 class DrMemory(BaseTool):
710 """Dr.Memory 729 """Dr.Memory
711 Dynamic memory error detector for Windows. 730 Dynamic memory error detector for Windows.
712 731
713 http://dev.chromium.org/developers/how-tos/using-drmemory 732 http://dev.chromium.org/developers/how-tos/using-drmemory
714 It is not very mature at the moment, some things might not work properly. 733 It is not very mature at the moment, some things might not work properly.
715 """ 734 """
716 735
717 def __init__(self, handle_uninits_and_leaks): 736 def __init__(self, handle_uninits_and_leaks):
718 super(DrMemory, self).__init__() 737 super(DrMemory, self).__init__()
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout) 810 drconfig_retcode = common.RunSubprocess(drconfig_cmd, self._timeout)
792 if drconfig_retcode: 811 if drconfig_retcode:
793 logging.error("Configuring whether to follow python children failed " \ 812 logging.error("Configuring whether to follow python children failed " \
794 "with %d.", drconfig_retcode) 813 "with %d.", drconfig_retcode)
795 raise RuntimeError, "Configuring python children failed " 814 raise RuntimeError, "Configuring python children failed "
796 815
797 suppression_count = 0 816 suppression_count = 0
798 for suppression_file in self._options.suppressions: 817 for suppression_file in self._options.suppressions:
799 if os.path.exists(suppression_file): 818 if os.path.exists(suppression_file):
800 suppression_count += 1 819 suppression_count += 1
801 proc += ["-suppress", suppression_file] 820 proc += ["-suppress", _Cygpath(suppression_file)]
802 821
803 if not suppression_count: 822 if not suppression_count:
804 logging.warning("WARNING: NOT USING SUPPRESSIONS!") 823 logging.warning("WARNING: NOT USING SUPPRESSIONS!")
805 824
806 # Un-comment to dump Dr.Memory events on error 825 # Un-comment to dump Dr.Memory events on error
807 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"] 826 #proc += ["-dr_ops", "-dumpcore_mask 0x8bff"]
808 827
809 # Un-comment to debug Dr.Memory 828 # Un-comment to debug Dr.Memory
810 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"] 829 #proc += ["-dr_ops", "-no_hide -msgbox_mask 15"]
811 830
812 if self._options.use_debug: 831 if self._options.use_debug:
813 proc += ["-debug"] 832 proc += ["-debug"]
814 833
815 proc += ["-logdir", self.log_dir] 834 proc += ["-logdir", _Cygpath(self.log_dir)]
816 proc += ["-batch", "-quiet", "-no_results_to_stderr"] 835 proc += ["-batch", "-quiet", "-no_results_to_stderr"]
817 836
818 proc += ["-callstack_max_frames", "40"] 837 proc += ["-callstack_max_frames", "40"]
819 838
820 # make callstacks easier to read 839 # make callstacks easier to read
821 proc += ["-callstack_srcfile_prefix", 840 proc += ["-callstack_srcfile_prefix",
822 "build\\src,chromium\\src,crt_build\\self_x86"] 841 "build\\src,chromium\\src,crt_build\\self_x86"]
823 proc += ["-callstack_modname_hide", 842 proc += ["-callstack_modname_hide",
824 "*.exe,chrome.dll"] 843 "*.exe,chrome.dll"]
825 844
826 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False) 845 boring_callers = common.BoringCallers(mangled=False, use_re_wildcards=False)
827 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .." 846 # TODO(timurrrr): In fact, we want "starting from .." instead of "below .."
828 proc += ["-callstack_truncate_below", ",".join(boring_callers)] 847 proc += ["-callstack_truncate_below", ",".join(boring_callers)]
829 848
830 if not self.handle_uninits_and_leaks: 849 if not self.handle_uninits_and_leaks:
831 proc += ["-no_check_uninitialized", "-no_count_leaks"] 850 proc += ["-no_check_uninitialized", "-no_count_leaks"]
832 851
833 proc += self._tool_flags 852 proc += self._tool_flags
834 853
835 # Dr.Memory requires -- to separate tool flags from the executable name. 854 # Dr.Memory requires -- to separate tool flags from the executable name.
836 proc += ["--"] 855 proc += ["--"]
837 856
838 if self._options.indirect: 857 if self._options.indirect:
839 self.CreateBrowserWrapper(" ".join(proc)) 858 self.CreateBrowserWrapper(" ".join(proc))
840 proc = [] 859 proc = []
841 860
842 # Note that self._args begins with the name of the exe to be run. 861 # Note that self._args begins with the name of the exe to be run.
862 self._args[0] = _Cygpath(self._args[0])
843 proc += self._args 863 proc += self._args
844 return proc 864 return proc
845 865
846 def CreateBrowserWrapper(self, command): 866 def CreateBrowserWrapper(self, command):
847 os.putenv("BROWSER_WRAPPER", command) 867 os.putenv("BROWSER_WRAPPER", command)
848 868
849 def Analyze(self, check_sanity=False): 869 def Analyze(self, check_sanity=False):
850 # Glob all the results files in the "testing.tmp" directory 870 # Glob all the results files in the "testing.tmp" directory
851 filenames = glob.glob(self.log_dir + "/*/results.txt") 871 filenames = glob.glob(self.log_dir + "/*/results.txt")
852 872
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 platform_name = sys.platform + "(Unknown)" 1120 platform_name = sys.platform + "(Unknown)"
1101 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, 1121 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name,
1102 platform_name) 1122 platform_name)
1103 1123
1104 def CreateTool(tool): 1124 def CreateTool(tool):
1105 return ToolFactory().Create(tool) 1125 return ToolFactory().Create(tool)
1106 1126
1107 if __name__ == '__main__': 1127 if __name__ == '__main__':
1108 logging.error(sys.argv[0] + " can not be run from command line") 1128 logging.error(sys.argv[0] + " can not be run from command line")
1109 sys.exit(1) 1129 sys.exit(1)
OLDNEW
« tools/valgrind/chrome_tests.sh ('K') | « tools/valgrind/chrome_tests.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698