Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: chrome/test/chromedriver/run_all_tests.py

Issue 16295017: [chromedriver] Use the chromedriver server when running run_py_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 all ChromeDriver end to end tests.""" 6 """Runs all ChromeDriver end to end tests."""
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
(...skipping 18 matching lines...) Expand all
29 path_cfg_file = 'C:\\tools\\bots_path.cfg' 29 path_cfg_file = 'C:\\tools\\bots_path.cfg'
30 if not os.path.exists(path_cfg_file): 30 if not os.path.exists(path_cfg_file):
31 print 'Failed to find file', path_cfg_file 31 print 'Failed to find file', path_cfg_file
32 with open(path_cfg_file, 'r') as cfg: 32 with open(path_cfg_file, 'r') as cfg:
33 paths = cfg.read().split('\n') 33 paths = cfg.read().split('\n')
34 os.environ['PATH'] = os.pathsep.join(paths) + os.pathsep + os.environ['PATH'] 34 os.environ['PATH'] = os.pathsep.join(paths) + os.pathsep + os.environ['PATH']
35 35
36 36
37 def _GenerateTestCommand(script, chromedriver, chrome=None, 37 def _GenerateTestCommand(script, chromedriver, chrome=None,
38 chrome_version=None, android_package=None): 38 chrome_version=None, android_package=None):
39 python = sys.executable
40 if util.IsMac():
41 # In Mac, chromedriver2.so is a 32-bit build, so run with 32-bit python.
42 # /usr/bin/python* are universal binaries, meaning they have multiple
43 # binaries in one file.
44 # To force to run with i386, there are two options:
45 # 1) run a versioned python (e.g., 2.6) and use arch -i386.
46 # 2) set VERSIONER_PYTHON_PREFER_32_BIT=yes and run unversioned python
47 os.environ['VERSIONER_PYTHON_PREFER_32_BIT'] = 'yes'
48 python = 'python'
49 cmd = [ 39 cmd = [
50 python, 40 sys.executable,
51 os.path.join(_THIS_DIR, script), 41 os.path.join(_THIS_DIR, script),
52 '--chromedriver=' + chromedriver, 42 '--chromedriver=' + chromedriver,
53 ] 43 ]
54 if chrome: 44 if chrome:
55 cmd.append('--chrome=' + chrome) 45 cmd.append('--chrome=' + chrome)
56 if chrome_version: 46 if chrome_version:
57 cmd.append('--chrome-version=' + chrome_version) 47 cmd.append('--chrome-version=' + chrome_version)
58 48
59 if android_package: 49 if android_package:
60 cmd.append('--android-package=' + android_package) 50 cmd.append('--android-package=' + android_package)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 '', '--android-package', 93 '', '--android-package',
104 help='Application package name, if running tests on Android.') 94 help='Application package name, if running tests on Android.')
105 # Option 'chrome-version' is for desktop only. 95 # Option 'chrome-version' is for desktop only.
106 parser.add_option( 96 parser.add_option(
107 '', '--chrome-version', 97 '', '--chrome-version',
108 help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.' 98 help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.'
109 'Default is to run tests against all of these versions.' 99 'Default is to run tests against all of these versions.'
110 'Notice: this option only applies to desktop.') 100 'Notice: this option only applies to desktop.')
111 options, _ = parser.parse_args() 101 options, _ = parser.parse_args()
112 102
113 chromedriver_map = { 103 postfix = ''
114 'win': 'chromedriver2.dll', 104 if util.IsWindows():
115 'mac': 'chromedriver2.so', 105 postfix = '.exe'
116 'linux': 'libchromedriver2.so', 106 cpp_tests_name = 'chromedriver2_tests' + postfix
117 } 107 server_name = 'chromedriver2_server' + postfix
118 chromedriver_name = chromedriver_map[util.GetPlatformName()]
119 108
120 if util.IsWindows(): 109 required_build_outputs = [server_name]
121 cpp_tests_name = 'chromedriver2_tests.exe'
122 server_name = 'chromedriver2_server.exe'
123 else:
124 cpp_tests_name = 'chromedriver2_tests'
125 server_name = 'chromedriver2_server'
126
127 required_build_outputs = [chromedriver_name]
128 if not options.android_package: 110 if not options.android_package:
129 required_build_outputs += [cpp_tests_name, server_name] 111 required_build_outputs += [cpp_tests_name]
130 build_dir = chrome_paths.GetBuildDir(required_build_outputs) 112 build_dir = chrome_paths.GetBuildDir(required_build_outputs)
131 print 'Using build outputs from', build_dir 113 print 'Using build outputs from', build_dir
132 114
133 chromedriver = os.path.join(build_dir, chromedriver_name)
134 chromedriver_server = os.path.join(build_dir, server_name) 115 chromedriver_server = os.path.join(build_dir, server_name)
135 116
136 if util.IsLinux(): 117 if util.IsLinux():
137 # Set LD_LIBRARY_PATH to enable successful loading of shared object files, 118 # Set LD_LIBRARY_PATH to enable successful loading of shared object files,
138 # when chromedriver2.so is not a static build. 119 # when chromedriver2.so is not a static build.
139 _AppendEnvironmentPath('LD_LIBRARY_PATH', os.path.join(build_dir, 'lib')) 120 _AppendEnvironmentPath('LD_LIBRARY_PATH', os.path.join(build_dir, 'lib'))
140 elif util.IsWindows(): 121 elif util.IsWindows():
141 # For Windows bots: add ant, java(jre) and the like to system path. 122 # For Windows bots: add ant, java(jre) and the like to system path.
142 _AddToolsToSystemPathForWindows() 123 _AddToolsToSystemPathForWindows()
143 124
144 if options.android_package: 125 if options.android_package:
145 os.environ['PATH'] += os.pathsep + os.path.join(_THIS_DIR, 'chrome') 126 os.environ['PATH'] += os.pathsep + os.path.join(_THIS_DIR, 'chrome')
146 code1 = RunPythonTests(chromedriver, 127 code1 = RunPythonTests(chromedriver_server,
147 android_package=options.android_package) 128 android_package=options.android_package)
148 code2 = RunJavaTests(chromedriver_server, 129 code2 = RunJavaTests(chromedriver_server,
149 android_package=options.android_package) 130 android_package=options.android_package)
150 return code1 or code2 131 return code1 or code2
151 else: 132 else:
152 latest_snapshot_revision = archive.GetLatestRevision(archive.Site.SNAPSHOT) 133 latest_snapshot_revision = archive.GetLatestRevision(archive.Site.SNAPSHOT)
153 versions = [ 134 versions = [
154 ['HEAD', latest_snapshot_revision], 135 ['HEAD', latest_snapshot_revision],
155 ['28', archive.CHROME_28_REVISION], 136 ['28', archive.CHROME_28_REVISION],
156 ['27', archive.CHROME_27_REVISION] 137 ['27', archive.CHROME_27_REVISION]
157 ] 138 ]
158 code = 0 139 code = 0
159 for version in versions: 140 for version in versions:
160 if options.chrome_version and version[0] != options.chrome_version: 141 if options.chrome_version and version[0] != options.chrome_version:
161 continue 142 continue
162 download_site = archive.Site.CONTINUOUS 143 download_site = archive.Site.CONTINUOUS
163 version_name = version[0] 144 version_name = version[0]
164 if version_name == 'HEAD': 145 if version_name == 'HEAD':
165 version_name = version[1] 146 version_name = version[1]
166 download_site = archive.Site.SNAPSHOT 147 download_site = archive.Site.SNAPSHOT
167 chrome_path = archive.DownloadChrome(version[1], 148 chrome_path = archive.DownloadChrome(version[1],
168 util.MakeTempDir(), 149 util.MakeTempDir(),
169 download_site) 150 download_site)
170 code1 = RunPythonTests(chromedriver, chrome=chrome_path, 151 code1 = RunPythonTests(chromedriver_server, chrome=chrome_path,
171 chrome_version=version[0], 152 chrome_version=version[0],
172 chrome_version_name=version_name) 153 chrome_version_name=version_name)
173 code2 = RunJavaTests(chromedriver_server, chrome=chrome_path, 154 code2 = RunJavaTests(chromedriver_server, chrome=chrome_path,
174 chrome_version=version[0], 155 chrome_version=version[0],
175 chrome_version_name=version_name) 156 chrome_version_name=version_name)
176 code = code or code1 or code2 157 code = code or code1 or code2
177 cpp_tests = os.path.join(build_dir, cpp_tests_name) 158 cpp_tests = os.path.join(build_dir, cpp_tests_name)
178 return RunCppTests(cpp_tests) or code 159 return RunCppTests(cpp_tests) or code
179 160
180 161
181 if __name__ == '__main__': 162 if __name__ == '__main__':
182 sys.exit(main()) 163 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698