| 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 # tsan_analyze.py | 6 # tsan_analyze.py |
| 7 | 7 |
| 8 ''' Given a ThreadSanitizer output file, parses errors and uniques them.''' | 8 ''' Given a ThreadSanitizer output file, parses errors and uniques them.''' |
| 9 | 9 |
| 10 import gdb_helper | 10 import gdb_helper |
| 11 | 11 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 # Report tool's insanity even if there were errors. | 251 # Report tool's insanity even if there were errors. |
| 252 if check_sanity and not is_sane: | 252 if check_sanity and not is_sane: |
| 253 logging.error("FAIL! Sanity check failed!") | 253 logging.error("FAIL! Sanity check failed!") |
| 254 retcode = -3 | 254 retcode = -3 |
| 255 | 255 |
| 256 if retcode != 0: | 256 if retcode != 0: |
| 257 return retcode | 257 return retcode |
| 258 logging.info("PASS: No reports found") | 258 logging.info("PASS: No reports found") |
| 259 return 0 | 259 return 0 |
| 260 | 260 |
| 261 if __name__ == '__main__': | 261 |
| 262 def main(): |
| 262 '''For testing only. The TsanAnalyzer class should be imported instead.''' | 263 '''For testing only. The TsanAnalyzer class should be imported instead.''' |
| 263 retcode = 0 | |
| 264 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") | 264 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
| 265 parser.add_option("", "--source_dir", | 265 parser.add_option("", "--source_dir", |
| 266 help="path to top of source tree for this build" | 266 help="path to top of source tree for this build" |
| 267 "(used to normalize source paths in baseline)") | 267 "(used to normalize source paths in baseline)") |
| 268 | 268 |
| 269 (options, args) = parser.parse_args() | 269 (options, args) = parser.parse_args() |
| 270 if not args: | 270 if not args: |
| 271 parser.error("no filename specified") | 271 parser.error("no filename specified") |
| 272 filenames = args | 272 filenames = args |
| 273 | 273 |
| 274 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) | 274 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) |
| 275 retcode = analyzer.Report(filenames, None) | 275 return analyzer.Report(filenames, None) |
| 276 | 276 |
| 277 sys.exit(retcode) | 277 |
| 278 if __name__ == '__main__': |
| 279 sys.exit(main()) |
| OLD | NEW |