| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 TsanAnalyzer.SANITY_TEST_SUPPRESSION not in self.used_suppressions): | 245 TsanAnalyzer.SANITY_TEST_SUPPRESSION not in self.used_suppressions): |
| 246 logging.error("FAIL! Sanity check failed!") | 246 logging.error("FAIL! Sanity check failed!") |
| 247 retcode = -3 | 247 retcode = -3 |
| 248 | 248 |
| 249 if retcode != 0: | 249 if retcode != 0: |
| 250 return retcode | 250 return retcode |
| 251 | 251 |
| 252 logging.info("PASS: No reports found") | 252 logging.info("PASS: No reports found") |
| 253 return 0 | 253 return 0 |
| 254 | 254 |
| 255 if __name__ == '__main__': | 255 |
| 256 def main(): |
| 256 '''For testing only. The TsanAnalyzer class should be imported instead.''' | 257 '''For testing only. The TsanAnalyzer class should be imported instead.''' |
| 257 retcode = 0 | |
| 258 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") | 258 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
| 259 parser.add_option("", "--source_dir", | 259 parser.add_option("", "--source_dir", |
| 260 help="path to top of source tree for this build" | 260 help="path to top of source tree for this build" |
| 261 "(used to normalize source paths in baseline)") | 261 "(used to normalize source paths in baseline)") |
| 262 | 262 |
| 263 (options, args) = parser.parse_args() | 263 (options, args) = parser.parse_args() |
| 264 if not args: | 264 if not args: |
| 265 parser.error("no filename specified") | 265 parser.error("no filename specified") |
| 266 filenames = args | 266 filenames = args |
| 267 | 267 |
| 268 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) | 268 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) |
| 269 retcode = analyzer.Report(filenames, None) | 269 return analyzer.Report(filenames, None) |
| 270 | 270 |
| 271 sys.exit(retcode) | 271 |
| 272 if __name__ == '__main__': |
| 273 sys.exit(main()) |
| OLD | NEW |