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-(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 def GetBuildInfo(): | 26 def GetBuildInfo(): |
27 """Returns a tuple (name, mode) where: | 27 """Returns a tuple (name, mode, system) where: |
28 - name: 'frog', 'frogsh', or None when the builder has an incorrect name | 28 - name: 'frog', 'frogsh', or None when the builder has an incorrect name |
29 - mode: 'debug' or 'release' | 29 - mode: 'debug' or 'release' |
30 - system: 'linux', 'mac', or 'windows' | |
30 """ | 31 """ |
31 name = None | 32 name = None |
32 mode = None | 33 mode = None |
34 system = None | |
33 builder_name = os.environ.get(BUILDER_NAME) | 35 builder_name = os.environ.get(BUILDER_NAME) |
34 if builder_name: | 36 if builder_name: |
35 pattern = re.match(BUILDER_PATTERN, builder_name) | 37 pattern = re.match(BUILDER_PATTERN, builder_name) |
36 if pattern: | 38 if pattern: |
37 name = pattern.group(1) | 39 name = pattern.group(1) |
38 mode = pattern.group(2) | 40 system = pattern.group(2) |
39 return (name, mode) | 41 mode = pattern.group(3) |
42 return (name, mode, system) | |
40 | 43 |
41 # TODO(sigmund): delete this convertion when test.py uses the same | 44 # TODO(sigmund): delete this convertion when test.py uses the same |
42 # configuration we do here. | 45 # configuration we do here. |
43 def ConvertConfiguration(arch, mode): | 46 def ConvertConfiguration(arch, mode): |
44 ''' Convert arch/mode into modes/flags for test.py ''' | 47 ''' Convert arch/mode into modes/flags for test.py ''' |
45 # TODO(ngeoffray): do something meaningful for debug. | 48 # TODO(ngeoffray): do something meaningful for debug. |
46 testpy_mode = 'release' | 49 testpy_mode = 'release' |
47 flags = None | 50 flags = None |
48 if mode == 'debug': | 51 if mode == 'debug': |
49 flags = '--checked' | 52 flags = ['--checked'] |
50 return (testpy_mode, flags) | 53 return (testpy_mode, flags) |
51 | 54 |
52 def TestStep(name, mode, component, targets, flags): | 55 def TestStep(name, mode, component, targets, flags): |
53 print '@@@BUILD_STEP %s tests: %s@@@' % (name, component) | 56 print '@@@BUILD_STEP %s tests: %s@@@' % (name, component) |
54 if component == 'frogium': | 57 if component == 'frogium' or component == 'webdriver': |
55 cmd = ['xvfb-run'] | 58 cmd = ['xvfb-run', '-a'] |
56 else: | 59 else: |
57 cmd = [] | 60 cmd = [] |
58 | 61 |
59 cmd = (cmd | 62 cmd = (cmd |
60 + [sys.executable, | 63 + [sys.executable, |
61 '../tools/test_wrapper.py', | 64 '../tools/test_wrapper.py', |
62 '--mode=' + mode, | 65 '--mode=' + mode, |
63 '--component=' + component, | 66 '--component=' + component, |
64 '--time', | 67 '--time', |
65 '--report', | 68 '--report', |
66 '--progress=buildbot', | 69 '--progress=buildbot', |
67 '-v'] | 70 '-v'] |
68 + targets) | 71 + targets) |
69 if flags: | 72 if flags: |
70 cmd.append(flags) | 73 cmd.extend(flags) |
74 | |
71 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) | 75 exit_code = subprocess.call(cmd, env=NO_COLOR_ENV) |
72 if exit_code != 0: | 76 if exit_code != 0: |
73 print '@@@STEP_FAILURE@@@' | 77 print '@@@STEP_FAILURE@@@' |
74 return exit_code | 78 return exit_code |
75 | 79 |
76 def TestFrog(arch, mode): | 80 def TestFrog(arch, mode, system): |
77 """ build and test frog. | 81 """ build and test frog. |
78 Args: | 82 Args: |
79 - arch: either 'frog', 'frogsh' (frog self-hosted), or 'frogium' | 83 - arch: either 'frog', 'frogsh' (frog self-hosted), or 'frogium' |
80 - mode: either 'debug' (with type checks) or 'release' (without) | 84 - mode: either 'debug' (with type checks) or 'release' (without) |
85 - system: either 'linux', 'mac', or 'windows' | |
81 """ | 86 """ |
82 | 87 |
83 # Make sure we are in the frog directory | 88 # Make sure we are in the frog directory |
84 os.chdir(FROG_PATH) | 89 os.chdir(FROG_PATH) |
85 testpy_mode, flags = ConvertConfiguration(arch, mode) | 90 testpy_mode, flags = ConvertConfiguration(arch, mode) |
86 | 91 |
87 print '@@@BUILD_STEP build frog@@@' | 92 print '@@@BUILD_STEP build frog@@@' |
88 if subprocess.call( | 93 if subprocess.call( |
89 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode], | 94 [sys.executable, '../tools/build.py', '--mode=' + testpy_mode], |
90 env=NO_COLOR_ENV) != 0: | 95 env=NO_COLOR_ENV) != 0: |
91 return 1 | 96 return 1 |
92 | 97 |
93 if arch != 'frogium': # frog and frogsh | 98 if arch != 'frogium': # frog and frogsh |
94 TestStep("frog", testpy_mode, arch, [], flags) | 99 TestStep("frog", testpy_mode, arch, [], flags) |
95 TestStep("frog_extra", testpy_mode, arch, ['frog', 'peg', 'css'], flags) | 100 TestStep("frog_extra", testpy_mode, arch, ['frog', 'peg', 'css'], flags) |
96 | 101 |
97 TestStep("leg_extra", testpy_mode, arch, ['leg', 'leg_only'], flags) | 102 TestStep("leg_extra", testpy_mode, arch, ['leg', 'leg_only'], flags) |
98 | 103 |
99 TestStep("leg", testpy_mode, 'leg', [], flags) | 104 TestStep("leg", testpy_mode, 'leg', [], flags) |
100 | 105 |
101 TestStep("leg_extra", testpy_mode, 'leg', ['leg_only'], flags) | 106 TestStep("leg_extra", testpy_mode, 'leg', ['leg_only'], flags) |
102 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. | 107 # Leg isn't self-hosted (yet) so we run the leg unit tests on the VM. |
103 TestStep("leg_extra", testpy_mode, 'vm', ['leg'], flags) | 108 TestStep("leg_extra", testpy_mode, 'vm', ['leg'], flags) |
104 | 109 |
105 else: | 110 else: |
106 if (TestStep("browser", testpy_mode, 'frogium', | 111 # DumpRenderTree tests: |
107 ['client', 'language', 'corelib', 'isolate', 'frog', | 112 tests = [ |
108 'leg', 'peg', 'css'], flags) != 0): | 113 'client', 'language', 'corelib', 'isolate', 'frog', 'leg', 'peg', 'css'] |
109 return 1 | 114 TestStep("browser", testpy_mode, 'frogium', tests, flags) |
115 | |
116 # Webdriver tests. | |
117 if system == 'linux': | |
118 browsers = ['ff', 'chrome'] | |
119 elif system == 'mac': | |
120 browsers = ['ff', 'chrome', 'safari'] | |
121 else: | |
122 browsers = ['ff', 'chrome', 'ie'] | |
123 | |
124 for browser in browsers: | |
Emily Fortuna
2012/01/11 18:59:45
browsers never gets initialized to [], so in the c
Siggi Cherem (dart-lang)
2012/01/11 19:55:22
In this case it's ok, we are running webdriver tes
| |
125 TestStep(browser, testpy_mode, 'webdriver', tests, | |
126 flags + ['--browser=' + browser]) | |
110 | 127 |
111 return 0 | 128 return 0 |
112 | 129 |
113 def main(): | 130 def main(): |
114 print 'main' | 131 print 'main' |
115 if len(sys.argv) == 0: | 132 if len(sys.argv) == 0: |
116 print 'Script pathname not known, giving up.' | 133 print 'Script pathname not known, giving up.' |
117 return 1 | 134 return 1 |
118 | 135 |
119 arch, mode = GetBuildInfo() | 136 arch, mode, system = GetBuildInfo() |
120 print "arch: %s, mode: %s" % (arch, mode) | 137 print "arch: %s, mode: %s, system: %s" % (arch, mode, system) |
121 if arch is None: | 138 if arch is None: |
122 return 1 | 139 return 1 |
123 | 140 |
124 status = TestFrog(arch, mode) | 141 status = TestFrog(arch, mode, system) |
125 if status != 0: | 142 if status != 0: |
126 print '@@@STEP_FAILURE@@@' | 143 print '@@@STEP_FAILURE@@@' |
127 return status | 144 return status |
128 | 145 |
129 | 146 |
130 if __name__ == '__main__': | 147 if __name__ == '__main__': |
131 sys.exit(main()) | 148 sys.exit(main()) |
OLD | NEW |