Index: chrome/test/chromedriver/run_all_tests.py |
diff --git a/chrome/test/chromedriver/run_all_tests.py b/chrome/test/chromedriver/run_all_tests.py |
index e9717c593e4a4e4da36def7cc28417bd8e41dcce..5a8b95b90a3505d2bc6155c14ea2bef7b70a8e46 100755 |
--- a/chrome/test/chromedriver/run_all_tests.py |
+++ b/chrome/test/chromedriver/run_all_tests.py |
@@ -14,6 +14,31 @@ sys.path.insert(0, os.path.join(_THIS_DIR, os.pardir, 'pylib')) |
from common import chrome_paths |
from common import util |
+def _AppendEnvironmentPath(env_name, path): |
+ if env_name in os.environ: |
+ lib_path = os.environ[env_name] |
+ if path not in lib_path: |
+ os.environ[env_name] += os.pathsep + path |
+ else: |
+ os.environ[env_name] = path |
+ |
+def _FindChromeBinary(path): |
+ if util.IsLinux(): |
+ exes = ['chrome'] |
+ elif util.IsMac(): |
+ exes = [ |
+ 'Google Chrome.app/Contents/MacOS/Google Chrome', |
+ 'Chromium.app/Contents/MacOS/Chromium' |
+ ] |
+ elif util.IsWindows(): |
+ exes = ['chrome.exe'] |
+ else: |
+ exes = [] |
+ for exe in exes: |
+ binary = os.path.join(path, exe) |
+ if os.path.exists(binary): |
+ return binary |
+ return None |
def Main(): |
print '@@@BUILD_STEP chromedriver2_tests@@@' |
@@ -29,6 +54,17 @@ def Main(): |
os.path.join(_THIS_DIR, 'test.py'), |
os.path.join(build_dir, chromedriver), |
] |
+ # Set the built chrome binary. |
+ chrome_binary = _FindChromeBinary(build_dir) |
+ if chrome_binary is not None: |
+ cmd.append(chrome_binary) |
+ if util.IsLinux(): |
+ # Set LD_LIBRARY_PATH to enable successful loading of shared object files, |
+ # when chromedriver2.so is not a static build. |
+ _AppendEnvironmentPath('LD_LIBRARY_PATH', os.path.join(build_dir, 'lib')) |
+ elif util.IsMac(): |
+ # In Mac, chromedriver2.so is a 32-bit build, so run with the 32-bit python. |
+ os.environ['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes' |
code = util.RunCommand(cmd) |
if code != 0: |
print '@@@STEP_FAILURE@@@' |