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 optparse | 10 import optparse |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 "and --test %s" % test) | 48 "and --test %s" % test) |
49 | 49 |
50 self._options = options | 50 self._options = options |
51 self._args = args | 51 self._args = args |
52 | 52 |
53 # Compute the top of the tree (the "source dir") from the script dir | 53 # Compute the top of the tree (the "source dir") from the script dir |
54 # (where this script lives). We assume that the script dir is in | 54 # (where this script lives). We assume that the script dir is in |
55 # tools/drmemory/scripts relative to the top of the tree. | 55 # tools/drmemory/scripts relative to the top of the tree. |
56 script_dir = os.path.dirname(path_utils.ScriptDir()) | 56 script_dir = os.path.dirname(path_utils.ScriptDir()) |
57 self._source_dir = os.path.dirname(os.path.dirname(script_dir)) | 57 self._source_dir = os.path.dirname(os.path.dirname(script_dir)) |
| 58 # Setup Dr. Memory if it's not set up yet. |
| 59 drmem_cmd = os.getenv("DRMEMORY_COMMAND") |
| 60 if not drmem_cmd: |
| 61 drmem_sfx = os.path.join(script_dir, "drmemory-windows-sfx.exe") |
| 62 if not os.path.isfile(drmem_sfx): |
| 63 raise RuntimeError, "Cannot find drmemory-windows-sfx.exe" |
| 64 drmem_dir = os.path.join(script_dir, "unpacked") |
| 65 subprocess.call([drmem_sfx, "-o" + drmem_dir, "-y"], 0) |
| 66 drmem_cmd = os.path.join(drmem_dir, "bin", "drmemory.exe") |
| 67 os.environ["DRMEMORY_COMMAND"] = drmem_cmd |
58 # since this path is used for string matching, make sure it's always | 68 # since this path is used for string matching, make sure it's always |
59 # an absolute Unix-style path | 69 # an absolute Unix-style path |
60 self._source_dir = os.path.abspath(self._source_dir).replace('\\', '/') | 70 self._source_dir = os.path.abspath(self._source_dir).replace('\\', '/') |
61 valgrind_test_script = os.path.join(script_dir, "valgrind_test.py") | |
62 self._command_preamble = ["--source-dir=%s" % (self._source_dir)] | 71 self._command_preamble = ["--source-dir=%s" % (self._source_dir)] |
63 | 72 |
64 if not self._options.build_dir: | 73 if not self._options.build_dir: |
65 dirs = [ | 74 dirs = [ |
66 os.path.join(self._source_dir, "xcodebuild", "Debug"), | 75 os.path.join(self._source_dir, "xcodebuild", "Debug"), |
67 os.path.join(self._source_dir, "out", "Debug"), | 76 os.path.join(self._source_dir, "out", "Debug"), |
68 os.path.join(self._source_dir, "build", "Debug"), | 77 os.path.join(self._source_dir, "build", "Debug"), |
69 ] | 78 ] |
70 build_dir = [d for d in dirs if os.path.isdir(d)] | 79 build_dir = [d for d in dirs if os.path.isdir(d)] |
71 if len(build_dir) > 1: | 80 if len(build_dir) > 1: |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 395 |
387 for t in options.test: | 396 for t in options.test: |
388 tests = ChromeTests(options, args, t) | 397 tests = ChromeTests(options, args, t) |
389 ret = tests.Run() | 398 ret = tests.Run() |
390 if ret: return ret | 399 if ret: return ret |
391 return 0 | 400 return 0 |
392 | 401 |
393 | 402 |
394 if __name__ == "__main__": | 403 if __name__ == "__main__": |
395 sys.exit(_main()) | 404 sys.exit(_main()) |
OLD | NEW |