Chromium Code Reviews| 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") |