diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-20 17:32:56 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-20 17:32:56 +0000 |
commit | a74c5c158304362c4da57e875917067a8ed6d48a (patch) | |
tree | ff742a097d5a256d2c628fca003a9427adcc480c | |
parent | a5202c98ef96a71be304140e0f2cc2dc81577be5 (diff) | |
download | chromium_src-a74c5c158304362c4da57e875917067a8ed6d48a.zip chromium_src-a74c5c158304362c4da57e875917067a8ed6d48a.tar.gz chromium_src-a74c5c158304362c4da57e875917067a8ed6d48a.tar.bz2 |
Add --show_all_leaks option.
Add --gtest_print_time option to valgrind_test.py and use it always in chrome_test.py, since we probably want to keep an eye out for tests that are too slow for valgrind.
Review URL: http://codereview.chromium.org/50055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12194 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/valgrind/chrome_tests.py | 8 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_analyze.py | 10 | ||||
-rwxr-xr-x | tools/valgrind/valgrind_test.py | 13 |
3 files changed, 24 insertions, 7 deletions
diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py index 538a48f..608a1b5 100755 --- a/tools/valgrind/chrome_tests.py +++ b/tools/valgrind/chrome_tests.py @@ -132,10 +132,15 @@ class ChromeTests: cmd.append("--baseline") if self._options.verbose: cmd.append("--verbose") + if self._options.show_all_leaks: + cmd.append("--show_all_leaks") if self._options.generate_suppressions: cmd.append("--generate_suppressions") if exe: cmd.append(os.path.join(self._options.build_dir, exe)) + # Valgrind runs tests slowly, so slow tests hurt more; show elapased time + # so we can find the slowpokes. + cmd.append("--gtest_print_time"); return cmd def Run(self): @@ -343,6 +348,9 @@ def _main(_): help="additional arguments to --gtest_filter") parser.add_option("-v", "--verbose", action="store_true", default=False, help="verbose output - enable debug log messages") + parser.add_option("", "--show_all_leaks", action="store_true", + default=False, + help="also show even less blatant leaks") parser.add_option("", "--no-reinstrument", action="store_true", default=False, help="Don't force a re-instrumentation for ui_tests") parser.add_option("", "--generate_suppressions", action="store_true", diff --git a/tools/valgrind/valgrind_analyze.py b/tools/valgrind/valgrind_analyze.py index d382bee..0a08306 100755 --- a/tools/valgrind/valgrind_analyze.py +++ b/tools/valgrind/valgrind_analyze.py @@ -128,23 +128,21 @@ class ValgrindAnalyze: ''' Given a set of Valgrind XML files, parse all the errors out of them, unique them and output the results.''' - def __init__(self, source_dir, files): + def __init__(self, source_dir, files, show_all_leaks=False): '''Reads in a set of files. Args: source_dir: Path to top of source tree for this build files: A list of filenames. + show_all_leaks: whether to show even less important leaks ''' self._errors = set() for file in files: raw_errors = parse(file).getElementsByTagName("error") for raw_error in raw_errors: - # Ignore reachable aka "possible" leaks for now. - # Annoyingly, Valgrind's --xml=yes option seems to - # force --leak-check=full --show-reachable=yes - kind = getTextOf(raw_error, "kind") - if (kind != "Leak_PossiblyLost"): + # Ignore "possible" leaks for now by default. + if (show_all_leaks or getTextOf(raw_error, "kind") != "Leak_PossiblyLost"): self._errors.add(ValgrindError(source_dir, raw_error)) def Report(self): diff --git a/tools/valgrind/valgrind_test.py b/tools/valgrind/valgrind_test.py index 4afb714..0910e0c 100755 --- a/tools/valgrind/valgrind_test.py +++ b/tools/valgrind/valgrind_test.py @@ -56,6 +56,12 @@ class Valgrind(object): help="path to a valgrind suppression file") self._parser.add_option("", "--gtest_filter", default="", help="which test case to run") + self._parser.add_option("", "--gtest_print_time", action="store_true", + default=False, + help="show how long each test takes") + self._parser.add_option("", "--show_all_leaks", action="store_true", + default=False, + help="also show less blatant leaks") self._parser.add_option("", "--generate_suppressions", action="store_true", default=False, help="Skip analysis and generate suppressions") @@ -72,6 +78,8 @@ class Valgrind(object): self._source_dir = self._options.source_dir if self._options.gtest_filter != "": self._args.append("--gtest_filter=%s" % self._options.gtest_filter) + if self._options.gtest_print_time: + self._args.append("--gtest_print_time"); if self._options.verbose: google.logging_utils.config_root(logging.DEBUG) else: @@ -108,7 +116,7 @@ class Valgrind(object): def Analyze(self): # Glob all the files in the "valgrind.tmp" directory filenames = glob.glob(self.TMP_DIR + "/valgrind.*") - analyzer = valgrind_analyze.ValgrindAnalyze(self._source_dir, filenames) + analyzer = valgrind_analyze.ValgrindAnalyze(self._source_dir, filenames, self._options.show_all_leaks) return analyzer.Report() def Cleanup(self): @@ -167,6 +175,9 @@ class ValgrindLinux(Valgrind): proc = ["valgrind", "--smc-check=all", "--leak-check=full", "--num-callers=30"] + if self._options.show_all_leaks: + proc += ["--show-reachable=yes"]; + # Either generate suppressions or load them. if self._generate_suppressions: proc += ["--gen-suppressions=all"] |