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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/chromedriver/test_expectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/run_buildbot_steps.py
diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py
index 87f560036e795eaf47dff7abf60ed2bfd573b886..51e1a1d338470bf00cbf8917d1b4b09a48103fe3 100755
--- a/chrome/test/chromedriver/run_buildbot_steps.py
+++ b/chrome/test/chromedriver/run_buildbot_steps.py
@@ -8,6 +8,7 @@
import optparse
import os
import subprocess
+import shutil
import sys
import urllib2
import zipfile
@@ -130,7 +131,36 @@ def MaybeRelease(revision):
print '@@@STEP_FAILURE@@@'
+def KillChromes(chrome_path):
+ chrome_map = {
+ 'win': 'chrome.exe',
+ 'mac': 'Chromium',
+ 'linux': 'chrome',
+ }
+ if util.IsWindows():
+ cmd = ['taskkill', '/F', '/IM']
+ else:
+ cmd = ['pkill', '-9']
+ cmd.Append(chrome_map[util.GetPlatformName()])
+ util.RunCommand(cmd)
+
+
+def CleanTmpDir():
+ 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.
+ print 'cleaning temp directory:', tmp_dir
+ for file_name in os.listdir(tmp_dir):
+ if not os.path.isdir(os.path.join(tmp_dir, file_name)):
+ continue
+ if file_name.startswith('jetty-0.0.0.0-') or file_name.startswith('tmp'):
+ print 'deleting sub-directory', file_name
+ shutil.rmtree(os.path.join(tmp_dir, file_name), True)
+
+
def main():
+ CleanTmpDir()
+ if not options.android_package:
+ KillChromes()
+
parser = optparse.OptionParser()
parser.add_option(
'', '--android-package',
« 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