summaryrefslogtreecommitdiff
path: root/deps/v8/tools
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-08-15 01:30:12 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-08-15 01:37:16 +0200
commit90ea68107a94b33e6b20cd9c2af8547b8c41da7c (patch)
tree370b5a6da701a3f57b1fcfb41d9117315981586b /deps/v8/tools
parentde32b38992b8adbf7a6b83f580b2cb60fe7b98af (diff)
downloadnode-90ea68107a94b33e6b20cd9c2af8547b8c41da7c.tar.gz
test: fix up `make valgrind-test`
* valgrind complained too much about memory leaks from the V8 heap to be useful, run it with --leak-check=no. Not ideal, needs to be revisited, preferably with a suppression file. * tools/run-valgrind.py didn't deal with tests that logged to stderr, rewrite the heuristic and make valgrind write to a socket instead of stderr. Fixes #3869.
Diffstat (limited to 'deps/v8/tools')
-rwxr-xr-xdeps/v8/tools/run-valgrind.py56
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)