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

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

Issue 3389023: Fix lost suppressions with --tool=tsan_rv and refactor chrome_tests/valgrind_... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 months 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
« no previous file with comments | « tools/valgrind/chrome_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 logging.error("Setup failed") 200 logging.error("Setup failed")
201 end = datetime.datetime.now() 201 end = datetime.datetime.now()
202 seconds = (end - start).seconds 202 seconds = (end - start).seconds
203 hours = seconds / 3600 203 hours = seconds / 3600
204 seconds = seconds % 3600 204 seconds = seconds % 3600
205 minutes = seconds / 60 205 minutes = seconds / 60
206 seconds = seconds % 60 206 seconds = seconds % 60
207 logging.info("elapsed time: %02d:%02d:%02d" % (hours, minutes, seconds)) 207 logging.info("elapsed time: %02d:%02d:%02d" % (hours, minutes, seconds))
208 return retcode 208 return retcode
209 209
210 def Run(self, args, module):
211 MODULES_TO_SANITY_CHECK = ["base"]
212
213 # TODO(timurrrr): this is a temporary workaround for http://crbug.com/47844
214 if self.ToolName() == "tsan" and common.IsMac():
215 MODULES_TO_SANITY_CHECK = []
216
217 check_sanity = module in MODULES_TO_SANITY_CHECK
218 return self.Main(args, check_sanity)
219
210 220
211 class ValgrindTool(BaseTool): 221 class ValgrindTool(BaseTool):
212 """Abstract class for running Valgrind tools. 222 """Abstract class for running Valgrind tools.
213 223
214 Always subclass this and implement ToolSpecificFlags() and 224 Always subclass this and implement ToolSpecificFlags() and
215 ExtendOptionParser() for tool-specific stuff. 225 ExtendOptionParser() for tool-specific stuff.
216 """ 226 """
217 def __init__(self): 227 def __init__(self):
218 super(ValgrindTool, self).__init__() 228 super(ValgrindTool, self).__init__()
219 self.RegisterOptionParserHook(ValgrindTool.ExtendOptionParser) 229 self.RegisterOptionParserHook(ValgrindTool.ExtendOptionParser)
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 return ThreadSanitizerRV1Windows() 874 return ThreadSanitizerRV1Windows()
865 else: 875 else:
866 return ThreadSanitizerRV1Posix() 876 return ThreadSanitizerRV1Posix()
867 877
868 def RV2Factory(self): 878 def RV2Factory(self):
869 if common.IsWindows(): 879 if common.IsWindows():
870 return ThreadSanitizerRV2Windows() 880 return ThreadSanitizerRV2Windows()
871 else: 881 else:
872 return ThreadSanitizerRV2Posix() 882 return ThreadSanitizerRV2Posix()
873 883
884 def ToolName(self):
885 return "tsan"
886
874 def Main(self, args, check_sanity): 887 def Main(self, args, check_sanity):
875 logging.info("Running a TSan + RaceVerifier test. For more information, " + 888 logging.info("Running a TSan + RaceVerifier test. For more information, " +
876 "see " + self.MORE_INFO_URL) 889 "see " + self.MORE_INFO_URL)
877 cmd1 = self.RV1Factory() 890 cmd1 = self.RV1Factory()
878 ret = cmd1.Main(args, check_sanity) 891 ret = cmd1.Main(args, check_sanity)
879 # Verify race reports, if there are any. 892 # Verify race reports, if there are any.
880 if ret == -1: 893 if ret == -1:
881 logging.info("Starting pass 2 of 2. Running the same binary in " + 894 logging.info("Starting pass 2 of 2. Running the same binary in " +
882 "RaceVerifier mode to confirm possible race reports.") 895 "RaceVerifier mode to confirm possible race reports.")
883 logging.info("For more information, see " + self.MORE_INFO_URL) 896 logging.info("For more information, see " + self.MORE_INFO_URL)
884 cmd2 = self.RV2Factory() 897 cmd2 = self.RV2Factory()
885 ret = cmd2.Main(args, check_sanity) 898 ret = cmd2.Main(args, check_sanity)
886 else: 899 else:
887 logging.info("No reports, skipping RaceVerifier second pass") 900 logging.info("No reports, skipping RaceVerifier second pass")
888 logging.info("Please see " + self.MORE_INFO_URL + " for more information " + 901 logging.info("Please see " + self.MORE_INFO_URL + " for more information " +
889 "on RaceVerifier") 902 "on RaceVerifier")
890 return ret 903 return ret
891 904
905 def Run(self, args, module):
906 return self.Main(args, False)
907
892 908
893 class ToolFactory: 909 class ToolFactory:
894 def Create(self, tool_name): 910 def Create(self, tool_name):
895 if tool_name == "memcheck" and not common.IsWine(): 911 if tool_name == "memcheck" and not common.IsWine():
896 return Memcheck() 912 return Memcheck()
897 if tool_name == "wine_memcheck" and common.IsWine(): 913 if tool_name == "wine_memcheck" and common.IsWine():
898 return Memcheck() 914 return Memcheck()
899 if tool_name == "tsan": 915 if tool_name == "tsan":
900 if common.IsWindows(): 916 if common.IsWindows():
901 return ThreadSanitizerWindows() 917 return ThreadSanitizerWindows()
902 else: 918 else:
903 return ThreadSanitizerPosix() 919 return ThreadSanitizerPosix()
904 if tool_name == "drmemory": 920 if tool_name == "drmemory":
905 return DrMemory() 921 return DrMemory()
906 if tool_name == "tsan_rv": 922 if tool_name == "tsan_rv":
907 return RaceVerifier() 923 return RaceVerifier()
908 try: 924 try:
909 platform_name = common.PlatformNames()[0] 925 platform_name = common.PlatformNames()[0]
910 except common.NotImplementedError: 926 except common.NotImplementedError:
911 platform_name = sys.platform + "(Unknown)" 927 platform_name = sys.platform + "(Unknown)"
912 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, 928 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name,
913 platform_name) 929 platform_name)
914 930
915 def RunTool(argv, module): 931 def CreateTool(tool):
916 # TODO(timurrrr): customize optparse instead 932 return ToolFactory().Create(tool)
917 tool_name = "memcheck"
918 args = argv[1:]
919 for arg in args:
920 if arg.startswith("--tool="):
921 tool_name = arg[7:]
922 args.remove(arg)
923 break
924 933
925 tool = ToolFactory().Create(tool_name) 934 if __name__ == '__main__':
926 MODULES_TO_SANITY_CHECK = ["base"] 935 logging.error(sys.argv[0] + " can not be run from command line")
927 936 sys.exit(1)
928 # TODO(timurrrr): this is a temporary workaround for http://crbug.com/47844
929 if tool_name == "tsan" and common.IsMac():
930 MODULES_TO_SANITY_CHECK = []
931
932 check_sanity = module in MODULES_TO_SANITY_CHECK
933 return tool.Main(args, check_sanity)
934
935 if __name__ == "__main__":
936 if sys.argv.count("-v") > 0 or sys.argv.count("--verbose") > 0:
937 logging_utils.config_root(logging.DEBUG)
938 else:
939 logging_utils.config_root()
940 # TODO(timurrrr): valgrind tools may use -v/--verbose as well
941
942 ret = RunTool(sys.argv)
943 sys.exit(ret)
OLDNEW
« no previous file with comments | « tools/valgrind/chrome_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698