OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Dart frog buildbot steps | 7 """Dart frog buildbot steps |
8 | 8 |
9 Runs tests for the frog compiler (running on the vm or the self-hosting version) | 9 Runs tests for the frog compiler (running on the vm or the self-hosting version) |
10 """ | 10 """ |
(...skipping 10 matching lines...) Expand all Loading... |
21 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 21 os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
22 | 22 |
23 DART2JS_BUILDER = r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?' | 23 DART2JS_BUILDER = r'dart2js-(linux|mac|windows)-(debug|release)(-([a-z]+))?' |
24 FROG_BUILDER = r'(frog|frogsh)-(linux|mac|windows)-(debug|release)' | 24 FROG_BUILDER = r'(frog|frogsh)-(linux|mac|windows)-(debug|release)' |
25 WEB_BUILDER = r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(\d+))?' | 25 WEB_BUILDER = r'web-(ie|ff|safari|chrome|opera)-(win7|win8|mac|linux)(-(\d+))?' |
26 | 26 |
27 NO_COLOR_ENV = dict(os.environ) | 27 NO_COLOR_ENV = dict(os.environ) |
28 NO_COLOR_ENV['TERM'] = 'nocolor' | 28 NO_COLOR_ENV['TERM'] = 'nocolor' |
29 | 29 |
30 def GetBuildInfo(): | 30 def GetBuildInfo(): |
31 """Returns a tuple (name, mode, system, browser, option) where: | 31 """Returns a tuple (compiler, runtime, mode, system, option) where: |
32 - name: 'dart2js', 'frog', 'frogsh', 'frogium', or None when the | 32 - compiler: 'dart2js', 'frog', 'frogsh', or None when the builder has an |
33 builder has an incorrect name | 33 incorrect name |
| 34 - runtime: 'd8', 'ie', 'ff', 'safari', 'chrome', 'opera' |
34 - mode: 'debug' or 'release' | 35 - mode: 'debug' or 'release' |
35 - system: 'linux', 'mac', or 'win7' | 36 - system: 'linux', 'mac', or 'win7' |
36 - browser: 'ie', 'ff', 'safari', 'chrome' | |
37 - option: 'checked' | 37 - option: 'checked' |
38 """ | 38 """ |
39 name = None | 39 compiler = None |
| 40 runtime = None |
40 mode = None | 41 mode = None |
41 system = None | 42 system = None |
42 browser = None | |
43 builder_name = os.environ.get(BUILDER_NAME) | 43 builder_name = os.environ.get(BUILDER_NAME) |
44 option = None | 44 option = None |
45 if builder_name: | 45 if builder_name: |
46 | 46 |
47 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) | 47 dart2js_pattern = re.match(DART2JS_BUILDER, builder_name) |
48 frog_pattern = re.match(FROG_BUILDER, builder_name) | 48 frog_pattern = re.match(FROG_BUILDER, builder_name) |
49 web_pattern = re.match(WEB_BUILDER, builder_name) | 49 web_pattern = re.match(WEB_BUILDER, builder_name) |
50 | 50 |
51 if dart2js_pattern: | 51 if dart2js_pattern: |
52 name = 'dart2js' | 52 compiler = 'dart2js' |
| 53 runtime = 'd8' |
53 system = dart2js_pattern.group(1) | 54 system = dart2js_pattern.group(1) |
54 mode = dart2js_pattern.group(2) | 55 mode = dart2js_pattern.group(2) |
55 option = dart2js_pattern.group(4) | 56 option = dart2js_pattern.group(4) |
56 | 57 |
57 elif frog_pattern: | 58 elif frog_pattern: |
58 name = frog_pattern.group(1) | 59 compiler = frog_pattern.group(1) |
| 60 runtime = 'd8' |
59 system = frog_pattern.group(2) | 61 system = frog_pattern.group(2) |
60 mode = frog_pattern.group(3) | 62 mode = frog_pattern.group(3) |
61 | 63 |
62 elif web_pattern: | 64 elif web_pattern: |
63 name = 'frogium' | 65 compiler = 'frog' |
| 66 runtime = web_pattern.grop(1) |
64 mode = 'release' | 67 mode = 'release' |
65 browser = web_pattern.group(1) | |
66 system = web_pattern.group(2) | 68 system = web_pattern.group(2) |
67 | 69 |
68 # TODO(jmesserly): do we want to do anything different for the second IE | 70 # TODO(jmesserly): do we want to do anything different for the second IE |
69 # bot? For now we're using it to track down flakiness. | 71 # bot? For now we're using it to track down flakiness. |
70 number = web_pattern.group(4) | 72 number = web_pattern.group(4) |
71 | 73 |
72 if system == 'windows': | 74 if system == 'windows': |
73 system = 'win7' | 75 system = 'win7' |
74 | 76 |
75 return (name, mode, system, browser, option) | 77 return (compiler, runtime, mode, system, option) |
76 | 78 |
77 | 79 |
78 def ComponentsNeedsXterm(component): | 80 def NeedsXterm(compiler, runtime): |
79 return component in ['frogsh', 'frogium', 'legium', 'webdriver'] | 81 return compiler == 'frogsh' or runtime in ['ie', 'chrome', 'safari', 'opera', |
| 82 'ff', 'drt'] |
80 | 83 |
81 def TestStep(name, mode, system, component, targets, flags): | 84 def TestStep(name, mode, system, compiler, runtime, targets, flags): |
82 print '@@@BUILD_STEP %s tests: %s %s@@@' % (name, component, ' '.join(flags)) | 85 print '@@@BUILD_STEP %s %s tests: %s %s@@@' % (name, compiler, runtime, |
| 86 ' '.join(flags)) |
83 sys.stdout.flush() | 87 sys.stdout.flush() |
84 if ComponentsNeedsXterm(component) and system == 'linux': | 88 if NeedsXterm(compiler, runtime) and system == 'linux': |
85 cmd = ['xvfb-run', '-a'] | 89 cmd = ['xvfb-run', '-a'] |
86 else: | 90 else: |
87 cmd = [] | 91 cmd = [] |
88 | 92 |
89 user_test = os.environ.get('USER_TEST', 'no') | 93 user_test = os.environ.get('USER_TEST', 'no') |
90 | 94 |
91 cmd.extend([sys.executable, | 95 cmd.extend([sys.executable, |
92 os.path.join(os.curdir, 'tools', 'test.py'), | 96 os.path.join(os.curdir, 'tools', 'test.py'), |
93 '--mode=' + mode, | 97 '--mode=' + mode, |
94 '--component=' + component, | 98 '--compiler=' + compiler, |
| 99 '--runtime=' + runtime, |
95 '--time', | 100 '--time', |
96 '--report']) | 101 '--report']) |
97 | 102 |
98 if user_test == 'yes': | 103 if user_test == 'yes': |
99 cmd.append('--progress=color') | 104 cmd.append('--progress=color') |
100 else: | 105 else: |
101 cmd.extend(['--progress=buildbot', '-v']) | 106 cmd.extend(['--progress=buildbot', '-v']) |
102 | 107 |
103 if flags: | 108 if flags: |
104 cmd.extend(flags) | 109 cmd.extend(flags) |
105 cmd.extend(targets) | 110 cmd.extend(targets) |
106 | 111 |
107 print 'running %s' % (' '.join(cmd)) | 112 print 'running %s' % (' '.join(cmd)) |
108 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 113 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
109 if exit_code != 0: | 114 if exit_code != 0: |
110 print '@@@STEP_FAILURE@@@' | 115 print '@@@STEP_FAILURE@@@' |
111 return exit_code | 116 return exit_code |
112 | 117 |
113 | 118 |
114 def BuildFrog(component, mode, system): | 119 def BuildFrog(compiler, mode, system): |
115 """ build frog. | 120 """ build frog. |
116 Args: | 121 Args: |
117 - component: either 'dart2js', 'frog', 'frogsh' (frog | 122 - compiler: either 'dart2js', 'frog', 'frogsh' (frog self-hosted) |
118 self-hosted), 'frogium' or 'legium' | |
119 - mode: either 'debug' or 'release' | 123 - mode: either 'debug' or 'release' |
120 - system: either 'linux', 'mac', or 'win7' | 124 - system: either 'linux', 'mac', or 'win7' |
121 """ | 125 """ |
122 | 126 |
123 os.chdir(DART_PATH) | 127 os.chdir(DART_PATH) |
124 | 128 |
125 print '@@@BUILD_STEP build frog@@@' | 129 print '@@@BUILD_STEP build frog@@@' |
126 | 130 |
127 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] | 131 args = [sys.executable, './tools/build.py', '--mode=' + mode, 'dart2js'] |
128 print 'running %s' % (' '.join(args)) | 132 print 'running %s' % (' '.join(args)) |
129 return subprocess.call(args, env=NO_COLOR_ENV) | 133 return subprocess.call(args, env=NO_COLOR_ENV) |
130 | 134 |
131 | 135 |
132 def TestFrog(component, mode, system, browser, option, flags): | 136 def TestFrog(compiler, runtime, mode, system, option, flags): |
133 """ test frog. | 137 """ test frog. |
134 Args: | 138 Args: |
135 - component: either 'dart2js', 'frog', 'frogsh' (frog | 139 - compiler: either 'dart2js', 'frog', or 'frogsh' (frog self-hosted) |
136 self-hosted), 'frogium', or 'legium' | 140 - runtime: either 'd8', or one of the browsers, see GetBuildInfo |
137 - mode: either 'debug' or 'release' | 141 - mode: either 'debug' or 'release' |
138 - system: either 'linux', 'mac', or 'win7' | 142 - system: either 'linux', 'mac', or 'win7' |
139 - browser: one of the browsers, see GetBuildInfo | |
140 - option: 'checked' | 143 - option: 'checked' |
141 - flags: extra flags to pass to test.dart | 144 - flags: extra flags to pass to test.dart |
142 """ | 145 """ |
143 | 146 |
144 # Make sure we are in the frog directory | 147 # Make sure we are in the frog directory |
145 os.chdir(DART_PATH) | 148 os.chdir(DART_PATH) |
146 | 149 |
147 # TODO(jmesserly): temporary workaround until we remove nodejs from the bots | 150 if compiler == 'dart2js': |
148 if system == 'win7': | |
149 os.environ['PATH'] += ';c:\\Program Files (x86)\\nodejs\\' | |
150 | |
151 if component == 'dart2js': | |
152 if (option == 'checked'): | 151 if (option == 'checked'): |
153 flags.append('--host-checked') | 152 flags.append('--host-checked') |
154 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 153 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
155 TestStep("dart2js_unit", mode, system, 'vm', ['leg'], ['--checked']) | 154 TestStep("dart2js_unit", mode, system, 'none', 'vm', ['leg'], ['--checked']) |
156 | 155 |
157 extra_suites = ['leg_only', 'frog_native'] | 156 extra_suites = ['leg_only', 'frog_native'] |
158 TestStep("dart2js_extra", mode, system, 'dart2js', extra_suites, flags) | 157 TestStep("dart2js_extra", mode, system, 'dart2js', runtime, extra_suites, |
| 158 flags) |
159 | 159 |
160 TestStep("dart2js", mode, system, 'dart2js', [], flags) | 160 TestStep("dart2js", mode, system, 'dart2js', runtime, [], flags) |
161 | 161 |
162 elif component != 'frogium': # frog and frogsh | 162 elif runtime == 'd8' and compiler in ['frog', 'frogsh']: |
163 TestStep("frog", mode, system, component, [], flags) | 163 TestStep("frog", mode, system, compiler, runtime, [], flags) |
164 TestStep("frog_extra", mode, system, | 164 TestStep("frog_extra", mode, system, compiler, runtime, |
165 component, ['frog', 'frog_native', 'peg', 'css'], flags) | 165 ['frog', 'frog_native', 'peg', 'css'], flags) |
166 TestStep("sdk", mode, system, | 166 TestStep("sdk", mode, system, 'none', 'vm', ['dartdoc'], flags) |
167 'vm', ['dartdoc'], flags) | |
168 | 167 |
169 else: | 168 else: |
170 tests = ['client', 'language', 'corelib', 'isolate', 'frog', | 169 tests = ['client', 'language', 'corelib', 'isolate', 'frog', |
171 'frog_native', 'peg', 'css'] | 170 'frog_native', 'peg', 'css'] |
172 | 171 |
173 # TODO(jmesserly): make DumpRenderTree more like other browser tests, so | |
174 # we don't have this translation step. See dartbug.com/1158. | |
175 # Ideally we can run most Chrome tests in DumpRenderTree because it's more | |
176 # debuggable, but still have some tests run the full browser. | |
177 # Also: we don't have DumpRenderTree on Windows yet | |
178 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable | 172 # TODO(efortuna): Move Mac back to DumpRenderTree when we have a more stable |
179 # solution for DRT. Right now DRT is flakier than regular Chrome for the | 173 # solution for DRT. Right now DRT is flakier than regular Chrome for the |
180 # isolate tests, so we're switching to use Chrome in the short term. | 174 # isolate tests, so we're switching to use Chrome in the short term. |
181 if browser == 'chrome' and system == 'linux': | 175 if runtime == 'chrome' and system == 'linux': |
182 TestStep('browser', mode, system, 'frogium', tests, flags) | 176 TestStep('browser', mode, system, 'frog', 'drt', tests, flags) |
183 TestStep('browser_dart2js', mode, system, 'legium', [], flags) | 177 TestStep('browser_dart2js', mode, system, 'dart2js', 'drt', [], flags) |
184 TestStep('browser_dart2js_extra', mode, system, 'legium', | 178 TestStep('browser_dart2js_extra', mode, system, 'dart2js', 'drt', |
185 ['leg_only', 'frog_native'], flags) | 179 ['leg_only', 'frog_native'], flags) |
186 else: | 180 else: |
187 additional_flags = ['--browser=' + browser] | 181 additional_flags = [] |
188 if system.startswith('win') and browser == 'ie': | 182 if system.startswith('win') and runtime == 'ie': |
189 # There should not be more than one InternetExplorerDriver instance | 183 # There should not be more than one InternetExplorerDriver instance |
190 # running at a time. For details, see | 184 # running at a time. For details, see |
191 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | 185 # http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
192 additional_flags += ['-j1'] | 186 additional_flags += ['-j1'] |
193 TestStep(browser, mode, system, 'webdriver', tests, | 187 TestStep(runtime, mode, system, compiler, runtime, tests, |
194 flags + additional_flags) | 188 flags + additional_flags) |
195 | 189 |
196 return 0 | 190 return 0 |
197 | 191 |
198 def _DeleteFirefoxProfiles(directory): | 192 def _DeleteFirefoxProfiles(directory): |
199 """Find all the firefox profiles in a particular directory and delete them.""" | 193 """Find all the firefox profiles in a particular directory and delete them.""" |
200 for f in os.listdir(directory): | 194 for f in os.listdir(directory): |
201 item = os.path.join(directory, f) | 195 item = os.path.join(directory, f) |
202 if os.path.isdir(item) and f.startswith('tmp'): | 196 if os.path.isdir(item) and f.startswith('tmp'): |
203 subprocess.Popen('rm -rf %s' % item, shell=True) | 197 subprocess.Popen('rm -rf %s' % item, shell=True) |
(...skipping 24 matching lines...) Expand all Loading... |
228 # password. The command won't actually work on regular machines without | 222 # password. The command won't actually work on regular machines without |
229 # root permissions. | 223 # root permissions. |
230 _DeleteFirefoxProfiles('/tmp') | 224 _DeleteFirefoxProfiles('/tmp') |
231 _DeleteFirefoxProfiles('/var/tmp') | 225 _DeleteFirefoxProfiles('/var/tmp') |
232 | 226 |
233 def main(): | 227 def main(): |
234 if len(sys.argv) == 0: | 228 if len(sys.argv) == 0: |
235 print 'Script pathname not known, giving up.' | 229 print 'Script pathname not known, giving up.' |
236 return 1 | 230 return 1 |
237 | 231 |
238 component, mode, system, browser, option = GetBuildInfo() | 232 compiler, runtime, mode, system, option = GetBuildInfo() |
239 print "component: %s, mode: %s, system: %s, browser: %s, option: %s" % ( | 233 print "compiler: %s, runtime: %s mode: %s, system: %s, option: %s" % ( |
240 component, mode, system, browser, option) | 234 compiler, runtime, mode, system, option) |
241 if component is None: | 235 if compiler is None: |
242 return 1 | 236 return 1 |
243 | 237 |
244 status = BuildFrog(component, mode, system) | 238 status = BuildFrog(compiler, mode, system) |
245 if status != 0: | 239 if status != 0: |
246 print '@@@STEP_FAILURE@@@' | 240 print '@@@STEP_FAILURE@@@' |
247 return status | 241 return status |
248 | 242 |
249 if component == 'dart2js': | 243 if compiler == 'dart2js': |
250 status = TestFrog(component, mode, system, browser, option, []) | 244 status = TestFrog(compiler, runtime, mode, system, option, []) |
251 if status != 0: | 245 if status != 0: |
252 print '@@@STEP_FAILURE@@@' | 246 print '@@@STEP_FAILURE@@@' |
253 return status # Return unconditionally for dart2js. | 247 return status # Return unconditionally for dart2js. |
254 | 248 |
255 if component != 'frogium' or (system == 'linux' and browser == 'chrome'): | 249 if runtime != 'd8' or (system == 'linux' and runtime == 'chrome'): |
256 status = TestFrog(component, mode, system, browser, None, []) | 250 status = TestFrog(compiler, runtime, mode, system, None, []) |
257 if status != 0: | 251 if status != 0: |
258 print '@@@STEP_FAILURE@@@' | 252 print '@@@STEP_FAILURE@@@' |
259 return status | 253 return status |
260 | 254 |
261 status = TestFrog(component, mode, system, browser, None, ['--checked']) | 255 status = TestFrog(compiler, runtime, mode, system, None, ['--checked']) |
262 if status != 0: | 256 if status != 0: |
263 print '@@@STEP_FAILURE@@@' | 257 print '@@@STEP_FAILURE@@@' |
264 | 258 |
265 if component == 'frogium': | 259 if component == 'frogium': |
266 CleanUpTemporaryFiles(system, browser) | 260 CleanUpTemporaryFiles(system, browser) |
267 return status | 261 return status |
268 | 262 |
269 | 263 |
270 if __name__ == '__main__': | 264 if __name__ == '__main__': |
271 sys.exit(main()) | 265 sys.exit(main()) |
OLD | NEW |