summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/valgrind_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/valgrind/valgrind_test.py')
-rwxr-xr-xtools/valgrind/valgrind_test.py51
1 files changed, 30 insertions, 21 deletions
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