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

Unified Diff: tools/valgrind/chrome_tests.py

Issue 624533003: Check that the user doesn't try to run ASan-built binaries under Valgrind etc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 2 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/valgrind/chrome_tests.py
diff --git a/tools/valgrind/chrome_tests.py b/tools/valgrind/chrome_tests.py
index c90b60d4d6dce8288c67b2d38e8564c632b96c5b..54d27abadf7a11c4583c927ce957b7a3b1214cac 100755
--- a/tools/valgrind/chrome_tests.py
+++ b/tools/valgrind/chrome_tests.py
@@ -11,6 +11,7 @@ import multiprocessing
import optparse
import os
import stat
+import subprocess
import sys
import logging_utils
@@ -27,6 +28,10 @@ class BuildDirNotFound(Exception): pass
class BuildDirAmbiguous(Exception): pass
+class ExecutableNotFound(Exception): pass
+
+class BadBinary(Exception): pass
+
class ChromeTests:
SLOW_TOOLS = ["memcheck", "tsan", "tsan_rv", "drmemory"]
LAYOUT_TESTS_DEFAULT_CHUNK_SIZE = 300
@@ -115,7 +120,20 @@ class ChromeTests:
cmd.append(arg)
if exe:
self._EnsureBuildDirFound()
- cmd.append(os.path.join(self._options.build_dir, exe))
+ exe_path = os.path.join(self._options.build_dir, exe)
+ if not os.path.exists(exe_path):
+ raise ExecutableNotFound("Couldn't find '%s'" % exe_path)
+
+ # Make sure we don't try to test ASan-built binaries with other dynamic
+ # tools if `nm` is available.
+ if subprocess.call(["which", "nm"]) == 0:
Alexander Potapenko 2014/10/02 13:19:08 just wrapping subprocess.check_output() into a try
+ nm_output = subprocess.check_output(["nm", exe_path])
+ if nm_output.find("__asan_init") != -1:
+ raise BadBinary("You're trying to run an executable instrumented "
+ "with AddressSanitizer under %s. Please provide "
+ "an uninstrumented executable." % tool_name)
+
+ cmd.append(exe_path)
# Valgrind runs tests slowly, so slow tests hurt more; show elapased time
# so we can find the slowpokes.
cmd.append("--gtest_print_time")
« 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