diff options
Diffstat (limited to 'deps/v8/tools')
-rwxr-xr-x | deps/v8/tools/run-valgrind.py | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/deps/v8/tools/run-valgrind.py b/deps/v8/tools/run-valgrind.py index 49c1b7031..f8c23da6d 100755 --- a/deps/v8/tools/run-valgrind.py +++ b/deps/v8/tools/run-valgrind.py @@ -30,48 +30,36 @@ # Simple wrapper for running valgrind and checking the output on # stderr for memory leaks. +import os +import socket import subprocess import sys import re +VALGRIND = os.environ.get('VALGRIND', 'valgrind') + VALGRIND_ARGUMENTS = [ - 'valgrind', - '--error-exitcode=1', - '--leak-check=full', - '--smc-check=all' + VALGRIND, + '--log-socket=127.0.0.1:15151', + '--error-exitcode=247', + '--leak-check=no', + '--smc-check=all', ] -# Compute the command line. -command = VALGRIND_ARGUMENTS + sys.argv[1:] +server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +server.bind(('127.0.0.1', 15151)) +server.listen(1) -# Run valgrind. +command = VALGRIND_ARGUMENTS + sys.argv[1:] process = subprocess.Popen(command, stderr=subprocess.PIPE) -code = process.wait(); -errors = process.stderr.readlines(); - -# If valgrind produced an error, we report that to the user. -if code != 0: - sys.stderr.writelines(errors) - sys.exit(code) - -# Look through the leak details and make sure that we don't -# have any definitely, indirectly, and possibly lost bytes. -LEAK_RE = r"(?:definitely|indirectly|possibly) lost: " -LEAK_LINE_MATCHER = re.compile(LEAK_RE) -LEAK_OKAY_MATCHER = re.compile(r"lost: 0 bytes in 0 blocks") -leaks = [] -for line in errors: - if LEAK_LINE_MATCHER.search(line): - leaks.append(line) - if not LEAK_OKAY_MATCHER.search(line): - sys.stderr.writelines(errors) - sys.exit(1) -# Make sure we found between 2 and 3 leak lines. -if len(leaks) < 2 or len(leaks) > 3: - sys.stderr.writelines(errors) - sys.stderr.write('\n\n#### Malformed valgrind output.\n#### Exiting.\n') - sys.exit(1) +errors = '' +conn, addr = server.accept() +while True: + data = conn.recv(8192) + if not data: break + errors += data -# No leaks found. -sys.exit(0) +code = process.wait() +if code == 247: sys.stderr.writelines(errors) +sys.exit(code) |