Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 system = None | 34 system = None |
| 35 builder_name = os.environ.get(BUILDER_NAME) | 35 builder_name = os.environ.get(BUILDER_NAME) |
| 36 if builder_name: | 36 if builder_name: |
| 37 pattern = re.match(BUILDER_PATTERN, builder_name) | 37 pattern = re.match(BUILDER_PATTERN, builder_name) |
| 38 if pattern: | 38 if pattern: |
| 39 name = pattern.group(1) | 39 name = pattern.group(1) |
| 40 system = pattern.group(2) | 40 system = pattern.group(2) |
| 41 mode = pattern.group(3) | 41 mode = pattern.group(3) |
| 42 return (name, mode, system) | 42 return (name, mode, system) |
| 43 | 43 |
| 44 # TODO(sigmund): delete this convertion when test.py uses the same | |
| 45 # configuration we do here. | |
| 46 def ConvertConfiguration(arch, mode): | |
| 47 ''' Convert arch/mode into modes/flags for test.py ''' | |
| 48 # TODO(ngeoffray): do something meaningful for debug. | |
| 49 testpy_mode = 'release' | |
| 50 flags = None | |
| 51 if mode == 'debug': | |
| 52 flags = ['--checked'] | |
| 53 return (testpy_mode, flags) | |
| 54 | 44 |
| 55 def TestStep(name, mode, system, component, targets, flags): | 45 def TestStep(name, mode, system, component, targets, flags): |
| 56 print '@@@BUILD_STEP %s tests: %s@@@' % (name, component) | 46 print '@@@BUILD_STEP %s tests: %s %s@@@' % (name, component, flags) |
|
Siggi Cherem (dart-lang)
2012/02/06 17:48:16
Maybe do: ' '.join(flags), so it reads better in t
| |
| 57 sys.stdout.flush() | 47 sys.stdout.flush() |
| 58 if (component == 'frogium' or component == 'webdriver') and system == 'linux': | 48 if (component == 'frogium' or component == 'webdriver') and system == 'linux': |
| 59 cmd = ['xvfb-run', '-a'] | 49 cmd = ['xvfb-run', '-a'] |
| 60 else: | 50 else: |
| 61 cmd = [] | 51 cmd = [] |
| 62 | 52 |
| 63 num_tasks = 8 | 53 num_tasks = 8 |
| 64 if system == 'windows': | 54 if system == 'windows': |
| 65 # TODO(efortuna): This is a temporary measure because webdriver isn't | 55 # TODO(efortuna): This is a temporary measure because webdriver isn't |
| 66 # threadsafe(!), and the results seem to be most obvious/problematic on | 56 # threadsafe(!), and the results seem to be most obvious/problematic on |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 79 '-v'] | 69 '-v'] |
| 80 + targets) | 70 + targets) |
| 81 if flags: | 71 if flags: |
| 82 cmd.extend(flags) | 72 cmd.extend(flags) |
| 83 | 73 |
| 84 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 74 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
| 85 if exit_code != 0: | 75 if exit_code != 0: |
| 86 print '@@@STEP_FAILURE@@@' | 76 print '@@@STEP_FAILURE@@@' |
| 87 return exit_code | 77 return exit_code |
| 88 | 78 |
| 89 def TestFrog(arch, mode, system): | 79 |
| 90 """ build and test frog. | 80 def BuildFrog(arch, mode, system): |
| 81 """ build frog. | |
| 91 Args: | 82 Args: |
| 92 - arch: either 'frog', 'frogsh' (frog self-hosted), or 'frogium' | 83 - arch: either 'leg', 'frog', 'frogsh' (frog self-hosted), or 'frogium' |
| 93 - mode: either 'debug' (with type checks) or 'release' (without) | 84 - mode: either 'debug' or 'release' |
| 94 - system: either 'linux', 'mac', or 'windows' | 85 - system: either 'linux', 'mac', or 'windows' |
| 95 """ | 86 """ |
| 96 | 87 |
| 97 # Make sure we are in the frog directory | 88 # Make sure we are in the frog directory |
| 98 os.chdir(FROG_PATH) | 89 os.chdir(FROG_PATH) |
| 99 testpy_mode, flags = ConvertConfiguration(arch, mode) | |
| 100 | 90 |
| 101 print '@@@BUILD_STEP build frog@@@' | 91 print '@@@BUILD_STEP build frog@@@' |
| 102 if subprocess.call( | 92 return subprocess.call( |
|
Siggi Cherem (dart-lang)
2012/02/06 17:48:16
I'm not sure how the buildbot scripts handle an ex
| |
| 103 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode], | 93 [sys.executable, '../tools/build.py', '--mode=' + mode], |
| 104 env=NO_COLOR_ENV) != 0: | 94 env=NO_COLOR_ENV) |
| 105 return 1 | 95 |
| 96 | |
| 97 def TestFrog(arch, mode, system, flags): | |
| 98 """ test frog. | |
| 99 Args: | |
| 100 - arch: either 'leg', 'frog', 'frogsh' (frog self-hosted), or 'frogium' | |
| 101 - mode: either 'debug' or 'release' | |
| 102 - system: either 'linux', 'mac', or 'windows' | |
| 103 - flags: extra flags to pass to test.dart | |
| 104 """ | |
| 105 | |
| 106 # Make sure we are in the frog directory | |
| 107 os.chdir(FROG_PATH) | |
| 106 | 108 |
| 107 if arch != 'frogium': # frog and frogsh | 109 if arch != 'frogium': # frog and frogsh |
| 108 TestStep("frog", testpy_mode, system, arch, [], flags) | 110 TestStep("frog", mode, system, arch, [], flags) |
| 109 TestStep("frog_extra", testpy_mode, system, | 111 TestStep("frog_extra", mode, system, |
| 110 arch, ['frog', 'peg', 'css'], flags) | 112 arch, ['frog', 'peg', 'css'], flags) |
| 111 | 113 |
| 112 if arch == 'frogsh': | 114 if arch == 'frogsh': |
| 113 # There is no need to run these tests both for frog and frogsh. | 115 # There is no need to run these tests both for frog and frogsh. |
| 114 | 116 |
| 115 TestStep("leg", testpy_mode, system, 'leg', [], flags) | 117 TestStep("leg", mode, system, 'leg', [], flags) |
| 116 TestStep("leg_extra", testpy_mode, system, 'leg', ['leg_only'], flags) | 118 TestStep("leg_extra", mode, system, 'leg', ['leg_only'], flags) |
| 117 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 119 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
| 118 TestStep("leg_extra", testpy_mode, system, 'vm', ['leg'], flags) | 120 TestStep("leg_extra", mode, system, 'vm', ['leg'], flags) |
| 119 | 121 |
| 120 else: | 122 else: |
| 121 tests = ['client', 'language', 'corelib', 'isolate', 'frog', 'peg', 'css'] | 123 tests = ['client', 'language', 'corelib', 'isolate', 'frog', 'peg', 'css'] |
| 122 if system != 'windows': | 124 if system != 'windows': |
| 123 # DumpRenderTree tests (DRT is currently not available on Windows): | 125 # DumpRenderTree tests (DRT is currently not available on Windows): |
| 124 TestStep("browser", testpy_mode, system, 'frogium', tests, flags) | 126 TestStep("browser", mode, system, 'frogium', tests, flags) |
| 125 | 127 |
| 126 # Webdriver tests. Even though the browsers can run on more than one OS, we | 128 # Webdriver tests. Even though the browsers can run on more than one OS, we |
| 127 # found identical browser behavior across OS, so we're not running | 129 # found identical browser behavior across OS, so we're not running |
| 128 # everywhere for faster turnaround time. | 130 # everywhere for faster turnaround time. |
| 129 if system == 'linux': | 131 if system == 'linux': |
| 130 browsers = ['ff'] | 132 browsers = ['ff'] |
| 131 elif system == 'mac': | 133 elif system == 'mac': |
| 132 browsers = ['safari'] | 134 browsers = ['safari'] |
| 133 else: | 135 else: |
| 134 browsers = ['ff', 'ie'] | 136 browsers = ['ff', 'ie'] |
| 135 | 137 |
| 136 for browser in browsers: | 138 for browser in browsers: |
| 137 TestStep(browser, testpy_mode, system, 'webdriver', tests, | 139 TestStep(browser, mode, system, 'webdriver', tests, |
| 138 flags + ['--browser=' + browser]) | 140 flags + ['--browser=' + browser]) |
| 139 | 141 |
| 140 return 0 | 142 return 0 |
| 141 | 143 |
| 144 | |
| 142 def main(): | 145 def main(): |
| 143 print 'main' | 146 print 'main' |
| 144 if len(sys.argv) == 0: | 147 if len(sys.argv) == 0: |
| 145 print 'Script pathname not known, giving up.' | 148 print 'Script pathname not known, giving up.' |
| 146 return 1 | 149 return 1 |
| 147 | 150 |
| 148 arch, mode, system = GetBuildInfo() | 151 arch, mode, system = GetBuildInfo() |
| 149 print "arch: %s, mode: %s, system: %s" % (arch, mode, system) | 152 print "arch: %s, mode: %s, system: %s" % (arch, mode, system) |
| 150 if arch is None: | 153 if arch is None: |
| 151 return 1 | 154 return 1 |
| 152 | 155 |
| 153 status = TestFrog(arch, mode, system) | 156 status = BuildFrog(arch, mode, system) |
| 154 if status != 0: | 157 if status != 0: |
| 155 print '@@@STEP_FAILURE@@@' | 158 print '@@@STEP_FAILURE@@@' |
| 159 return status | |
| 160 | |
| 161 status = TestFrog(arch, mode, system, []) | |
| 162 if status != 0: | |
| 163 print '@@@STEP_FAILURE@@@' | |
| 164 return status | |
| 165 | |
| 166 status = TestFrog(arch, mode, system, ['--checked']) | |
| 167 if status != 0: | |
| 168 print '@@@STEP_FAILURE@@@' | |
| 169 | |
| 156 return status | 170 return status |
| 157 | 171 |
| 158 | 172 |
| 159 if __name__ == '__main__': | 173 if __name__ == '__main__': |
| 160 sys.exit(main()) | 174 sys.exit(main()) |
| OLD | NEW |