OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 ''' Runs various chrome tests through valgrind_test.py.''' | 6 ''' Runs various chrome tests through valgrind_test.py.''' |
7 | 7 |
8 import glob | 8 import glob |
9 import logging | 9 import logging |
10 import multiprocessing | 10 import multiprocessing |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 self._EnsureBuildDirFound() | 122 self._EnsureBuildDirFound() |
123 exe_path = os.path.join(self._options.build_dir, exe) | 123 exe_path = os.path.join(self._options.build_dir, exe) |
124 if not os.path.exists(exe_path): | 124 if not os.path.exists(exe_path): |
125 raise ExecutableNotFound("Couldn't find '%s'" % exe_path) | 125 raise ExecutableNotFound("Couldn't find '%s'" % exe_path) |
126 | 126 |
127 # Make sure we don't try to test ASan-built binaries | 127 # Make sure we don't try to test ASan-built binaries |
128 # with other dynamic instrumentation-based tools. | 128 # with other dynamic instrumentation-based tools. |
129 # TODO(timurrrr): also check TSan and MSan? | 129 # TODO(timurrrr): also check TSan and MSan? |
130 # `nm` might not be available, so use try-except. | 130 # `nm` might not be available, so use try-except. |
131 try: | 131 try: |
132 nm_output = subprocess.check_output(["nm", exe_path]) | 132 # Do not perform this check on OS X, as 'nm' on 10.6 can't handle |
133 if nm_output.find("__asan_init") != -1: | 133 # binaries built with Clang 3.5+. |
134 raise BadBinary("You're trying to run an executable instrumented " | 134 if not common.IsMac(): |
135 "with AddressSanitizer under %s. Please provide " | 135 nm_output = subprocess.check_output(["nm", exe_path]) |
136 "an uninstrumented executable." % tool_name) | 136 if nm_output.find("__asan_init") != -1: |
| 137 raise BadBinary("You're trying to run an executable instrumented " |
| 138 "with AddressSanitizer under %s. Please provide " |
| 139 "an uninstrumented executable." % tool_name) |
137 except OSError: | 140 except OSError: |
138 pass | 141 pass |
139 | 142 |
140 cmd.append(exe_path) | 143 cmd.append(exe_path) |
141 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time | 144 # Valgrind runs tests slowly, so slow tests hurt more; show elapased time |
142 # so we can find the slowpokes. | 145 # so we can find the slowpokes. |
143 cmd.append("--gtest_print_time") | 146 cmd.append("--gtest_print_time") |
144 # Built-in test launcher for gtest-based executables runs tests using | 147 # Built-in test launcher for gtest-based executables runs tests using |
145 # multiple process by default. Force the single-process mode back. | 148 # multiple process by default. Force the single-process mode back. |
146 cmd.append("--single-process-tests") | 149 cmd.append("--single-process-tests") |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 796 |
794 for t in options.test: | 797 for t in options.test: |
795 tests = ChromeTests(options, args, t) | 798 tests = ChromeTests(options, args, t) |
796 ret = tests.Run() | 799 ret = tests.Run() |
797 if ret: return ret | 800 if ret: return ret |
798 return 0 | 801 return 0 |
799 | 802 |
800 | 803 |
801 if __name__ == "__main__": | 804 if __name__ == "__main__": |
802 sys.exit(_main()) | 805 sys.exit(_main()) |
OLD | NEW |