OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 import glob | 23 import glob |
24 | 24 |
25 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | 25 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' |
26 REVISION = 'BUILDBOT_REVISION' | 26 REVISION = 'BUILDBOT_REVISION' |
27 | 27 |
28 # latest dartium location | 28 # latest dartium location |
29 DARTIUM_VERSION_FILE = 'client/tests/drt/LAST_VERSION' | 29 DARTIUM_VERSION_FILE = 'client/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" | |
34 BUILDER_PATTERN = r'dart_client-(\w+)-(\w+)-(\w+)' | |
35 | |
36 | |
37 def GetBuildInfo(): | 33 def GetBuildInfo(): |
38 """Returns a tuple (name, version, arch, mode, platform) where: | 34 """Returns a tuple (name, version, mode) where: |
39 - name: A name for the build - the buildbot host if a buildbot. | 35 - name: A name for the build - the buildbot host if a buildbot. |
40 - version: A version string corresponding to this build. | 36 - version: A version string corresponding to this build. |
41 - component: 'dartium' (default) or 'chromium' | |
42 - mode: 'debug' or 'release' (default) | |
43 - platform: 'linux' or 'mac' | |
44 """ | 37 """ |
45 name = None | 38 name = None |
46 version = None | 39 version = None |
47 mode = 'release' | |
48 component = 'dartium' | |
49 platform = 'linux' | |
50 | 40 |
51 # Populate via builder environment variables. | 41 # Populate via builder environment variables. |
52 name = os.environ.get(BUILDER_NAME) | 42 name = os.environ.get(BUILDER_NAME) |
53 version = os.environ.get(REVISION) | 43 version = os.environ.get(REVISION) |
54 | 44 |
55 if name: | |
56 pattern = re.match(BUILDER_PATTERN, name) | |
57 if pattern: | |
58 platform = pattern.group(1) | |
59 component = pattern.group(2) | |
60 mode = pattern.group(3) | |
61 | |
62 # Fall back if not on builder. | 45 # Fall back if not on builder. |
63 if not name: | 46 if not name: |
64 name = socket.gethostname().split('.')[0] | 47 name = socket.gethostname().split('.')[0] |
65 if not version: | 48 if not version: |
66 # In Windows we need to run in the shell, so that we have all the | 49 # In Windows we need to run in the shell, so that we have all the |
67 # environment variables available. | 50 # environment variables available. |
68 pipe = subprocess.Popen( | 51 pipe = subprocess.Popen( |
69 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 52 ['svnversion', '-n'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
70 shell=True) | 53 shell=True) |
71 output = pipe.communicate() | 54 output = pipe.communicate() |
72 if pipe.returncode == 0: | 55 if pipe.returncode == 0: |
73 version = output[0] | 56 version = output[0] |
74 else: | 57 else: |
75 version = 'unknown' | 58 version = 'unknown' |
76 return (name, version, component, mode, platform) | 59 return (name, version) |
77 | 60 |
78 | 61 |
79 def RunDartcCompiler(mode, outdir): | |
80 """Compiles the client code to javascript for dartc tests.""" | |
81 return subprocess.call( | |
82 [sys.executable, './tools/build.py', '--mode=' + mode, 'compiler']) | |
83 | |
84 def RunBrowserTests(component, mode, platform): | |
85 """Runs the Dart client tests.""" | |
86 if platform == 'linux': | |
87 cmd = ['xvfb-run'] | |
88 else: | |
89 cmd = [] | |
90 cmd += [sys.executable, './tools/test_wrapper.py', | |
91 '--component=' + component, '--mode=' + mode, | |
92 '--time', '--report', '--progress=buildbot', '-v'] | |
93 return subprocess.call(cmd) | |
94 | |
95 def GetUtils(): | 62 def GetUtils(): |
96 ''' | 63 ''' |
97 dynamically get the utils module | 64 dynamically get the utils module |
98 We use a dynamic import for tools/util.py because we derive its location | 65 We use a dynamic import for tools/util.py because we derive its location |
99 dynamically using sys.argv[0]. This allows us to run this script from | 66 dynamically using sys.argv[0]. This allows us to run this script from |
100 different directories. | 67 different directories. |
101 | 68 |
102 args: | 69 args: |
103 ''' | 70 ''' |
104 sys.path.append(os.path.abspath(os.path.join('.', 'tools'))) | 71 sys.path.append(os.path.abspath(os.path.join('.', 'tools'))) |
105 utils = __import__('utils') | 72 utils = __import__('utils') |
106 return utils | 73 return utils |
107 | 74 |
108 def GetOutDir(utils, mode): | 75 def GetOutDir(utils, mode): |
109 ''' | 76 ''' |
110 get the location to place the output | 77 get the location to place the output |
111 | 78 |
112 args: | 79 args: |
113 utils - the tools/utils.py module | 80 utils - the tools/utils.py module |
114 mode - the mode release or debug | 81 mode - the mode release or debug |
115 ''' | 82 ''' |
116 return utils.GetBuildRoot(utils.GuessOS(), mode, utils.ARCH_GUESS) | 83 return utils.GetBuildRoot(utils.GuessOS(), mode, utils.ARCH_GUESS) |
117 | 84 |
118 def ProcessDartClientTests(component, mode, platform, name): | |
119 ''' | |
120 build and test the dart client applications | |
121 | |
122 args: | |
123 component - the component we are testing against | |
124 mode - the mode release or debug | |
125 platform - the platform we are building for | |
126 ''' | |
127 print 'ProcessDartClientTests' | |
128 if component == 'chromium': | |
129 print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name) | |
130 | |
131 utils = GetUtils() | |
132 outdir = GetOutDir(utils, mode) | |
133 status = RunDartcCompiler(mode, outdir) | |
134 if status != 0: | |
135 return status | |
136 | |
137 if component == 'dartium': | |
138 if os.path.exists(DARTIUM_VERSION_FILE): | |
139 latest = open(DARTIUM_VERSION_FILE, 'r').read() | |
140 match = re.match(DARTIUM_V_MATCHER, latest) | |
141 if match: | |
142 print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % ( | |
143 match.group(2), match.group(1)) | |
144 print '@@@BUILD_STEP browser unit tests@@@' | |
145 return RunBrowserTests(component, mode, platform) | |
146 | |
147 def ProcessTools(mode, name, version): | 85 def ProcessTools(mode, name, version): |
148 ''' | 86 ''' |
149 build and test the tools | 87 build and test the tools |
150 | 88 |
151 args: | 89 args: |
152 srcpath - the location of the source code to build | 90 srcpath - the location of the source code to build |
153 mode - the mode release or debug | 91 mode - the mode release or debug |
154 version - the svn version of the currently checked out code | 92 version - the svn version of the currently checked out code |
155 ''' | 93 ''' |
156 print 'ProcessTools' | 94 print 'ProcessTools' |
(...skipping 20 matching lines...) Expand all Loading... |
177 | 115 |
178 return subprocess.call(cmds, env=local_env) | 116 return subprocess.call(cmds, env=local_env) |
179 | 117 |
180 def ProcessFrog(name): | 118 def ProcessFrog(name): |
181 ''' | 119 ''' |
182 build and test experimental frog build | 120 build and test experimental frog build |
183 ''' | 121 ''' |
184 print 'ProcessFrog' | 122 print 'ProcessFrog' |
185 has_shell=False | 123 has_shell=False |
186 if 'windows' in name: | 124 if 'windows' in name: |
187 os.environ['PATH'] = (os.path.join('C:', 'Program Files (x86)', 'nodejs') + | 125 os.environ['PATH'] = (os.path.join('C:', 'Program Files (x86)', 'nodejs') + |
188 os.pathsep + os.environ['PATH']) | 126 os.pathsep + os.environ['PATH']) |
189 # In Windows we need to run in the shell, so that we have all the | 127 # In Windows we need to run in the shell, so that we have all the |
190 # environment variables available. | 128 # environment variables available. |
191 has_shell=True | 129 has_shell=True |
192 return subprocess.call([sys.executable, | 130 return subprocess.call([sys.executable, |
193 os.path.join('frog', 'scripts', 'buildbot_annotated_steps.py')], | 131 os.path.join('frog', 'scripts', 'buildbot_annotated_steps.py')], |
194 env=os.environ, shell=has_shell) | 132 env=os.environ, shell=has_shell) |
195 | 133 |
196 def main(): | 134 def main(): |
197 print 'main' | 135 print 'main' |
198 if len(sys.argv) == 0: | 136 if len(sys.argv) == 0: |
199 print 'Script pathname not known, giving up.' | 137 print 'Script pathname not known, giving up.' |
200 return 1 | 138 return 1 |
201 | 139 |
202 scriptdir = os.path.dirname(sys.argv[0]) | 140 scriptdir = os.path.dirname(sys.argv[0]) |
203 # Get at the top-level directory. This script is in client/tools | 141 # Get at the top-level directory. This script is in client/tools |
204 os.chdir(os.path.abspath(os.path.join(scriptdir, os.pardir, os.pardir))) | 142 os.chdir(os.path.abspath(os.path.join(scriptdir, os.pardir, os.pardir))) |
205 | 143 |
206 (name, version, component, mode, platform) = GetBuildInfo() | 144 #TODO(sigmund): remove this indirection once we update our bots |
| 145 (name, version) = GetBuildInfo() |
207 if name.startswith('dart-editor'): | 146 if name.startswith('dart-editor'): |
208 status = ProcessTools(mode, name, version) | 147 status = ProcessTools('release', name, version) |
209 #TODO(sigmund): remove this indirection once we update our bots | 148 else: |
210 elif name.startswith('frog'): | |
211 status = ProcessFrog(name) | 149 status = ProcessFrog(name) |
212 else: | |
213 status = ProcessDartClientTests(component, mode, platform, name) | |
214 | 150 |
215 if status: | 151 if status: |
216 print '@@@STEP_FAILURE@@@' | 152 print '@@@STEP_FAILURE@@@' |
217 | 153 |
218 return status | 154 return status |
219 | 155 |
220 | 156 |
221 if __name__ == '__main__': | 157 if __name__ == '__main__': |
222 sys.exit(main()) | 158 sys.exit(main()) |
OLD | NEW |