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 """ |
11 | 11 |
12 import os | 12 import os |
13 import re | 13 import re |
14 import subprocess | 14 import subprocess |
15 import sys | 15 import sys |
16 | 16 |
17 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' | 17 BUILDER_NAME = 'BUILDBOT_BUILDERNAME' |
18 | 18 |
19 FROG_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 19 FROG_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
20 | 20 |
21 BUILDER_PATTERN = r'(frog|frogsh|frogium)-(linux|mac|windows)-(debug|release)' | 21 BUILDER_PATTERN = r'(frog|frogsh|frogium)-(linux|mac|windows)-(debug|release)' |
22 | 22 |
23 NO_COLOR_ENV = dict(os.environ) | 23 NO_COLOR_ENV = dict(os.environ) |
24 NO_COLOR_ENV['TERM'] = 'nocolor' | 24 NO_COLOR_ENV['TERM'] = 'nocolor' |
25 | 25 |
| 26 # Patterns are of the form "dart_client-linux-chromium-debug" |
| 27 OLD_BUILDER = r'dart_client-(\w+)-chromium-(\w+)' |
| 28 |
26 def GetBuildInfo(): | 29 def GetBuildInfo(): |
27 """Returns a tuple (name, mode, system) where: | 30 """Returns a tuple (name, mode, system) where: |
28 - name: 'frog', 'frogsh', or None when the builder has an incorrect name | 31 - name: 'frog', 'frogsh', 'frogium' or None when the builder has an |
| 32 incorrect name |
29 - mode: 'debug' or 'release' | 33 - mode: 'debug' or 'release' |
30 - system: 'linux', 'mac', or 'windows' | 34 - system: 'linux', 'mac', or 'windows' |
| 35 - browser: 'ie', 'ff', 'safari', 'chrome', 'chrome_drt' |
31 """ | 36 """ |
32 name = None | 37 name = None |
33 mode = None | 38 mode = None |
34 system = None | 39 system = None |
| 40 browser = None |
35 builder_name = os.environ.get(BUILDER_NAME) | 41 builder_name = os.environ.get(BUILDER_NAME) |
36 if builder_name: | 42 if builder_name: |
37 pattern = re.match(BUILDER_PATTERN, builder_name) | 43 pattern = re.match(BUILDER_PATTERN, builder_name) |
38 if pattern: | 44 if pattern: |
39 name = pattern.group(1) | 45 name = pattern.group(1) |
40 system = pattern.group(2) | 46 system = pattern.group(2) |
41 mode = pattern.group(3) | 47 mode = pattern.group(3) |
42 return (name, mode, system) | 48 |
| 49 # TODO(jmesserly): move this logic into the builder names |
| 50 if name == 'frogium': |
| 51 # Note: even though the browsers can run on more than one OS, we |
| 52 # found identical browser behavior across OS, so we're not running |
| 53 # everywhere for faster turnaround time. We're going to split different |
| 54 # browser+OS combinations into different bots. |
| 55 browsers = { 'win': 'ie', 'mac': 'safari', 'linux': 'ff' } |
| 56 browser = browsers[system] |
| 57 else: |
| 58 # TODO(jmesserly): remove this once builder is renamed |
| 59 pattern = re.match(OLD_BUILDER, builder_name) |
| 60 if pattern: |
| 61 name = 'frogium' |
| 62 system = pattern.group(1) |
| 63 mode = pattern.group(2) |
| 64 browser = 'chrome_drt' |
| 65 |
| 66 # TODO(jmesserly): rename the frogium bots so we don't need this |
| 67 if name == 'frogium': |
| 68 mode = 'release' |
| 69 |
| 70 return (name, mode, system, browser) |
43 | 71 |
44 | 72 |
45 def TestStep(name, mode, system, component, targets, flags): | 73 def TestStep(name, mode, system, component, targets, flags): |
46 print '@@@BUILD_STEP %s tests: %s %s@@@' % (name, component, flags) | 74 print '@@@BUILD_STEP %s tests: %s %s@@@' % (name, component, flags) |
47 sys.stdout.flush() | 75 sys.stdout.flush() |
48 if (component == 'frogium' or component == 'webdriver') and system == 'linux': | 76 if (component == 'frogium' or component == 'webdriver') and system == 'linux': |
49 cmd = ['xvfb-run', '-a'] | 77 cmd = ['xvfb-run', '-a'] |
50 else: | 78 else: |
51 cmd = [] | 79 cmd = [] |
52 | 80 |
(...skipping 26 matching lines...) Expand all Loading... |
79 | 107 |
80 # Make sure we are in the frog directory | 108 # Make sure we are in the frog directory |
81 os.chdir(FROG_PATH) | 109 os.chdir(FROG_PATH) |
82 | 110 |
83 print '@@@BUILD_STEP build frog@@@' | 111 print '@@@BUILD_STEP build frog@@@' |
84 return subprocess.call( | 112 return subprocess.call( |
85 [sys.executable, '../tools/build.py', '--mode=' + mode], | 113 [sys.executable, '../tools/build.py', '--mode=' + mode], |
86 env=NO_COLOR_ENV) | 114 env=NO_COLOR_ENV) |
87 | 115 |
88 | 116 |
89 def TestFrog(arch, mode, system, flags): | 117 def TestFrog(arch, mode, system, browser, flags): |
90 """ test frog. | 118 """ test frog. |
91 Args: | 119 Args: |
92 - arch: either 'leg', 'frog', 'frogsh' (frog self-hosted), or 'frogium' | 120 - arch: either 'leg', 'frog', 'frogsh' (frog self-hosted), or 'frogium' |
93 - mode: either 'debug' or 'release' | 121 - mode: either 'debug' or 'release' |
94 - system: either 'linux', 'mac', or 'windows' | 122 - system: either 'linux', 'mac', or 'windows' |
| 123 - browser: one of the browsers, see GetBuildInfo |
95 - flags: extra flags to pass to test.dart | 124 - flags: extra flags to pass to test.dart |
96 """ | 125 """ |
97 | 126 |
98 # Make sure we are in the frog directory | 127 # Make sure we are in the frog directory |
99 os.chdir(FROG_PATH) | 128 os.chdir(FROG_PATH) |
100 | 129 |
101 if arch != 'frogium': # frog and frogsh | 130 if arch != 'frogium': # frog and frogsh |
102 TestStep("frog", mode, system, arch, [], flags) | 131 TestStep("frog", mode, system, arch, [], flags) |
103 TestStep("frog_extra", mode, system, | 132 TestStep("frog_extra", mode, system, |
104 arch, ['frog', 'peg', 'css'], flags) | 133 arch, ['frog', 'peg', 'css'], flags) |
105 | 134 |
106 if arch == 'frogsh': | 135 if arch == 'frogsh': |
107 # There is no need to run these tests both for frog and frogsh. | 136 # There is no need to run these tests both for frog and frogsh. |
108 | 137 |
109 TestStep("leg", mode, system, 'leg', [], flags) | 138 TestStep("leg", mode, system, 'leg', [], flags) |
110 TestStep("leg_extra", mode, system, 'leg', ['leg_only'], flags) | 139 TestStep("leg_extra", mode, system, 'leg', ['leg_only'], flags) |
111 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 140 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
112 TestStep("leg_extra", mode, system, 'vm', ['leg'], flags) | 141 TestStep("leg_extra", mode, system, 'vm', ['leg'], flags) |
113 | 142 |
114 else: | 143 else: |
115 tests = ['client', 'language', 'corelib', 'isolate', 'frog', 'peg', 'css'] | 144 tests = ['client', 'language', 'corelib', 'isolate', 'frog', 'peg', 'css'] |
116 # TODO(efortuna): Eventually we want DumpRenderTree to run on all systems, | |
117 # but for test turnaround time, currently it is only running on linux. | |
118 if system == 'linux': | |
119 # DumpRenderTree tests (DRT is currently not available on Windows): | |
120 TestStep("browser", mode, system, 'frogium', tests, flags) | |
121 | 145 |
122 # Webdriver tests. Even though the browsers can run on more than one OS, we | 146 if browser == 'chrome_drt': |
123 # found identical browser behavior across OS, so we're not running | 147 # TODO(jmesserly): make DumpRenderTree more like other browser tests, so |
124 # everywhere for faster turnaround time. | 148 # we don't have this translation step. See dartbug.com/1158 |
125 if system == 'linux': | 149 TestStep('browser', mode, system, 'frogium', tests, flags) |
126 browsers = ['ff'] | |
127 elif system == 'mac': | |
128 browsers = ['safari'] | |
129 else: | 150 else: |
130 # TODO(efortuna): Use both ff and ie once we have additional buildbots. | |
131 # We're using just IE for speed on our testing right now. | |
132 browsers = ['ie'] #['ff', 'ie'] | |
133 | |
134 | |
135 for browser in browsers: | |
136 TestStep(browser, mode, system, 'webdriver', tests, | 151 TestStep(browser, mode, system, 'webdriver', tests, |
137 flags + ['--browser=' + browser]) | 152 flags + ['--browser=' + browser]) |
138 | 153 |
139 return 0 | 154 return 0 |
140 | 155 |
141 | 156 |
142 def main(): | 157 def main(): |
143 print 'main' | 158 print 'main' |
144 if len(sys.argv) == 0: | 159 if len(sys.argv) == 0: |
145 print 'Script pathname not known, giving up.' | 160 print 'Script pathname not known, giving up.' |
146 return 1 | 161 return 1 |
147 | 162 |
148 arch, mode, system = GetBuildInfo() | 163 arch, mode, system, browser = GetBuildInfo() |
149 print "arch: %s, mode: %s, system: %s" % (arch, mode, system) | 164 print "arch: %s, mode: %s, system: %s, browser %s" % (arch, mode, system, |
| 165 browser) |
150 if arch is None: | 166 if arch is None: |
151 return 1 | 167 return 1 |
152 | 168 |
153 if arch == 'frogium': | |
154 mode = 'release' | |
155 status = BuildFrog(arch, mode, system) | 169 status = BuildFrog(arch, mode, system) |
156 if status != 0: | 170 if status != 0: |
157 print '@@@STEP_FAILURE@@@' | 171 print '@@@STEP_FAILURE@@@' |
158 return status | 172 return status |
159 | 173 |
160 if arch != 'frogium': | 174 if arch != 'frogium': |
161 status = TestFrog(arch, mode, system, []) | 175 status = TestFrog(arch, mode, system, browser, []) |
162 if status != 0: | 176 if status != 0: |
163 print '@@@STEP_FAILURE@@@' | 177 print '@@@STEP_FAILURE@@@' |
164 return status | 178 return status |
165 | 179 |
166 status = TestFrog(arch, mode, system, ['--checked']) | 180 status = TestFrog(arch, mode, system, browser, ['--checked']) |
167 if status != 0: | 181 if status != 0: |
168 print '@@@STEP_FAILURE@@@' | 182 print '@@@STEP_FAILURE@@@' |
169 | 183 |
170 return status | 184 return status |
171 | 185 |
172 | 186 |
173 if __name__ == '__main__': | 187 if __name__ == '__main__': |
174 sys.exit(main()) | 188 sys.exit(main()) |
OLD | NEW |