Commit 9fd697a9 authored by dank@chromium.org's avatar dank@chromium.org

Fix tools/valgrind/chrome_tests.sh to always use --log-file option

so fork() doesn't corrupt log files; lets --generate_suppressions 
work even with the hacky valgrind fix that makes anything but --log-file
crash on child of fork().

Also avoid killing user desktop session if zygote dies!

BUG=none, but related to fix for http://crbug.com/15771
TEST=patch valgrind with fork workaround; sh tools/valgrind/chrome_tests.sh --generate_suppressions -t ui logs you out on linux without this.

Review URL: http://codereview.chromium.org/155130

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20024 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c3bcccb
...@@ -64,6 +64,12 @@ ProcessId GetProcId(ProcessHandle process) { ...@@ -64,6 +64,12 @@ ProcessId GetProcId(ProcessHandle process) {
// entry structure. Ignores specified exit_code; posix can't force that. // entry structure. Ignores specified exit_code; posix can't force that.
// Returns true if this is successful, false otherwise. // Returns true if this is successful, false otherwise.
bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) { bool KillProcess(ProcessHandle process_id, int exit_code, bool wait) {
DCHECK(process_id > 1);
if (process_id <= 1) {
LOG(ERROR) << "tried to kill process_id " << process_id;
return false;
}
bool result = kill(process_id, SIGTERM) == 0; bool result = kill(process_id, SIGTERM) == 0;
if (result && wait) { if (result && wait) {
......
...@@ -136,6 +136,19 @@ class Valgrind(object): ...@@ -136,6 +136,19 @@ class Valgrind(object):
def Analyze(self): def Analyze(self):
# Glob all the files in the "valgrind.tmp" directory # Glob all the files in the "valgrind.tmp" directory
filenames = glob.glob(self.TMP_DIR + "/valgrind.*") filenames = glob.glob(self.TMP_DIR + "/valgrind.*")
# TODO(dkegel): use new xml suppressions feature when it lands
if self._generate_suppressions:
# Just concatenate all the output files. Lame...
for filename in filenames:
print "## %s" % filename
f = file(filename)
while True:
line = f.readline()
if len(line) == 0:
break
print line, # comma means don't add newline
f.close()
return 0
analyzer = valgrind_analyze.ValgrindAnalyze(self._source_dir, filenames, self._options.show_all_leaks) analyzer = valgrind_analyze.ValgrindAnalyze(self._source_dir, filenames, self._options.show_all_leaks)
return analyzer.Report() return analyzer.Report()
...@@ -148,9 +161,6 @@ class Valgrind(object): ...@@ -148,9 +161,6 @@ class Valgrind(object):
def RunTestsAndAnalyze(self): def RunTestsAndAnalyze(self):
self.PrepareForTest() self.PrepareForTest()
self.Execute() self.Execute()
if self._generate_suppressions:
logging.info("Skipping analysis to let you look at the raw output...")
return 0
retcode = self.Analyze() retcode = self.Analyze()
if retcode: if retcode:
...@@ -224,11 +234,8 @@ class ValgrindLinux(Valgrind): ...@@ -224,11 +234,8 @@ class ValgrindLinux(Valgrind):
if not suppression_count: if not suppression_count:
logging.warning("WARNING: NOT USING SUPPRESSIONS!") logging.warning("WARNING: NOT USING SUPPRESSIONS!")
if not self._generate_suppressions: proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"]
# We don't currently collect suppressions from individual log files,
# so let it all go to stdout. This leads to occasional
# corruption; see above TODO.
proc += ["--log-file=" + self.TMP_DIR + "/valgrind.%p"]
# The Valgrind command is constructed. # The Valgrind command is constructed.
if self._options.indirect: if self._options.indirect:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment