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..739234a7edd15e21d192d9675090be9a8cb5cccf 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,23 @@ 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 instrumentation-based tools |
| + # if `nm` is available. |
|
Alexander Potapenko
2014/10/02 15:19:49
I think this line isn't necessary anymore.
|
| + try: |
| + nm_output = subprocess.check_output(["nm", exe_path]) |
| + if nm_output.find("__asan_init") != -1: |
|
Alexander Potapenko
2014/10/02 15:19:49
Please at least add a TODO about TSan and MSan.
|
| + raise BadBinary("You're trying to run an executable instrumented " |
| + "with AddressSanitizer under %s. Please provide " |
| + "an uninstrumented executable." % tool_name) |
| + except OSError: |
| + pass |
| + |
| + 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") |