summaryrefslogtreecommitdiffstats
path: root/tools/valgrind/memcheck_analyze.py
diff options
context:
space:
mode:
authortimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 12:39:34 +0000
committertimurrrr@chromium.org <timurrrr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-16 12:39:34 +0000
commitee1eac02c35a5e7ef9b7b5276007ed035f366c57 (patch)
treeb0cb1153189564a181de9352282b12d41febfe7d /tools/valgrind/memcheck_analyze.py
parent57d113097b57a6a21091840b6a1e889ab251de4c (diff)
downloadchromium_src-ee1eac02c35a5e7ef9b7b5276007ed035f366c57.zip
chromium_src-ee1eac02c35a5e7ef9b7b5276007ed035f366c57.tar.gz
chromium_src-ee1eac02c35a5e7ef9b7b5276007ed035f366c57.tar.bz2
Don't wait for dead valgrinds to end their logs
BUG=17453,44545 Review URL: http://codereview.chromium.org/2831008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/valgrind/memcheck_analyze.py')
-rwxr-xr-xtools/valgrind/memcheck_analyze.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/valgrind/memcheck_analyze.py b/tools/valgrind/memcheck_analyze.py
index 41bf4da..6961640 100755
--- a/tools/valgrind/memcheck_analyze.py
+++ b/tools/valgrind/memcheck_analyze.py
@@ -12,6 +12,7 @@ import gdb_helper
import logging
import optparse
import os
+import re
import subprocess
import sys
import time
@@ -368,14 +369,29 @@ class MemcheckAnalyze:
# Wait up to three minutes for valgrind to finish writing all files,
# but after that, just skip incomplete files and warn.
f = open(file, "r+")
+ pid = re.match(".*\.([0-9]+)$", file)
+ if pid:
+ pid = pid.groups()[0]
found = False
+ running = True
firstrun = True
origsize = os.path.getsize(file)
- while (not found and (firstrun or ((time.time() - start) < 180.0))):
+ while (running and not found and
+ (firstrun or ((time.time() - start) < 180.0))):
firstrun = False
f.seek(0)
+ if pid:
+ # Make sure the process is still running so we don't wait for
+ # 3 minutes if it was killed. See http://crbug.com/17453
+ ps_out = subprocess.Popen("ps p %s" % pid, shell=True,
+ stdout=subprocess.PIPE).stdout
+ if ps_out.readlines() < 2:
+ running = False
found = find_and_truncate(f)
- if not found:
+ if not running and not found:
+ logging.warn("Valgrind process PID = %s is not running but "
+ "its XML log has not been finished correctly." % pid)
+ if running and not found:
time.sleep(1)
f.close()
if not found: