| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Runs an exe through Valgrind and puts the intermediate files in a | 5 """Runs an exe through Valgrind and puts the intermediate files in a |
| 6 directory. | 6 directory. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import datetime | 9 import datetime |
| 10 import glob | 10 import glob |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 analyzer = drmemory_analyze.DrMemoryAnalyzer() | 914 analyzer = drmemory_analyze.DrMemoryAnalyzer() |
| 915 | 915 |
| 916 ret = 0 | 916 ret = 0 |
| 917 if not self._options.indirect: | 917 if not self._options.indirect: |
| 918 filenames = glob.glob(self.log_dir + "/*/results.txt") | 918 filenames = glob.glob(self.log_dir + "/*/results.txt") |
| 919 | 919 |
| 920 ret = analyzer.Report(filenames, None, check_sanity) | 920 ret = analyzer.Report(filenames, None, check_sanity) |
| 921 else: | 921 else: |
| 922 testcases = glob.glob(self.log_dir + "/testcase.*.logs") | 922 testcases = glob.glob(self.log_dir + "/testcase.*.logs") |
| 923 # If we have browser wrapper, the per-test logdirs are named as | 923 # If we have browser wrapper, the per-test logdirs are named as |
| 924 # "testcase.wrapper_PID". | 924 # "testcase.wrapper_PID.name". |
| 925 # Let's extract the list of wrapper_PIDs and name it ppids | 925 # Let's extract the list of wrapper_PIDs and name it ppids. |
| 926 ppids = set([int(f.split(".")[-2]) for f in testcases]) | 926 # NOTE: ppids may contain '_', i.e. they are not ints! |
| 927 ppids = set([f.split(".")[-2] for f in testcases]) |
| 927 | 928 |
| 928 for ppid in ppids: | 929 for ppid in ppids: |
| 929 testcase_name = None | 930 testcase_name = None |
| 930 try: | 931 try: |
| 931 f = open(self.log_dir + ("/testcase.%d.name" % ppid)) | 932 f = open("%s/testcase.%s.name" % (self.log_dir, ppid)) |
| 932 testcase_name = f.read().strip() | 933 testcase_name = f.read().strip() |
| 933 f.close() | 934 f.close() |
| 934 except IOError: | 935 except IOError: |
| 935 pass | 936 pass |
| 936 print "=====================================================" | 937 print "=====================================================" |
| 937 print " Below is the report for drmemory wrapper PID=%d." % ppid | 938 print " Below is the report for drmemory wrapper PID=%s." % ppid |
| 938 if testcase_name: | 939 if testcase_name: |
| 939 print " It was used while running the `%s` test." % testcase_name | 940 print " It was used while running the `%s` test." % testcase_name |
| 940 else: | 941 else: |
| 941 # TODO(timurrrr): hm, the PID line is suppressed on Windows... | 942 # TODO(timurrrr): hm, the PID line is suppressed on Windows... |
| 942 print " You can find the corresponding test" | 943 print " You can find the corresponding test" |
| 943 print " by searching the above log for 'PID=%d'" % ppid | 944 print " by searching the above log for 'PID=%s'" % ppid |
| 944 sys.stdout.flush() | 945 sys.stdout.flush() |
| 945 ppid_filenames = glob.glob("%s/testcase.%d.logs/*/results.txt" % | 946 ppid_filenames = glob.glob("%s/testcase.%s.logs/*/results.txt" % |
| 946 (self.log_dir, ppid)) | 947 (self.log_dir, ppid)) |
| 947 ret |= analyzer.Report(ppid_filenames, testcase_name, False) | 948 ret |= analyzer.Report(ppid_filenames, testcase_name, False) |
| 948 print "=====================================================" | 949 print "=====================================================" |
| 949 sys.stdout.flush() | 950 sys.stdout.flush() |
| 950 | 951 |
| 951 logging.info("Please see http://dev.chromium.org/developers/how-tos/" | 952 logging.info("Please see http://dev.chromium.org/developers/how-tos/" |
| 952 "using-drmemory for the info on Dr. Memory") | 953 "using-drmemory for the info on Dr. Memory") |
| 953 return ret | 954 return ret |
| 954 | 955 |
| 955 | 956 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 return Asan() | 1198 return Asan() |
| 1198 try: | 1199 try: |
| 1199 platform_name = common.PlatformNames()[0] | 1200 platform_name = common.PlatformNames()[0] |
| 1200 except common.NotImplementedError: | 1201 except common.NotImplementedError: |
| 1201 platform_name = sys.platform + "(Unknown)" | 1202 platform_name = sys.platform + "(Unknown)" |
| 1202 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, | 1203 raise RuntimeError, "Unknown tool (tool=%s, platform=%s)" % (tool_name, |
| 1203 platform_name) | 1204 platform_name) |
| 1204 | 1205 |
| 1205 def CreateTool(tool): | 1206 def CreateTool(tool): |
| 1206 return ToolFactory().Create(tool) | 1207 return ToolFactory().Create(tool) |
| OLD | NEW |