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

Side by Side Diff: client/tools/buildbot_annotated_steps.py

Issue 8341112: Cleanup buildbot_annotated_steps.py to run and test at the top level. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 #!/usr/bin/python 5 #!/usr/bin/python
6 6
7 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 7 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
8 # Use of this source code is governed by a BSD-style license that can be 8 # Use of this source code is governed by a BSD-style license that can be
9 # found in the LICENSE file. 9 # found in the LICENSE file.
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 # latest dartium location 28 # latest dartium location
29 DARTIUM_VERSION_FILE = 'tests/drt/LAST_VERSION' 29 DARTIUM_VERSION_FILE = 'tests/drt/LAST_VERSION'
30 DARTIUM_V_MATCHER = ( 30 DARTIUM_V_MATCHER = (
31 'gs://dartium-archive/[^/]*/dartium-\w*-inc-([0-9]*).([0-9]*).zip') 31 'gs://dartium-archive/[^/]*/dartium-\w*-inc-([0-9]*).([0-9]*).zip')
32 32
33 # Patterns are of the form "dart_client-linux-ia32-debug" 33 # Patterns are of the form "dart_client-linux-ia32-debug"
34 BUILDER_PATTERN = r'dart_client-(\w+)-(\w+)-(\w+)' 34 BUILDER_PATTERN = r'dart_client-(\w+)-(\w+)-(\w+)'
35 35
36 36
37 def GetBuildInfo(srcpath): 37 def GetBuildInfo():
38 """Returns a tuple (name, version, arch, mode, platform) where: 38 """Returns a tuple (name, version, arch, mode, platform) where:
39 - name: A name for the build - the buildbot host if a buildbot. 39 - name: A name for the build - the buildbot host if a buildbot.
40 - version: A version string corresponding to this build. 40 - version: A version string corresponding to this build.
41 - component: 'dartium' (default) or 'chromium' 41 - component: 'dartium' (default) or 'chromium'
42 - mode: 'debug' or 'release' (default) 42 - mode: 'debug' or 'release' (default)
43 - platform: 'linux' or 'mac' 43 - platform: 'linux' or 'mac'
44 """ 44 """
45 name = None 45 name = None
46 version = None 46 version = None
47 mode = 'release' 47 mode = 'release'
48 component = 'dartium' 48 component = 'dartium'
49 platform = 'linux' 49 platform = 'linux'
50 50
51 # Populate via builder environment variables. 51 # Populate via builder environment variables.
52 name = os.environ.get(BUILDER_NAME) 52 name = os.environ.get(BUILDER_NAME)
53 version = os.environ.get(REVISION) 53 version = os.environ.get(REVISION)
54 54
55 if name: 55 if name:
56 pattern = re.match(BUILDER_PATTERN, name) 56 pattern = re.match(BUILDER_PATTERN, name)
57 if pattern: 57 if pattern:
58 platform = pattern.group(1) 58 platform = pattern.group(1)
59 component = pattern.group(2) 59 component = pattern.group(2)
60 mode = pattern.group(3) 60 mode = pattern.group(3)
61 61
62 # Fall back if not on builder. 62 # Fall back if not on builder.
63 if not name: 63 if not name:
64 name = socket.gethostname().split('.')[0] 64 name = socket.gethostname().split('.')[0]
65 if not version: 65 if not version:
66 os.chdir(srcpath)
67 pipe = subprocess.Popen( 66 pipe = subprocess.Popen(
68 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 67 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
69 output = pipe.communicate() 68 output = pipe.communicate()
70 if pipe.returncode == 0: 69 if pipe.returncode == 0:
71 version = output[0] 70 version = output[0]
72 else: 71 else:
73 version = 'unknown' 72 version = 'unknown'
74 return (name, version, component, mode, platform) 73 return (name, version, component, mode, platform)
75 74
76 75
77 def RunDartcCompiler(client_path, mode, outdir): 76 def RunDartcCompiler(mode, outdir):
78 """Compiles the client code to javascript for dartc tests.""" 77 """Compiles the client code to javascript for dartc tests."""
79 # Move to the client directory and call the build script
80 os.chdir(client_path)
81 return subprocess.call( 78 return subprocess.call(
82 [sys.executable, '../tools/build.py', '--mode=' + mode]) 79 [sys.executable, './tools/build.py', '--mode=' + mode])
83 80
84 def RunBrowserTests(client_path, component, mode, platform): 81 def RunBrowserTests(component, mode, platform):
85 """Runs the Dart client tests.""" 82 """Runs the Dart client tests."""
86 if platform == 'linux': 83 if platform == 'linux':
87 cmd = ['xvfb-run'] 84 cmd = ['xvfb-run']
88 else: 85 else:
89 cmd = [] 86 cmd = []
90 # Move to the client directory and call the test script 87 cmd += [sys.executable, './tools/test.py',
91 os.chdir(client_path)
92 cmd += [sys.executable, '../tools/test.py',
93 '--component=' + component, '--mode=' + mode, 88 '--component=' + component, '--mode=' + mode,
94 '--time', '--report', '--progress=buildbot', '-v'] 89 '--time', '--report', '--progress=buildbot', '-v']
95 return subprocess.call(cmd) 90 return subprocess.call(cmd)
96 91
97 def GetUtils(srcpath): 92 def GetUtils():
98 ''' 93 '''
99 dynamically get the utils module 94 dynamically get the utils module
100 We use a dynamic import for tools/util.py because we derive its location 95 We use a dynamic import for tools/util.py because we derive its location
101 dynamically using sys.argv[0]. This allows us to run this script from 96 dynamically using sys.argv[0]. This allows us to run this script from
102 different directories. 97 different directories.
103 98
104 args: 99 args:
105 srcpath - the location of the source code to build
106 ''' 100 '''
107 sys.path.append(os.path.abspath(os.path.join(srcpath, '..', 'tools'))) 101 sys.path.append(os.path.abspath(os.path.join('.', 'tools')))
108 utils = __import__('utils') 102 utils = __import__('utils')
109 return utils 103 return utils
110 104
111 def GetOutDir(utils, mode, name): 105 def GetOutDir(utils, mode):
112 ''' 106 '''
113 get the location to place the output 107 get the location to place the output
114 108
115 args: 109 args:
116 utils - the tools/utils.py module 110 utils - the tools/utils.py module
117 mode - the mode release or debug 111 mode - the mode release or debug
118 name - the name of the builder
119 ''' 112 '''
120 return utils.GetBuildRoot(utils.GuessOS(), mode, name) 113 return utils.GetBuildRoot(utils.GuessOS(), mode, utils.ARCH_GUESS)
121 114
122 def ProcessDartClientTests(srcpath, component, mode, platform, name): 115 def ProcessDartClientTests(component, mode, platform, name):
123 ''' 116 '''
124 build and test the dart client applications 117 build and test the dart client applications
125 118
126 args: 119 args:
127 srcpath - the location of the source code to build
128 component - the component we are testing against 120 component - the component we are testing against
129 mode - the mode release or debug 121 mode - the mode release or debug
130 platform - the platform we are building for 122 platform - the platform we are building for
131 ''' 123 '''
132 print 'ProcessDartClientTests' 124 print 'ProcessDartClientTests'
133 if component == 'chromium': 125 if component == 'chromium':
134 print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name) 126 print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name)
135 127
136 utils = GetUtils(srcpath) 128 utils = GetUtils()
137 outdir = GetOutDir(utils, mode, "dartc") 129 outdir = GetOutDir(utils, mode)
138 status = RunDartcCompiler(srcpath, mode, outdir) 130 status = RunDartcCompiler(mode, outdir)
139 if status != 0: 131 if status != 0:
140 return status 132 return status
141 133
142 if component == 'dartium': 134 if component == 'dartium':
143 version_file = os.path.join(srcpath, DARTIUM_VERSION_FILE) 135 if os.path.exists(DARTIUM_VERSION_FILE):
144 if os.path.exists(version_file):
145 latest = open(version_file, 'r').read() 136 latest = open(version_file, 'r').read()
146 match = re.match(DARTIUM_V_MATCHER, latest) 137 match = re.match(DARTIUM_V_MATCHER, latest)
147 if match: 138 if match:
148 print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % ( 139 print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % (
149 match.group(2), match.group(1)) 140 match.group(2), match.group(1))
150 print '@@@BUILD_STEP browser unit tests@@@' 141 print '@@@BUILD_STEP browser unit tests@@@'
151 return RunBrowserTests(srcpath, component, mode, platform) 142 return RunBrowserTests(component, mode, platform)
152 143
153 def ProcessTools(srcpath, mode, name, version): 144 def ProcessTools(mode, name, version):
154 ''' 145 '''
155 build and test the tools 146 build and test the tools
156 147
157 args: 148 args:
158 srcpath - the location of the source code to build 149 srcpath - the location of the source code to build
159 mode - the mode release or debug 150 mode - the mode release or debug
160 version - the svn version of the currently checked out code 151 version - the svn version of the currently checked out code
161 ''' 152 '''
162 print 'ProcessTools' 153 print 'ProcessTools'
163 154
164 toolsBuildScript = os.path.join(srcpath, '..', 'editor', 'build', 'build.py') 155 toolsBuildScript = os.path.join('.', 'editor', 'build', 'build.py')
165 156
166 #TODO: debug statements to be removed in the future. 157 #TODO: debug statements to be removed in the future.
167 print "srcpath = " + srcpath
168 print "mode = " + mode 158 print "mode = " + mode
169 print "name = " + name 159 print "name = " + name
170 print "version = " + version 160 print "version = " + version
171 print "toolsBuildScript = " + os.path.abspath(toolsBuildScript) 161 print "toolsBuildScript = " + os.path.abspath(toolsBuildScript)
172 162
173 utils = GetUtils(srcpath) 163 utils = GetUtils()
174 outdir = GetOutDir(utils, mode, "tools") 164 outdir = GetOutDir(utils, mode)
175 cmds = [sys.executable, toolsBuildScript, 165 cmds = [sys.executable, toolsBuildScript,
176 '--mode=' + mode, '--revision=' + version, 166 '--mode=' + mode, '--revision=' + version,
177 '--name=' + name, '--out=' + outdir] 167 '--name=' + name, '--out=' + outdir]
178 return subprocess.call(cmds) 168 return subprocess.call(cmds)
179 169
180 def ProcessFrog(srcpath): 170 def ProcessFrog():
181 ''' 171 '''
182 build and test experimental frog build 172 build and test experimental frog build
183
184 args:
185 srcpath - the location of the source code to build
186 ''' 173 '''
187 print 'ProcessFrog' 174 print 'ProcessFrog'
188 175
189 return subprocess.call([sys.executable, 176 return subprocess.call([sys.executable,
190 os.path.join(srcpath, '..', 'frog', 177 os.path.join('frog', 'scripts', 'buildbot_annotated_steps.py')])
191 'scripts', 'buildbot_annotated_steps.py')])
192 178
193 def main(): 179 def main():
194 print 'main' 180 print 'main'
195 if len(sys.argv) == 0: 181 if len(sys.argv) == 0:
196 print 'Script pathname not known, giving up.' 182 print 'Script pathname not known, giving up.'
197 return 1 183 return 1
198 184
199 scriptdir = os.path.dirname(sys.argv[0]) 185 scriptdir = os.path.dirname(sys.argv[0])
200 srcpath = os.path.abspath(os.path.join(scriptdir, '..')) 186 # Get at the top-level directory. This script is in client/tools
187 os.chdir(os.path.abspath(os.path.join(scriptdir, os.pardir, os.pardir)))
201 188
202 (name, version, component, mode, platform) = GetBuildInfo(srcpath) 189 (name, version, component, mode, platform) = GetBuildInfo()
203 if name == 'dart-editor': 190 if name == 'dart-editor':
204 status = ProcessTools(srcpath, mode, name, version) 191 status = ProcessTools(mode, name, version)
205 #TODO(sigmund): remove this indirection once we update out bots 192 #TODO(sigmund): remove this indirection once we update our bots
206 elif name.startswith('frog'): 193 elif name.startswith('frog'):
207 status = ProcessFrog(srcpath) 194 status = ProcessFrog()
208 else: 195 else:
209 status = ProcessDartClientTests(srcpath, component, mode, platform, name) 196 status = ProcessDartClientTests(component, mode, platform, name)
210 197
211 if status: 198 if status:
212 print '@@@STEP_FAILURE@@@' 199 print '@@@STEP_FAILURE@@@'
213 200
214 return status 201 return status
215 202
216 203
217 if __name__ == '__main__': 204 if __name__ == '__main__':
218 sys.exit(main()) 205 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