Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: tools/valgrind/valgrind_test.py

Issue 45053: When running ui_tests, need to tell valgrind to also trace child processes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/test/ui/ui_test.cc ('K') | « tools/valgrind/chrome_tests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/valgrind/valgrind_test.py
===================================================================
--- tools/valgrind/valgrind_test.py (revision 12555)
+++ tools/valgrind/valgrind_test.py (working copy)
@@ -15,7 +15,9 @@
import optparse
import os
import shutil
+import stat
import sys
+import tempfile
import common
@@ -58,6 +60,12 @@
self._parser.add_option("", "--gtest_print_time", action="store_true",
default=False,
help="show how long each test takes")
+ self._parser.add_option("", "--trace_children", action="store_true",
+ default=False,
+ help="also trace child processes")
+ self._parser.add_option("", "--indirect", action="store_true",
+ default=False,
+ help="set BROWSER_WRAPPER rather than running valgrind directly")
Dean McNamee 2009/03/27 11:34:55 80 cols
self._parser.add_option("", "--show_all_leaks", action="store_true",
default=False,
help="also show less blatant leaks")
@@ -177,6 +185,9 @@
if self._options.show_all_leaks:
proc += ["--show-reachable=yes"];
+ if self._options.trace_children:
+ proc += ["--trace-children=yes"];
+
# Either generate suppressions or load them.
if self._generate_suppressions:
proc += ["--gen-suppressions=all"]
@@ -192,7 +203,26 @@
if not suppression_count:
logging.warning("WARNING: NOT USING SUPPRESSIONS!")
- proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"] + self._args
+ proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"]
+
+ if self._options.indirect:
+ # The program being run invokes Python or something else
+ # that can't stand to be valgrinded, and also invokes
+ # the Chrome browser. Set an environment variable to
+ # tell the program to prefix the Chrome commandline
+ # with a magic wrapper. Build the magic wrapper here.
+ (fd, indirect_fname) = tempfile.mkstemp(dir=self.TMP_DIR, prefix="browser_wrapper.", text=True)
+ f = os.fdopen(fd, "w");
+ f.write("#!/bin/sh\n")
+ f.write(" ".join(proc))
+ f.write(' "$@"\n')
+ f.close()
+ os.chmod(indirect_fname, stat.S_IRUSR|stat.S_IXUSR)
+ os.putenv("BROWSER_WRAPPER", indirect_fname)
+ logging.info('export BROWSER_WRAPPER=' + indirect_fname);
+ proc = []
+
+ proc += self._args
return proc
« chrome/test/ui/ui_test.cc ('K') | « tools/valgrind/chrome_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698