| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 return True | 580 return True |
| 581 | 581 |
| 582 def ExtendOptionParser(self, parser): | 582 def ExtendOptionParser(self, parser): |
| 583 parser.add_option("", "--hybrid", default="no", | 583 parser.add_option("", "--hybrid", default="no", |
| 584 dest="hybrid", | 584 dest="hybrid", |
| 585 help="Finds more data races, may give false positive " | 585 help="Finds more data races, may give false positive " |
| 586 "reports unless the code is annotated") | 586 "reports unless the code is annotated") |
| 587 parser.add_option("", "--announce-threads", default="yes", | 587 parser.add_option("", "--announce-threads", default="yes", |
| 588 dest="announce_threads", | 588 dest="announce_threads", |
| 589 help="Show the the stack traces of thread creation") | 589 help="Show the the stack traces of thread creation") |
| 590 parser.add_option("", "--free-is-write", default="no", |
| 591 dest="free_is_write", |
| 592 help="Treat free()/operator delete as memory write. " |
| 593 "This helps finding more data races, but (currently) " |
| 594 "this may give false positive reports on std::string " |
| 595 "internals, see http://code.google.com/p/data-race-test" |
| 596 "/issues/detail?id=40") |
| 590 | 597 |
| 591 def EvalBoolFlag(self, flag_value): | 598 def EvalBoolFlag(self, flag_value): |
| 592 if (flag_value in ["1", "true", "yes"]): | 599 if (flag_value in ["1", "true", "yes"]): |
| 593 return True | 600 return True |
| 594 elif (flag_value in ["0", "false", "no"]): | 601 elif (flag_value in ["0", "false", "no"]): |
| 595 return False | 602 return False |
| 596 raise RuntimeError, "Can't parse flag value (%s)" % flag_value | 603 raise RuntimeError, "Can't parse flag value (%s)" % flag_value |
| 597 | 604 |
| 598 def ToolSpecificFlags(self): | 605 def ToolSpecificFlags(self): |
| 599 ret = [] | 606 ret = [] |
| (...skipping 15 matching lines...) Expand all Loading... |
| 615 | 622 |
| 616 # This should shorten filepaths for functions intercepted in TSan. | 623 # This should shorten filepaths for functions intercepted in TSan. |
| 617 ret += ["--file-prefix-to-cut=scripts/tsan/tsan/"] | 624 ret += ["--file-prefix-to-cut=scripts/tsan/tsan/"] |
| 618 | 625 |
| 619 if self.EvalBoolFlag(self._options.hybrid): | 626 if self.EvalBoolFlag(self._options.hybrid): |
| 620 ret += ["--hybrid=yes"] # "no" is the default value for TSAN | 627 ret += ["--hybrid=yes"] # "no" is the default value for TSAN |
| 621 | 628 |
| 622 if self.EvalBoolFlag(self._options.announce_threads): | 629 if self.EvalBoolFlag(self._options.announce_threads): |
| 623 ret += ["--announce-threads"] | 630 ret += ["--announce-threads"] |
| 624 | 631 |
| 632 if self.EvalBoolFlag(self._options.free_is_write): |
| 633 ret += ["--free-is-write=yes"] |
| 634 else: |
| 635 ret += ["--free-is-write=no"] |
| 636 |
| 637 |
| 625 # --show-pc flag is needed for parsing the error logs on Darwin. | 638 # --show-pc flag is needed for parsing the error logs on Darwin. |
| 626 if platform_suffix == 'mac': | 639 if platform_suffix == 'mac': |
| 627 ret += ["--show-pc=yes"] | 640 ret += ["--show-pc=yes"] |
| 628 | 641 |
| 629 # Don't show googletest frames in stacks. | 642 # Don't show googletest frames in stacks. |
| 630 ret += ["--cut_stack_below=testing*Test*Run*"] | 643 ret += ["--cut_stack_below=testing*Test*Run*"] |
| 631 | 644 |
| 632 return ret | 645 return ret |
| 633 | 646 |
| 634 class ThreadSanitizerPosix(ThreadSanitizerBase, ValgrindTool): | 647 class ThreadSanitizerPosix(ThreadSanitizerBase, ValgrindTool): |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 | 816 |
| 804 if __name__ == "__main__": | 817 if __name__ == "__main__": |
| 805 if sys.argv.count("-v") > 0 or sys.argv.count("--verbose") > 0: | 818 if sys.argv.count("-v") > 0 or sys.argv.count("--verbose") > 0: |
| 806 logging_utils.config_root(logging.DEBUG) | 819 logging_utils.config_root(logging.DEBUG) |
| 807 else: | 820 else: |
| 808 logging_utils.config_root() | 821 logging_utils.config_root() |
| 809 # TODO(timurrrr): valgrind tools may use -v/--verbose as well | 822 # TODO(timurrrr): valgrind tools may use -v/--verbose as well |
| 810 | 823 |
| 811 ret = RunTool(sys.argv) | 824 ret = RunTool(sys.argv) |
| 812 sys.exit(ret) | 825 sys.exit(ret) |
| OLD | NEW |