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

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

Issue 14301024: [chromedriver] Clean tmp directory and kill Chrome processes before each run cycle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/chromedriver/test_expectations » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 the buildbot steps for ChromeDriver except for update/compile.""" 6 """Runs all the buildbot steps for ChromeDriver except for update/compile."""
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import subprocess 10 import subprocess
11 import shutil
11 import sys 12 import sys
12 import urllib2 13 import urllib2
13 import zipfile 14 import zipfile
14 15
15 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) 16 _THIS_DIR = os.path.abspath(os.path.dirname(__file__))
16 sys.path.insert(0, os.path.join(_THIS_DIR, os.pardir, 'pylib')) 17 sys.path.insert(0, os.path.join(_THIS_DIR, os.pardir, 'pylib'))
17 18
18 from common import chrome_paths 19 from common import chrome_paths
19 from common import util 20 from common import util
20 21
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 '--project', 'chromedriver', 124 '--project', 'chromedriver',
124 '--user', 'chromedriver.bot@gmail.com', 125 '--user', 'chromedriver.bot@gmail.com',
125 '--label', 'Release', 126 '--label', 'Release',
126 zip_path 127 zip_path
127 ] 128 ]
128 with open(os.devnull, 'wb') as no_output: 129 with open(os.devnull, 'wb') as no_output:
129 if subprocess.Popen(cmd, stdout=no_output, stderr=no_output).wait(): 130 if subprocess.Popen(cmd, stdout=no_output, stderr=no_output).wait():
130 print '@@@STEP_FAILURE@@@' 131 print '@@@STEP_FAILURE@@@'
131 132
132 133
134 def KillChromes(chrome_path):
135 chrome_map = {
136 'win': 'chrome.exe',
137 'mac': 'Chromium',
138 'linux': 'chrome',
139 }
140 if util.IsWindows():
141 cmd = ['taskkill', '/F', '/IM']
142 else:
143 cmd = ['pkill', '-9']
144 cmd.Append(chrome_map[util.GetPlatformName()])
145 util.RunCommand(cmd)
146
147
148 def CleanTmpDir():
149 tmp_dir = os.path.dirname(util.MakeTempDir())
kkania 2013/04/29 22:54:30 tempfile.gettempdir()
chrisgao (Use stgao instead) 2013/04/30 00:55:29 Done.
150 print 'cleaning temp directory:', tmp_dir
151 for file_name in os.listdir(tmp_dir):
152 if not os.path.isdir(os.path.join(tmp_dir, file_name)):
153 continue
154 if file_name.startswith('jetty-0.0.0.0-') or file_name.startswith('tmp'):
155 print 'deleting sub-directory', file_name
156 shutil.rmtree(os.path.join(tmp_dir, file_name), True)
157
158
133 def main(): 159 def main():
160 CleanTmpDir()
161 if not options.android_package:
162 KillChromes()
163
134 parser = optparse.OptionParser() 164 parser = optparse.OptionParser()
135 parser.add_option( 165 parser.add_option(
136 '', '--android-package', 166 '', '--android-package',
137 help='Application package name, if running tests on Android.') 167 help='Application package name, if running tests on Android.')
138 parser.add_option( 168 parser.add_option(
139 '-r', '--revision', type='string', default=None, 169 '-r', '--revision', type='string', default=None,
140 help='Chromium revision') 170 help='Chromium revision')
141 options, _ = parser.parse_args() 171 options, _ = parser.parse_args()
142 172
143 if options.android_package: 173 if options.android_package:
(...skipping 14 matching lines...) Expand all
158 cmd.append('--android-package=' + options.android_package) 188 cmd.append('--android-package=' + options.android_package)
159 189
160 passed = (util.RunCommand(cmd) == 0) 190 passed = (util.RunCommand(cmd) == 0)
161 191
162 if not options.android_package and passed: 192 if not options.android_package and passed:
163 MaybeRelease(options.revision) 193 MaybeRelease(options.revision)
164 194
165 195
166 if __name__ == '__main__': 196 if __name__ == '__main__':
167 main() 197 main()
OLDNEW
« no previous file with comments | « no previous file | chrome/test/chromedriver/test_expectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698