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

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

Issue 8408002: Add a new variable environment for testing, to replace the misusage of 'arch'. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
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
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 20 matching lines...) Expand all
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(srcpath):
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 - arch: '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 arch = '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 arch = 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) 66 os.chdir(srcpath)
67 pipe = subprocess.Popen( 67 pipe = subprocess.Popen(
68 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 68 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
69 output = pipe.communicate() 69 output = pipe.communicate()
70 if pipe.returncode == 0: 70 if pipe.returncode == 0:
71 version = output[0] 71 version = output[0]
72 else: 72 else:
73 version = 'unknown' 73 version = 'unknown'
74 return (name, version, arch, mode, platform) 74 return (name, version, component, mode, platform)
75 75
76 76
77 def RunDartcCompiler(client_path, mode, outdir): 77 def RunDartcCompiler(client_path, mode, outdir):
78 """Compiles the client code to javascript for dartc tests.""" 78 """Compiles the client code to javascript for dartc tests."""
79 # Move to the client directory and call the build script 79 # Move to the client directory and call the build script
80 os.chdir(client_path) 80 os.chdir(client_path)
81 return subprocess.call( 81 return subprocess.call(
82 [sys.executable, '../tools/build.py', '--mode=' + mode]) 82 [sys.executable, '../tools/build.py', '--mode=' + mode])
83 83
84 def RunBrowserTests(client_path, arch, mode, platform): 84 def RunBrowserTests(client_path, component, mode, platform):
85 """Runs the Dart client tests.""" 85 """Runs the Dart client tests."""
86 if platform == 'linux': 86 if platform == 'linux':
87 cmd = ['xvfb-run'] 87 cmd = ['xvfb-run']
88 else: 88 else:
89 cmd = [] 89 cmd = []
90 # Move to the client directory and call the test script 90 # Move to the client directory and call the test script
91 os.chdir(client_path) 91 os.chdir(client_path)
92 cmd += [sys.executable, '../tools/test.py', 92 cmd += [sys.executable, '../tools/test.py',
93 '--arch=' + arch, '--mode=' + mode, 93 '--component=' + component, '--mode=' + mode,
94 '--time', '--report', '--progress=buildbot', '-v'] 94 '--time', '--report', '--progress=buildbot', '-v']
95 return subprocess.call(cmd) 95 return subprocess.call(cmd)
96 96
97 def GetUtils(srcpath): 97 def GetUtils(srcpath):
98 ''' 98 '''
99 dynamically get the utils module 99 dynamically get the utils module
100 We use a dynamic import for tools/util.py because we derive its location 100 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 101 dynamically using sys.argv[0]. This allows us to run this script from
102 different directories. 102 different directories.
103 103
104 args: 104 args:
105 srcpath - the location of the source code to build 105 srcpath - the location of the source code to build
106 ''' 106 '''
107 sys.path.append(os.path.abspath(os.path.join(srcpath, '..', 'tools'))) 107 sys.path.append(os.path.abspath(os.path.join(srcpath, '..', 'tools')))
108 utils = __import__('utils') 108 utils = __import__('utils')
109 return utils 109 return utils
110 110
111 def GetOutDir(utils, mode, name): 111 def GetOutDir(utils, mode, name):
112 ''' 112 '''
113 get the location to place the output 113 get the location to place the output
114 114
115 args: 115 args:
116 utils - the tools/utils.py module 116 utils - the tools/utils.py module
117 mode - the mode release or debug 117 mode - the mode release or debug
118 name - the name of the builder 118 name - the name of the builder
119 ''' 119 '''
120 return utils.GetBuildRoot(utils.GuessOS(), mode, name) 120 return utils.GetBuildRoot(utils.GuessOS(), mode, name)
121 121
122 def ProcessDartClientTests(srcpath, arch, mode, platform, name): 122 def ProcessDartClientTests(srcpath, component, mode, platform, name):
123 ''' 123 '''
124 build and test the dart client applications 124 build and test the dart client applications
125 125
126 args: 126 args:
127 srcpath - the location of the source code to build 127 srcpath - the location of the source code to build
128 arch - the architecture we are building for 128 component - the component we are testing against
129 mode - the mode release or debug 129 mode - the mode release or debug
130 platform - the platform we are building for 130 platform - the platform we are building for
131 ''' 131 '''
132 print 'ProcessDartClientTests' 132 print 'ProcessDartClientTests'
133 if arch == 'chromium': 133 if component == 'chromium':
134 print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name) 134 print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name)
135 135
136 utils = GetUtils(srcpath) 136 utils = GetUtils(srcpath)
137 outdir = GetOutDir(utils, mode, "dartc") 137 outdir = GetOutDir(utils, mode, "dartc")
138 status = RunDartcCompiler(srcpath, mode, outdir) 138 status = RunDartcCompiler(srcpath, mode, outdir)
139 if status != 0: 139 if status != 0:
140 return status 140 return status
141 141
142 if arch == 'dartium': 142 if component == 'dartium':
143 version_file = os.path.join(srcpath, DARTIUM_VERSION_FILE) 143 version_file = os.path.join(srcpath, DARTIUM_VERSION_FILE)
144 if os.path.exists(version_file): 144 if os.path.exists(version_file):
145 latest = open(version_file, 'r').read() 145 latest = open(version_file, 'r').read()
146 match = re.match(DARTIUM_V_MATCHER, latest) 146 match = re.match(DARTIUM_V_MATCHER, latest)
147 if match: 147 if match:
148 print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % ( 148 print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % (
149 match.group(2), match.group(1)) 149 match.group(2), match.group(1))
150 print '@@@BUILD_STEP browser unit tests@@@' 150 print '@@@BUILD_STEP browser unit tests@@@'
151 return RunBrowserTests(srcpath, arch, mode, platform) 151 return RunBrowserTests(srcpath, component, mode, platform)
152 152
153 def ProcessTools(srcpath, mode, name, version): 153 def ProcessTools(srcpath, mode, name, version):
154 ''' 154 '''
155 build and test the tools 155 build and test the tools
156 156
157 args: 157 args:
158 srcpath - the location of the source code to build 158 srcpath - the location of the source code to build
159 mode - the mode release or debug 159 mode - the mode release or debug
160 version - the svn version of the currently checked out code 160 version - the svn version of the currently checked out code
161 ''' 161 '''
(...skipping 30 matching lines...) Expand all
192 192
193 def main(): 193 def main():
194 print 'main' 194 print 'main'
195 if len(sys.argv) == 0: 195 if len(sys.argv) == 0:
196 print 'Script pathname not known, giving up.' 196 print 'Script pathname not known, giving up.'
197 return 1 197 return 1
198 198
199 scriptdir = os.path.dirname(sys.argv[0]) 199 scriptdir = os.path.dirname(sys.argv[0])
200 srcpath = os.path.abspath(os.path.join(scriptdir, '..')) 200 srcpath = os.path.abspath(os.path.join(scriptdir, '..'))
201 201
202 (name, version, arch, mode, platform) = GetBuildInfo(srcpath) 202 (name, version, component, mode, platform) = GetBuildInfo(srcpath)
203 if name == 'dart-editor': 203 if name == 'dart-editor':
204 status = ProcessTools(srcpath, mode, name, version) 204 status = ProcessTools(srcpath, mode, name, version)
205 #TODO(sigmund): remove this indirection once we update out bots 205 #TODO(sigmund): remove this indirection once we update out bots
206 elif name.startswith('frog'): 206 elif name.startswith('frog'):
207 status = ProcessFrog(srcpath) 207 status = ProcessFrog(srcpath)
208 else: 208 else:
209 status = ProcessDartClientTests(srcpath, arch, mode, platform, name) 209 status = ProcessDartClientTests(srcpath, component, mode, platform, name)
210 210
211 if status: 211 if status:
212 print '@@@STEP_FAILURE@@@' 212 print '@@@STEP_FAILURE@@@'
213 213
214 return status 214 return status
215 215
216 216
217 if __name__ == '__main__': 217 if __name__ == '__main__':
218 sys.exit(main()) 218 sys.exit(main())
OLDNEW
« no previous file with comments | « dart/client/tests/dartc/dartc.status ('k') | dart/compiler/javatests/com/google/dart/corelib/SharedTests.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698