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

Unified Diff: tools/run-valgrind.py

Issue 1585093002: [test] Clean up valgrind runner. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Skip reachability Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run-valgrind.py
diff --git a/tools/run-valgrind.py b/tools/run-valgrind.py
index f25f7a113c576e7ed6d53739ad5a6970af6c3159..e3f84f58fed3fc7effa6b825520f637f4d5e0c0d 100755
--- a/tools/run-valgrind.py
+++ b/tools/run-valgrind.py
@@ -29,23 +29,47 @@
# Simple wrapper for running valgrind and checking the output on
# stderr for memory leaks.
+# Uses valgrind from third_party/valgrind. Assumes the executable is passed
+# with a path relative to the v8 root.
+
+from os import path
+import platform
+import re
import subprocess
import sys
-import re
+
+V8_ROOT = path.dirname(path.dirname(path.abspath(__file__)))
+MACHINE = 'linux_x64' if platform.machine() == 'x86_64' else 'linux_x86'
+VALGRIND_ROOT = path.join(V8_ROOT, 'third_party', 'valgrind', MACHINE)
+VALGRIND_BIN = path.join(VALGRIND_ROOT, 'bin', 'valgrind')
+VALGRIND_LIB = path.join(VALGRIND_ROOT, 'lib', 'valgrind')
VALGRIND_ARGUMENTS = [
- 'valgrind',
+ VALGRIND_BIN,
'--error-exitcode=1',
'--leak-check=full',
- '--smc-check=all'
+ '--smc-check=all',
]
+if len(sys.argv) < 2:
+ print 'Please provide an executable to analyze.'
+ sys.exit(1)
+
+executable = path.join(V8_ROOT, sys.argv[1])
+if not path.exists(executable):
+ print 'Cannot find the file specified: %s' % executable
+ sys.exit(1)
+
# Compute the command line.
-command = VALGRIND_ARGUMENTS + sys.argv[1:]
+command = VALGRIND_ARGUMENTS + [executable] + sys.argv[2:]
# Run valgrind.
-process = subprocess.Popen(command, stderr=subprocess.PIPE)
+process = subprocess.Popen(
+ command,
+ stderr=subprocess.PIPE,
+ env={'VALGRIND_LIB': VALGRIND_LIB}
+)
code = process.wait();
errors = process.stderr.readlines();
@@ -74,4 +98,5 @@ if len(leaks) < 2 or len(leaks) > 3:
sys.exit(1)
# No leaks found.
+sys.stderr.writelines(errors)
sys.exit(0)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698