OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 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 # valgrind_test.py | 6 # valgrind_test.py |
7 | 7 |
8 '''Runs an exe through Valgrind and puts the intermediate files in a | 8 '''Runs an exe through Valgrind and puts the intermediate files in a |
9 directory. | 9 directory. |
10 ''' | 10 ''' |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 return False | 385 return False |
386 | 386 |
387 def ExtendOptionParser(self, parser): | 387 def ExtendOptionParser(self, parser): |
388 ValgrindTool.ExtendOptionParser(self, parser) | 388 ValgrindTool.ExtendOptionParser(self, parser) |
389 parser.add_option("", "--suppressions", default=[], | 389 parser.add_option("", "--suppressions", default=[], |
390 action="append", | 390 action="append", |
391 help="path to a valgrind suppression file") | 391 help="path to a valgrind suppression file") |
392 parser.add_option("", "--pure-happens-before", default="yes", | 392 parser.add_option("", "--pure-happens-before", default="yes", |
393 dest="pure_happens_before", | 393 dest="pure_happens_before", |
394 help="Less false reports, more missed races") | 394 help="Less false reports, more missed races") |
| 395 parser.add_option("", "--ignore-in-dtor", default="no", |
| 396 dest="ignore_in_dtor", |
| 397 help="Ignore data races inside destructors") |
395 parser.add_option("", "--announce-threads", default="yes", | 398 parser.add_option("", "--announce-threads", default="yes", |
396 dest="announce_threads", | 399 dest="announce_threads", |
397 help="Show the the stack traces of thread creation") | 400 help="Show the the stack traces of thread creation") |
398 | 401 |
399 def EvalBoolFlag(self, flag_value): | 402 def EvalBoolFlag(self, flag_value): |
400 if (flag_value in ["1", "true", "yes"]): | 403 if (flag_value in ["1", "true", "yes"]): |
401 return True | 404 return True |
402 elif (flag_value in ["0", "false", "no"]): | 405 elif (flag_value in ["0", "false", "no"]): |
403 return False | 406 return False |
404 raise RuntimeError, "Can't parse flag value (%s)" % flag_value | 407 raise RuntimeError, "Can't parse flag value (%s)" % flag_value |
(...skipping 12 matching lines...) Expand all Loading... |
417 "tools", "valgrind", "tsan", ignore_file) | 420 "tools", "valgrind", "tsan", ignore_file) |
418 if os.path.exists(fullname): | 421 if os.path.exists(fullname): |
419 ret += ["--ignore=%s" % fullname] | 422 ret += ["--ignore=%s" % fullname] |
420 | 423 |
421 # The -v flag is needed for printing the list of used suppressions. | 424 # The -v flag is needed for printing the list of used suppressions. |
422 ret += ["-v"] | 425 ret += ["-v"] |
423 | 426 |
424 ret += ["--file-prefix-to-cut=%s/" % self._source_dir] | 427 ret += ["--file-prefix-to-cut=%s/" % self._source_dir] |
425 | 428 |
426 if self.EvalBoolFlag(self._options.pure_happens_before): | 429 if self.EvalBoolFlag(self._options.pure_happens_before): |
427 ret += ["--pure-happens-before=yes"]; | 430 ret += ["--pure-happens-before=yes"] # "no" is the default value for TSAN |
| 431 |
| 432 if not self.EvalBoolFlag(self._options.ignore_in_dtor): |
| 433 ret += ["--ignore-in-dtor=no"] # "yes" is the default value for TSAN |
428 | 434 |
429 if self.EvalBoolFlag(self._options.announce_threads): | 435 if self.EvalBoolFlag(self._options.announce_threads): |
430 ret += ["--announce-threads"] | 436 ret += ["--announce-threads"] |
431 | 437 |
432 # --show-pc flag is needed for parsing the error logs on Darwin. | 438 # --show-pc flag is needed for parsing the error logs on Darwin. |
433 if platform_suffix == 'mac': | 439 if platform_suffix == 'mac': |
434 ret += ["--show-pc=yes"] | 440 ret += ["--show-pc=yes"] |
435 | 441 |
436 return ret | 442 return ret |
437 | 443 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 483 |
478 if __name__ == "__main__": | 484 if __name__ == "__main__": |
479 if sys.argv.count("-v") > 0 or sys.argv.count("--verbose") > 0: | 485 if sys.argv.count("-v") > 0 or sys.argv.count("--verbose") > 0: |
480 google.logging_utils.config_root(logging.DEBUG) | 486 google.logging_utils.config_root(logging.DEBUG) |
481 else: | 487 else: |
482 google.logging_utils.config_root() | 488 google.logging_utils.config_root() |
483 # TODO(timurrrr): valgrind tools may use -v/--verbose as well | 489 # TODO(timurrrr): valgrind tools may use -v/--verbose as well |
484 | 490 |
485 ret = RunTool(sys.argv) | 491 ret = RunTool(sys.argv) |
486 sys.exit(ret) | 492 sys.exit(ret) |
OLD | NEW |