| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Set of utilities to add commands to a buildbot factory. | 5 """Set of utilities to add commands to a buildbot factory. |
| 6 | 6 |
| 7 This is based on commands.py and adds swarm-specific commands.""" | 7 This is based on commands.py and adds swarm-specific commands.""" |
| 8 | 8 |
| 9 from buildbot.process.properties import WithProperties |
| 10 from buildbot.steps import shell |
| 11 |
| 9 from master.factory import commands | 12 from master.factory import commands |
| 10 | |
| 11 from master.log_parser import gtest_command | 13 from master.log_parser import gtest_command |
| 12 | 14 |
| 13 class SwarmCommands(commands.FactoryCommands): | 15 class SwarmCommands(commands.FactoryCommands): |
| 14 """Encapsulates methods to add swarm commands to a buildbot factory""" | 16 """Encapsulates methods to add swarm commands to a buildbot factory""" |
| 15 | 17 |
| 16 def AddSwarmTestStep(self, target_platform, swarm_server, swarm_port, | 18 def AddTriggerSwarmTestStep(self, target_platform, swarm_server, |
| 17 min_shards, max_shards, manifest_file, test_name): | 19 min_shards, max_shards, |
| 20 manifest_files, test_names): |
| 18 script_path = self.PathJoin(self._script_dir, 'run_slavelastic.py') | 21 script_path = self.PathJoin(self._script_dir, 'run_slavelastic.py') |
| 19 | 22 |
| 20 command = [self._python, script_path, '-m', min_shards, '-s', max_shards, | 23 # TODO(csharp) Merge into a single command |
| 21 '-o', target_platform, '-n', swarm_server, | 24 for i in range(len(manifest_files)): |
| 22 '-p', swarm_port, manifest_file] | 25 swarm_request_name = WithProperties('%s-%s-' + test_names[i], |
| 26 'buildername:-None', |
| 27 'buildnumber:-None') |
| 28 |
| 29 command = [self._python, script_path, '-m', min_shards, '-s', max_shards, |
| 30 '-o', target_platform, '-u', swarm_server, |
| 31 '-t', swarm_request_name, manifest_files[i]] |
| 32 |
| 33 self.AddTestStep(shell.ShellCommand, |
| 34 '%s_swarm' % test_names[i], |
| 35 command) |
| 36 |
| 37 def AddGetSwarmTestStep(self, swarm_server, test_name): |
| 38 script_path = self.PathJoin(self._script_dir, 'get_swarm_results.py') |
| 39 |
| 40 swarm_request_name = WithProperties('%s-%s-' + test_name, |
| 41 'buildername:-None', |
| 42 'buildnumber:-None') |
| 43 |
| 44 command = [self._python, script_path, '-u', swarm_server, |
| 45 swarm_request_name] |
| 23 | 46 |
| 24 self.AddTestStep(gtest_command.GTestCommand, | 47 self.AddTestStep(gtest_command.GTestCommand, |
| 25 '%s_swarm' % test_name, | 48 '%s_swarm' % test_name, |
| 26 command) | 49 command) |
| OLD | NEW |