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

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

Issue 8816016: TSan: print error reports to stdout instead of stderr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env 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
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 self._cur_testcase = testcase 229 self._cur_testcase = testcase
230 reports = self.GetReports(files) 230 reports = self.GetReports(files)
231 self._cur_testcase = None # just in case, shouldn't be used anymore 231 self._cur_testcase = None # just in case, shouldn't be used anymore
232 232
233 common.PrintUsedSuppressionsList(self.used_suppressions) 233 common.PrintUsedSuppressionsList(self.used_suppressions)
234 234
235 235
236 retcode = 0 236 retcode = 0
237 if reports: 237 if reports:
238 logging.error("FAIL! Found %i report(s)" % len(reports)) 238 logging.error("FAIL! Found %i report(s)" % len(reports))
239 sys.stderr.flush()
239 for report in reports: 240 for report in reports:
240 logging.error('\n' + report) 241 logging.info('\n' + report)
242 sys.stdout.flush()
241 retcode = -1 243 retcode = -1
242 244
243 # Report tool's insanity even if there were errors. 245 # Report tool's insanity even if there were errors.
244 if (check_sanity and 246 if (check_sanity and
245 TsanAnalyzer.SANITY_TEST_SUPPRESSION not in self.used_suppressions): 247 TsanAnalyzer.SANITY_TEST_SUPPRESSION not in self.used_suppressions):
246 logging.error("FAIL! Sanity check failed!") 248 logging.error("FAIL! Sanity check failed!")
247 retcode = -3 249 retcode = -3
248 250
249 if retcode != 0: 251 if retcode != 0:
250 return retcode 252 return retcode
251 253
252 logging.info("PASS: No reports found") 254 logging.info("PASS: No reports found")
253 return 0 255 return 0
254 256
255 257
256 def main(): 258 def main():
257 '''For testing only. The TsanAnalyzer class should be imported instead.''' 259 '''For testing only. The TsanAnalyzer class should be imported instead.'''
258 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") 260 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>")
259 parser.add_option("", "--source_dir", 261 parser.add_option("", "--source_dir",
260 help="path to top of source tree for this build" 262 help="path to top of source tree for this build"
261 "(used to normalize source paths in baseline)") 263 "(used to normalize source paths in baseline)")
262 264
263 (options, args) = parser.parse_args() 265 (options, args) = parser.parse_args()
264 if not args: 266 if not args:
265 parser.error("no filename specified") 267 parser.error("no filename specified")
266 filenames = args 268 filenames = args
267 269
270 logging.getLogger().setLevel(logging.INFO)
268 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True) 271 analyzer = TsanAnalyzer(options.source_dir, use_gdb=True)
269 return analyzer.Report(filenames, None) 272 return analyzer.Report(filenames, None)
270 273
271 274
272 if __name__ == '__main__': 275 if __name__ == '__main__':
273 sys.exit(main()) 276 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698