summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 16:54:42 +0000
committerdkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 16:54:42 +0000
commitdfa86c0d6e8a537d9829a822fea151198f3d7b87 (patch)
tree5b24d89ed64980718e2cadd35c0529571d431bb7 /tools
parentcd465733a5b88674e4c0f9ff8a8a498c545dcee5 (diff)
downloadchromium_src-dfa86c0d6e8a537d9829a822fea151198f3d7b87.zip
chromium_src-dfa86c0d6e8a537d9829a822fea151198f3d7b87.tar.gz
chromium_src-dfa86c0d6e8a537d9829a822fea151198f3d7b87.tar.bz2
Patch from kcc to add a --custom_valgrind_command flag, for use with e.g. thread race detection tools
(From issue 95004) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/valgrind/chrome_tests.py5
-rwxr-xr-xtools/valgrind/valgrind_test.py51
2 files changed, 35 insertions, 21 deletions
diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py
index 52106d6..f0e4e3f 100755
--- a/tools/valgrind/chrome_tests.py
+++ b/tools/valgrind/chrome_tests.py
@@ -144,6 +144,9 @@ class ChromeTests:
cmd.append("--track_origins")
if self._options.generate_suppressions:
cmd.append("--generate_suppressions")
+ if self._options.custom_valgrind_command:
+ cmd.append("--custom_valgrind_command=%s"
+ % self._options.custom_valgrind_command)
if valgrind_test_args != None:
for arg in valgrind_test_args:
cmd.append(arg)
@@ -363,6 +366,8 @@ def _main(_):
parser.add_option("", "--generate_suppressions", action="store_true",
default=False,
help="Skip analysis and generate suppressions")
+ parser.add_option("", "--custom_valgrind_command",
+ help="Use custom valgrind command and options")
# My machine can do about 120 layout tests/hour in release mode.
# Let's do 30 minutes worth per run.
# The CPU is mostly idle, so perhaps we can raise this when
diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py
index 04d6bc6..0d63b47 100755
--- a/tools/valgrind/valgrind_test.py
+++ b/tools/valgrind/valgrind_test.py
@@ -76,6 +76,8 @@ class Valgrind(object):
self._parser.add_option("", "--generate_suppressions", action="store_true",
default=False,
help="Skip analysis and generate suppressions")
+ self._parser.add_option("", "--custom_valgrind_command",
+ help="Use custom valgrind command and options")
self._parser.add_option("-v", "--verbose", action="store_true", default=False,
help="verbose output - enable debug log messages")
self._parser.description = __doc__
@@ -187,34 +189,41 @@ class ValgrindLinux(Valgrind):
def ValgrindCommand(self):
"""Get the valgrind command to run."""
# note that self._args begins with the exe to be run
- proc = ["valgrind", "--smc-check=all", "--leak-check=full",
- "--num-callers=30"]
- if self._options.show_all_leaks:
- proc += ["--show-reachable=yes"];
+ if self._options.custom_valgrind_command:
+ # take the full valgrind command from --custom_valgrind_command
+ proc = self._options.custom_valgrind_command.split()
+ else:
+ # construct the valgrind command
+ proc = ["valgrind", "--smc-check=all", "--leak-check=full",
+ "--num-callers=30"]
- if self._options.track_origins:
- proc += ["--track-origins=yes"];
+ if self._options.show_all_leaks:
+ proc += ["--show-reachable=yes"];
- if self._options.trace_children:
- proc += ["--trace-children=yes"];
+ if self._options.track_origins:
+ proc += ["--track-origins=yes"];
- # Either generate suppressions or load them.
- if self._generate_suppressions:
- proc += ["--gen-suppressions=all"]
- else:
- proc += ["--xml=yes"]
+ if self._options.trace_children:
+ proc += ["--trace-children=yes"];
- suppression_count = 0
- for suppression_file in self._suppressions:
- if os.path.exists(suppression_file):
- suppression_count += 1
- proc += ["--suppressions=%s" % suppression_file]
+ # Either generate suppressions or load them.
+ if self._generate_suppressions:
+ proc += ["--gen-suppressions=all"]
+ else:
+ proc += ["--xml=yes"]
- if not suppression_count:
- logging.warning("WARNING: NOT USING SUPPRESSIONS!")
+ suppression_count = 0
+ for suppression_file in self._suppressions:
+ if os.path.exists(suppression_file):
+ suppression_count += 1
+ proc += ["--suppressions=%s" % suppression_file]
+
+ if not suppression_count:
+ logging.warning("WARNING: NOT USING SUPPRESSIONS!")
- proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"]
+ proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"]
+ # The Valgrind command is constructed.
if self._options.indirect:
# The program being run invokes Python or something else