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

Side by Side Diff: tools/get_drt.py

Issue 9652026: Download the DRT archive instead of the full dartium (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed error message Created 8 years, 9 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 | 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 # 2 #
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is
8 # used for running browser tests of client applications. 8 # used for running browser tests of client applications.
9 9
10 import os 10 import os
11 import sys 11 import sys
12 import platform 12 import platform
13 import errno 13 import errno
14 import tempfile 14 import tempfile
15 import shutil 15 import shutil
16 import subprocess 16 import subprocess
17 17
18 def NormJoin(path1, path2): 18 def NormJoin(path1, path2):
19 return os.path.normpath(os.path.join(path1, path2)) 19 return os.path.normpath(os.path.join(path1, path2))
20 20
21 # Change into the dart directory as we want the project to be rooted here. 21 # Change into the dart directory as we want the project to be rooted here.
22 dart_src = NormJoin(os.path.dirname(sys.argv[0]), os.pardir) 22 dart_src = NormJoin(os.path.dirname(sys.argv[0]), os.pardir)
23 os.chdir(dart_src) 23 os.chdir(dart_src)
24 24
25 GSUTIL_DIR = 'third_party/gsutil/20110627' 25 GSUTIL_DIR = 'third_party/gsutil/20110627'
26 GSUTIL = GSUTIL_DIR + '/gsutil' 26 GSUTIL = GSUTIL_DIR + '/gsutil'
27 DRT_DIR = 'client/tests/drt' 27 DRT_DIR = 'client/tests/drt'
28 VERSION = DRT_DIR + '/LAST_VERSION' 28 VERSION = DRT_DIR + '/LAST_VERSION'
29 DRT_DARTIUM_LATEST_PATTERN = ( 29 DRT_DARTIUM_LATEST_PATTERN = (
30 'gs://dartium-archive/latest/dartium-%(osname)s-inc-*.zip') 30 'gs://dartium-archive/latest/drt-%(osname)s-inc-*.zip')
31 DRT_DARTIUM_PERMANENT_PREFIX = 'gs://dartium-archive/dartium-%(osname)s-inc' 31 DRT_DARTIUM_PERMANENT_PREFIX = 'gs://dartium-archive/drt-%(osname)s-inc'
32 DRT_CHROMIUM_LATEST_PATTERN = (
33 'gs://dart-dump-render-tree/latest/chromium-%(osname)s-103752.zip')
34 32
35 sys.path.append(GSUTIL_DIR + '/boto') 33 sys.path.append(GSUTIL_DIR + '/boto')
36 import boto 34 import boto
37 35
38 36
39 def execute_command(*cmd): 37 def execute_command(*cmd):
40 """Execute a command in a subprocess.""" 38 """Execute a command in a subprocess."""
41 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 39 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
42 output, error = pipe.communicate() 40 output, error = pipe.communicate()
43 return pipe.returncode, output 41 return pipe.returncode, output
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 # Query for the lastest version 107 # Query for the lastest version
110 pattern = DRT_DARTIUM_LATEST_PATTERN % { 'osname' : osname } 108 pattern = DRT_DARTIUM_LATEST_PATTERN % { 'osname' : osname }
111 result, out = gsutil('ls', pattern) 109 result, out = gsutil('ls', pattern)
112 if result == 0: 110 if result == 0:
113 latest = out.split()[-1] 111 latest = out.split()[-1]
114 # use permanent link instead, just in case the latest zip entry gets deleted 112 # use permanent link instead, just in case the latest zip entry gets deleted
115 # while we are downloading it. 113 # while we are downloading it.
116 latest = (DRT_DARTIUM_PERMANENT_PREFIX % { 'osname' : osname } 114 latest = (DRT_DARTIUM_PERMANENT_PREFIX % { 'osname' : osname }
117 + latest[latest.rindex('/'):]) 115 + latest[latest.rindex('/'):])
118 else: # e.g. no access 116 else: # e.g. no access
119 pattern = DRT_CHROMIUM_LATEST_PATTERN % { 'osname' : osname } 117 print "Couldn't download DumpRenderTree: %s\n%s" % (pattern, out)
120 result, out = gsutil('ls', pattern) 118 if not os.path.exists(VERSION):
121 if result == 0: 119 print "Tests using DumpRenderTree will not work. Please try again later."
122 latest = out.split()[-1] 120 return 0
123 else:
124 print "Couldn't download DumpRenderTree: %s\n%s" % (pattern, out)
125 if not os.path.exists(VERSION):
126 print "Tests using arch=chromium will not work. Please try again later."
127 return 0
128 121
129 # Check if we need to update the file 122 # Check if we need to update the file
130 if os.path.exists(VERSION): 123 if os.path.exists(VERSION):
131 v = open(VERSION, 'r').read() 124 v = open(VERSION, 'r').read()
132 if v == latest: 125 if v == latest:
133 if not in_runhooks(): 126 if not in_runhooks():
134 print 'DumpRenderTree is up to date.\nVersion: ' + latest 127 print 'DumpRenderTree is up to date.\nVersion: ' + latest
135 return 0 # up to date 128 return 0 # up to date
136 129
137 if os.path.exists(DRT_DIR): 130 if os.path.exists(DRT_DIR):
(...skipping 19 matching lines...) Expand all
157 # create the version stamp 150 # create the version stamp
158 v = open(VERSION, 'w') 151 v = open(VERSION, 'w')
159 v.write(latest) 152 v.write(latest)
160 v.close() 153 v.close()
161 154
162 print 'Successfully downloaded to %s' % DRT_DIR 155 print 'Successfully downloaded to %s' % DRT_DIR
163 return 0 156 return 0
164 157
165 if __name__ == '__main__': 158 if __name__ == '__main__':
166 sys.exit(main()) 159 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