OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import inspect | 4 import inspect |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import socket | 7 import socket |
8 import sys | 8 import sys |
9 import time | 9 import time |
10 | 10 |
11 | 11 |
12 class TimeoutException(Exception): | 12 class TimeoutException(Exception): |
13 pass | 13 pass |
14 | 14 |
15 | 15 |
16 def GetBaseDir(): | 16 def GetBaseDir(): |
17 main_module = sys.modules['__main__'] | 17 main_module = sys.modules['__main__'] |
18 if hasattr(main_module, '__file__'): | 18 if hasattr(main_module, '__file__'): |
19 return os.path.dirname(os.path.abspath(main_module.__file__)) | 19 return os.path.dirname(os.path.realpath(main_module.__file__)) |
20 else: | 20 else: |
21 return os.getcwd() | 21 return os.getcwd() |
22 | 22 |
23 | 23 |
24 def GetTelemetryDir(): | 24 def GetTelemetryDir(): |
25 return os.path.normpath(os.path.join( | 25 return os.path.normpath(os.path.join( |
26 __file__, os.pardir, os.pardir, os.pardir)) | 26 os.path.realpath(__file__), os.pardir, os.pardir, os.pardir)) |
27 | 27 |
28 | 28 |
29 def GetUnittestDataDir(): | 29 def GetUnittestDataDir(): |
30 return os.path.join(GetTelemetryDir(), 'unittest_data') | 30 return os.path.join(GetTelemetryDir(), 'unittest_data') |
31 | 31 |
32 | 32 |
33 def GetChromiumSrcDir(): | 33 def GetChromiumSrcDir(): |
34 return os.path.normpath(os.path.join(GetTelemetryDir(), os.pardir, os.pardir)) | 34 return os.path.normpath(os.path.join(GetTelemetryDir(), os.pardir, os.pardir)) |
35 | 35 |
36 | 36 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 chrome_root = GetChromiumSrcDir() | 151 chrome_root = GetChromiumSrcDir() |
152 for build_dir, build_type in GetBuildDirectories(): | 152 for build_dir, build_type in GetBuildDirectories(): |
153 candidate = os.path.join(chrome_root, build_dir, build_type, binary_name) | 153 candidate = os.path.join(chrome_root, build_dir, build_type, binary_name) |
154 if os.path.isfile(candidate) and os.access(candidate, required_mode): | 154 if os.path.isfile(candidate) and os.access(candidate, required_mode): |
155 candidate_mtime = os.stat(candidate).st_mtime | 155 candidate_mtime = os.stat(candidate).st_mtime |
156 if candidate_mtime > command_mtime: | 156 if candidate_mtime > command_mtime: |
157 command = candidate | 157 command = candidate |
158 command_mtime = candidate_mtime | 158 command_mtime = candidate_mtime |
159 | 159 |
160 return command | 160 return command |
OLD | NEW |