OLD | NEW |
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 # memcheck_analyze.py | 6 # memcheck_analyze.py |
7 | 7 |
8 ''' Given a valgrind XML file, parses errors and uniques them.''' | 8 ''' Given a valgrind XML file, parses errors and uniques them.''' |
9 | 9 |
10 import gdb_helper | 10 import gdb_helper |
11 | 11 |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 for (name, count) in remaining_sanity_supp.iteritems(): | 588 for (name, count) in remaining_sanity_supp.iteritems(): |
589 logging.info(" * %dx %s" % (count, name)) | 589 logging.info(" * %dx %s" % (count, name)) |
590 retcode = -3 | 590 retcode = -3 |
591 | 591 |
592 if retcode != 0: | 592 if retcode != 0: |
593 return retcode | 593 return retcode |
594 | 594 |
595 logging.info("PASS! No errors found!") | 595 logging.info("PASS! No errors found!") |
596 return 0 | 596 return 0 |
597 | 597 |
| 598 |
598 def _main(): | 599 def _main(): |
599 '''For testing only. The MemcheckAnalyzer class should be imported instead.''' | 600 '''For testing only. The MemcheckAnalyzer class should be imported instead.''' |
600 retcode = 0 | |
601 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") | 601 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
602 parser.add_option("", "--source_dir", | 602 parser.add_option("", "--source_dir", |
603 help="path to top of source tree for this build" | 603 help="path to top of source tree for this build" |
604 "(used to normalize source paths in baseline)") | 604 "(used to normalize source paths in baseline)") |
605 | 605 |
606 (options, args) = parser.parse_args() | 606 (options, args) = parser.parse_args() |
607 if len(args) == 0: | 607 if len(args) == 0: |
608 parser.error("no filename specified") | 608 parser.error("no filename specified") |
609 filenames = args | 609 filenames = args |
610 | 610 |
611 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) | 611 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) |
612 retcode = analyzer.Report(filenames, None) | 612 return analyzer.Report(filenames, None) |
613 | 613 |
614 sys.exit(retcode) | |
615 | 614 |
616 if __name__ == "__main__": | 615 if __name__ == "__main__": |
617 _main() | 616 sys.exit(_main()) |
OLD | NEW |