Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Set of utilities to add commands to a buildbot factory. | 6 """Set of utilities to add commands to a buildbot factory. |
| 7 | 7 |
| 8 This is based on commands.py and adds chromium-specific commands.""" | 8 This is based on commands.py and adds chromium-specific commands.""" |
| 9 | 9 |
| 10 from buildbot.steps import shell | 10 from buildbot.steps import shell |
| 11 | 11 |
| 12 from master.factory import commands | 12 from master.factory import commands |
| 13 import config | 13 import config |
| 14 | 14 |
| 15 | 15 |
| 16 class V8Commands(commands.FactoryCommands): | 16 class V8Commands(commands.FactoryCommands): |
| 17 """Encapsulates methods to add v8 commands to a buildbot factory.""" | 17 """Encapsulates methods to add v8 commands to a buildbot factory.""" |
| 18 | 18 |
| 19 def __init__(self, factory=None, identifier=None, target=None, | 19 def __init__(self, factory=None, identifier=None, target=None, |
| 20 build_dir=None, target_platform=None): | 20 build_dir=None, target_platform=None, target_arch=None): |
| 21 | 21 |
| 22 commands.FactoryCommands.__init__(self, factory, identifier, | 22 commands.FactoryCommands.__init__(self, factory, identifier, |
| 23 target, build_dir, target_platform) | 23 target, build_dir, target_platform) |
| 24 | 24 |
| 25 # override _script_dir - one below because we run our build inside | 25 # Override _script_dir - one below because we run our build inside |
| 26 # the bleeding_edge directory | 26 # the bleeding_edge directory. |
| 27 self._script_dir = self.PathJoin('..', self._script_dir) | 27 self._script_dir = self.PathJoin('..', self._script_dir); |
| 28 | 28 |
| 29 # Where to point waterfall links for builds and test results. | 29 # Where to point waterfall links for builds and test results. |
| 30 self._archive_url = config.Master.archive_url | 30 self._archive_url = config.Master.archive_url |
| 31 | 31 |
| 32 # Where the v8 slave scritps are. | 32 # Where the v8 slave scritps are. |
| 33 self._v8_script_dir = self.PathJoin(self._script_dir, 'v8') | 33 self._v8_script_dir = self.PathJoin(self._script_dir, 'v8') |
| 34 self._private_script_dir = self.PathJoin(self._script_dir, '..', 'private') | 34 self._private_script_dir = self.PathJoin(self._script_dir, '..', 'private') |
| 35 | 35 |
| 36 self._es5conform_dir = self.PathJoin('bleeding_edge/test/es5conform/data') | 36 self._es5conform_dir = self.PathJoin('bleeding_edge/test/es5conform/data') |
| 37 self._es5conform_url = config.Master.es5conform_root_url | 37 self._es5conform_url = config.Master.es5conform_root_url |
| 38 self._es5conform_revision = config.Master.es5conform_revision | 38 self._es5conform_revision = config.Master.es5conform_revision |
| 39 self._arch = None; | |
| 40 if target_arch: | |
| 41 self._arch = target_arch; | |
| 39 | 42 |
| 40 if self._target_platform == 'win32': | 43 if self._target_platform == 'win32': |
| 41 # Override to use the right python | 44 # Override to use the right python |
| 42 python_path = self.PathJoin('..', 'src', 'third_party', 'python_24') | 45 python_path = self.PathJoin('..', 'src', 'third_party', 'python_24') |
| 43 self._python = self.PathJoin(python_path, 'python_slave') | 46 self._python = self.PathJoin(python_path, 'python_slave') |
| 44 | 47 |
| 45 # Create smaller name for the functions and vars to siplify the code below. | 48 # Create smaller name for the functions and vars to siplify the code below. |
| 46 J = self.PathJoin | 49 J = self.PathJoin |
| 50 | |
| 47 s_dir = self._v8_script_dir | 51 s_dir = self._v8_script_dir |
| 48 | 52 p_dir = self._private_script_dir |
| 53 self._archive_tool = J(s_dir, 'archive_v8.py') | |
| 49 self._v8_test_tool = J(self._build_dir, 'tools') | 54 self._v8_test_tool = J(self._build_dir, 'tools') |
| 50 | 55 |
| 51 # Scripts in the v8 scripts dir. | 56 # Scripts in the v8 scripts dir. |
| 52 self._v8testing_tool = J(s_dir, 'v8testing.py') | 57 self._v8testing_tool = J(s_dir, 'v8testing.py') |
| 53 self._v8_es5conform_tool = J(s_dir, 'v8_es5conform.py') | |
| 54 | 58 |
| 55 def AddV8Testing(self, properties=None): | 59 |
| 60 def AddV8Testing(self, properties=None, simulator=None, testname=None): | |
| 61 if (self._target_platform == 'win32'): | |
| 62 self.AddTaskkillStep(); | |
| 56 cmd = [self._python, self._v8testing_tool, | 63 cmd = [self._python, self._v8testing_tool, |
| 57 '--target', self._target] | 64 '--target', self._target] |
| 58 if (self._target_platform == 'win32'): | 65 if (testname): |
| 59 self.AddTaskkillStep() | 66 cmd += ['--testname', testname] |
| 67 if (simulator): | |
| 68 cmd += ['--simulator', simulator] | |
| 69 if (self._arch): | |
| 70 cmd += ['--arch', self._arch] | |
| 60 self.AddTestStep(shell.ShellCommand, | 71 self.AddTestStep(shell.ShellCommand, |
| 61 'Check', cmd, | 72 'Check', cmd, |
| 62 workdir='build/bleeding_edge/') | 73 workdir='build/bleeding_edge/') |
| 63 | 74 |
| 64 def AddV8ES5Conform(self, properties=None): | 75 def AddV8ES5Conform(self, properties=None, simulator=None): |
| 65 cmd = [self._python, self._v8testing_tool, | 76 cmd = [self._python, self._v8testing_tool, |
| 66 '--target', self._target, | 77 '--target', self._target, |
| 67 '--testname', 'es5conform'] | 78 '--testname', 'es5conform'] |
| 68 if (self._target_platform == 'win32'): | 79 if (self._target_platform == 'win32'): |
| 69 self.AddTaskkillStep() | 80 self.AddTaskkillStep(); |
|
nsylvain
2010/10/25 20:24:49
no ";"
| |
| 81 if (self._arch): | |
| 82 cmd += ['--arch', self._arch] | |
| 83 if (simulator): | |
| 84 cmd += ['--simulator', simulator] | |
| 70 self.AddTestStep(shell.ShellCommand, | 85 self.AddTestStep(shell.ShellCommand, |
| 71 'ES5-Conform', | 86 'ES5-Conform', |
| 72 cmd, | 87 cmd, |
| 73 workdir='build/bleeding_edge/') | 88 workdir='build/bleeding_edge/') |
| 74 | 89 |
| 75 def AddV8Mozilla(self, properties=None): | 90 def AddV8Mozilla(self, properties=None, simulator=None): |
| 76 cmd = [self._python, self._v8testing_tool, | 91 cmd = [self._python, self._v8testing_tool, |
| 77 '--target', self._target, | 92 '--target', self._target, |
| 78 '--build-dir', self._build_dir, | |
| 79 '--testname', 'mozilla'] | 93 '--testname', 'mozilla'] |
| 80 | 94 if (self._target_platform == 'win32'): |
| 95 self.AddTaskkillStep(); | |
| 96 if (self._arch): | |
| 97 cmd += ['--arch', self._arch] | |
| 98 if (simulator): | |
| 99 cmd += ['--simulator', simulator] | |
| 81 self.AddTestStep(shell.ShellCommand, 'Mozilla', cmd, | 100 self.AddTestStep(shell.ShellCommand, 'Mozilla', cmd, |
| 82 workdir='build/bleeding_edge/') | 101 workdir='build/bleeding_edge/') |
| 83 | 102 |
| 84 def AddV8Sputnik(self, properties=None): | 103 def AddV8Sputnik(self, properties=None, simulator=None): |
| 85 cmd = [self._python, self._v8testing_tool, | 104 cmd = [self._python, self._v8testing_tool, |
| 86 '--target', self._target, | 105 '--target', self._target, |
| 87 '--testname', 'sputnik'] | 106 '--testname', 'sputnik'] |
| 88 if (self._target_platform == 'win32'): | 107 if (self._target_platform == 'win32'): |
| 89 self.AddTaskkillStep() | 108 self.AddTaskkillStep(); |
|
nsylvain
2010/10/25 20:24:49
no ";"
| |
| 109 if (self._arch): | |
| 110 cmd += ['--arch', self._arch] | |
| 111 if (simulator): | |
| 112 cmd += ['--simulator', simulator] | |
| 90 self.AddTestStep(shell.ShellCommand, 'Sputnik', cmd, | 113 self.AddTestStep(shell.ShellCommand, 'Sputnik', cmd, |
| 91 workdir='build/bleeding_edge/') | 114 workdir='build/bleeding_edge/') |
| 92 | 115 |
| 93 def AddArmSimTest(self, properties=None): | 116 def AddrAmSimTest(self, properties=None): |
| 117 self.AddV8Sputnik(simulator='arm') | |
| 118 self.AddV8ES5Conform(simulator='arm') | |
| 119 self.AddV8Mozilla(simulator='arm') | |
| 94 cmd = [self._python, self._v8testing_tool, | 120 cmd = [self._python, self._v8testing_tool, |
| 95 '--target', self._target, | 121 '--target', self._target, |
| 96 '--build-dir', self._build_dir, | 122 '--build-dir', self._build_dir, |
| 97 '--simulator', 'arm'] | 123 '--simulator', 'arm'] |
| 98 self.AddTestStep(shell.ShellCommand, 'Arm test on simulator', cmd, | 124 self.AddTestStep(shell.ShellCommand, 'Arm test on simulator', cmd, |
| 99 workdir='build/bleeding_edge/') | 125 workdir='build/bleeding_edge/') |
| 100 | 126 |
| 101 def AddPresubmitTest(self, properties=None): | 127 def AddPresubmitTest(self, properties=None): |
| 102 cmd = [self._python, self._v8testing_tool, | 128 cmd = [self._python, self._v8testing_tool, |
| 103 '--testname', 'presubmit'] | 129 '--testname', 'presubmit'] |
| 104 self.AddTestStep(shell.ShellCommand, 'Presubmit', cmd, | 130 self.AddTestStep(shell.ShellCommand, 'Presubmit', cmd, |
| 105 workdir='build/bleeding_edge/') | 131 workdir='build/bleeding_edge/') |
| 132 | |
| 133 def AddFuzzer(self, properties=None): | |
| 134 cmd = ['./fuzz-v8.sh'] | |
| 135 self.AddTestStep(shell.ShellCommand, 'Fuzz', cmd, | |
| 136 workdir='build/bleeding_edge/') | |
| 137 | |
| 138 def AddLeakTests(self, properties=None): | |
| 139 cmd = [self._python, self._v8testing_tool, | |
| 140 '--testname', 'leak'] | |
| 141 env = { | |
| 142 'PATH': ( | |
| 143 self.build_dir + '../src/third_party/valgrind/linux_x86/bin;' | |
| 144 ), | |
| 145 'VALGRIND_LIB': ( | |
| 146 self.build_dir + '../src/third_party/valgrind/linux_x86/lib/valgrind' | |
| 147 ), | |
| 148 } | |
| 149 self.AddTestStep(shell.ShellCommand, 'leak', cmd, | |
| 150 env=env, | |
| 151 workdir='build/bleeding_edge/') | |
| 152 | |
| 153 def AddArchiveBuild(self, mode='dev', show_url=True, extra_archive_paths=None) : | |
|
nsylvain
2010/10/25 20:24:49
80 chars
| |
| 154 """Adds a step to the factory to archive a build.""" | |
| 155 if show_url: | |
| 156 url = '%s/%s/%s' % (self._archive_url, 'snapshots', self._identifier) | |
| 157 text = 'download' | |
| 158 else: | |
| 159 url = None | |
| 160 text = None | |
| 161 | |
| 162 cmd = [self._python, self._archive_tool, | |
| 163 '--target', self._target] | |
| 164 self.AddTestStep(shell.ShellCommand, 'Archiving', cmd, | |
| 165 workdir='build/bleeding_edge') | |
| 166 | |
| 167 def AddMoveExtracted(self): | |
| 168 """Adds a step to download and extract a previously archived build.""" | |
| 169 cmd = ('cp -R sconsbuild/release/* bleeding_edge/.') | |
| 170 self._factory.addStep(shell.ShellCommand, | |
| 171 description='Move extracted to bleeding', | |
| 172 timeout=600, | |
| 173 workdir='build', | |
| 174 command=cmd) | |
| OLD | NEW |