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

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

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/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/env 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 # drmemory_analyze.py 6 # drmemory_analyze.py
7 7
8 ''' Given a Dr. Memory output file, parses errors and uniques them.''' 8 ''' Given a Dr. Memory output file, parses errors and uniques them.'''
9 9
10 import logging 10 import logging
11 import optparse 11 import optparse
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 for report_list in self.reports: 96 for report_list in self.reports:
97 report = '' 97 report = ''
98 for line in report_list: 98 for line in report_list:
99 report += str(line) 99 report += str(line)
100 logging.error('\n' + report) 100 logging.error('\n' + report)
101 logging.error("Total: %i error reports" % len(self.reports)) 101 logging.error("Total: %i error reports" % len(self.reports))
102 return -1 102 return -1
103 logging.info("PASS: No error reports found") 103 logging.info("PASS: No error reports found")
104 return 0 104 return 0
105 105
106 if __name__ == '__main__': 106
107 def main():
107 '''For testing only. The DrMemoryAnalyze class should be imported instead.''' 108 '''For testing only. The DrMemoryAnalyze class should be imported instead.'''
108 retcode = 0
109 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") 109 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>")
110 parser.add_option("", "--source_dir", 110 parser.add_option("", "--source_dir",
111 help="path to top of source tree for this build" 111 help="path to top of source tree for this build"
112 "(used to normalize source paths in baseline)") 112 "(used to normalize source paths in baseline)")
113 113
114 (options, args) = parser.parse_args() 114 (options, args) = parser.parse_args()
115 if len(args) == 0: 115 if len(args) == 0:
116 parser.error("no filename specified") 116 parser.error("no filename specified")
117 filenames = args 117 filenames = args
118 118
119 analyzer = DrMemoryAnalyze(options.source_dir, filenames) 119 analyzer = DrMemoryAnalyze(options.source_dir, filenames)
120 retcode = analyzer.Report(False) 120 return analyzer.Report(False)
121 121
122 sys.exit(retcode) 122
123 if __name__ == '__main__':
124 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698